|
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 interface nsIDOMWindow; |
|
9 interface nsIURI; |
|
10 interface nsIFrameLoaderOwner; |
|
11 |
|
12 [scriptable, uuid(e420bd32-b8c4-4b47-8cca-09e0bddbb0c3)] |
|
13 |
|
14 /** |
|
15 * The C++ source has access to the browser script source through |
|
16 * nsIBrowserDOMWindow. It is intended to be attached to the chrome DOMWindow |
|
17 * of a toplevel browser window (a XUL window). A DOMWindow that does not |
|
18 * happen to be a browser chrome window will simply have no access to any such |
|
19 * interface. |
|
20 */ |
|
21 interface nsIBrowserDOMWindow : nsISupports |
|
22 { |
|
23 /** |
|
24 * Values for openURI's aWhere parameter. |
|
25 */ |
|
26 /** |
|
27 * Do whatever the default is based on application state, user preferences, |
|
28 * and the value of the aContext parameter to openURI. |
|
29 */ |
|
30 const short OPEN_DEFAULTWINDOW = 0; |
|
31 /** |
|
32 * Open in the "current window". If aOpener is provided, this should be the |
|
33 * top window in aOpener's window hierarchy, but exact behavior is |
|
34 * application-dependent. If aOpener is not provided, it's up to the |
|
35 * application to decide what constitutes a "current window". |
|
36 */ |
|
37 const short OPEN_CURRENTWINDOW = 1; |
|
38 /** |
|
39 * Open in a new window. |
|
40 */ |
|
41 const short OPEN_NEWWINDOW = 2; |
|
42 /** |
|
43 * Open in a new content tab in the toplevel browser window corresponding to |
|
44 * this nsIBrowserDOMWindow. |
|
45 */ |
|
46 const short OPEN_NEWTAB = 3; |
|
47 /** |
|
48 * Open in an existing content tab based on the URI. If a match can't be |
|
49 * found, revert to OPEN_NEWTAB behavior. |
|
50 */ |
|
51 const short OPEN_SWITCHTAB = 4; |
|
52 |
|
53 /** |
|
54 * Values for openURI's aContext parameter. These affect the behavior of |
|
55 * OPEN_DEFAULTWINDOW. |
|
56 */ |
|
57 /** |
|
58 * external link (load request from another application, xremote, etc). |
|
59 */ |
|
60 const short OPEN_EXTERNAL = 1; |
|
61 /** |
|
62 * internal open new window |
|
63 */ |
|
64 const short OPEN_NEW = 2; |
|
65 |
|
66 /** |
|
67 * Load a URI |
|
68 |
|
69 * @param aURI the URI to open. null is allowed. If null is passed in, no |
|
70 * load will be done, though the window the load would have |
|
71 * happened in will be returned. |
|
72 * @param aWhere see possible values described above. |
|
73 * @param aOpener window requesting the open (can be null). |
|
74 * @param aContext the context in which the URI is being opened. This |
|
75 * is used only when aWhere == OPEN_DEFAULTWINDOW. |
|
76 * @return the window into which the URI was opened. |
|
77 */ |
|
78 nsIDOMWindow openURI(in nsIURI aURI, in nsIDOMWindow aOpener, |
|
79 in short aWhere, in short aContext); |
|
80 |
|
81 /** |
|
82 * As above, but return the nsIFrameLoaderOwner for the new window. |
|
83 // XXXbz is this the right API? Do we really need the opener here? |
|
84 // See bug 537428 |
|
85 */ |
|
86 nsIFrameLoaderOwner openURIInFrame(in nsIURI aURI, in nsIDOMWindow aOpener, |
|
87 in short aWhere, in short aContext); |
|
88 |
|
89 /** |
|
90 * @param aWindow the window to test. |
|
91 * @return whether the window is the main content window for any |
|
92 * currently open tab in this toplevel browser window. |
|
93 */ |
|
94 boolean isTabContentWindow(in nsIDOMWindow aWindow); |
|
95 |
|
96 /** |
|
97 * The contentWindow property of the currently selected browser. |
|
98 * This is used to implement .content in remote-Firefox. |
|
99 */ |
|
100 |
|
101 readonly attribute jsval contentWindow; |
|
102 }; |
|
103 |