|
1 /* -*- Mode: C++; 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 nsIXULWindow; |
|
9 interface nsIWebNavigation; |
|
10 interface nsIURI; |
|
11 interface nsIDOMWindow; |
|
12 interface nsIAppShell; |
|
13 |
|
14 [ptr] native JSContext(JSContext); |
|
15 |
|
16 %{C++ |
|
17 #include "js/TypeDecls.h" |
|
18 %} |
|
19 |
|
20 [scriptable, uuid(2fa2f813-c216-4efb-8a8c-de60108ce5e5)] |
|
21 interface nsIAppShellService : nsISupports |
|
22 { |
|
23 /** |
|
24 * Create a window, which will be initially invisible. |
|
25 * @param aParent the parent window. Can be null. |
|
26 * @param aUrl the contents of the new window. |
|
27 * @param aChromeMask chrome flags affecting the kind of OS border |
|
28 * given to the window. see nsIBrowserWindow for |
|
29 * bit/flag definitions. |
|
30 * @param aCallbacks interface providing C++ hooks for window initialization |
|
31 * before the window is made visible. Can be null. |
|
32 * Deprecated. |
|
33 * @param aInitialWidth width, in pixels, of the window. Width of window |
|
34 * at creation. Can be overridden by the "width" |
|
35 * tag in the XUL. Set to NS_SIZETOCONTENT to force |
|
36 * the window to wrap to its contents. |
|
37 * @param aInitialHeight like aInitialWidth, but subtly different. |
|
38 * @param aResult the newly created window is returned here. |
|
39 */ |
|
40 const long SIZE_TO_CONTENT = -1; |
|
41 nsIXULWindow createTopLevelWindow(in nsIXULWindow aParent, |
|
42 in nsIURI aUrl, |
|
43 in uint32_t aChromeMask, |
|
44 in long aInitialWidth, |
|
45 in long aInitialHeight); |
|
46 |
|
47 /** |
|
48 * This is the constructor for creating an invisible DocShell. |
|
49 * It is used to simulate DOM windows without an actual physical |
|
50 * representation. |
|
51 * @param aIsChrome Set true if you want to use it for chrome content. |
|
52 */ |
|
53 nsIWebNavigation createWindowlessBrowser([optional] in bool aIsChrome); |
|
54 |
|
55 [noscript] |
|
56 void createHiddenWindow(); |
|
57 |
|
58 void destroyHiddenWindow(); |
|
59 |
|
60 /** |
|
61 * Return the (singleton) application hidden window, automatically created |
|
62 * and maintained by this AppShellService. |
|
63 * @param aResult the hidden window. Do not unhide hidden window. |
|
64 * Do not taunt hidden window. |
|
65 */ |
|
66 readonly attribute nsIXULWindow hiddenWindow; |
|
67 |
|
68 /** |
|
69 * Return the (singleton) application hidden window, automatically created |
|
70 * and maintained by this AppShellService. |
|
71 * @param aResult the hidden window. Do not unhide hidden window. |
|
72 * Do not taunt hidden window. |
|
73 */ |
|
74 readonly attribute nsIDOMWindow hiddenDOMWindow; |
|
75 |
|
76 /** |
|
77 * Return the (singleton) application hidden private window, automatically |
|
78 * created and maintained by this AppShellService. This window is created |
|
79 * in private browsing mode. |
|
80 * @param aResult the hidden private window. Do not unhide hidden window. |
|
81 * Do not taunt hidden window. |
|
82 */ |
|
83 readonly attribute nsIXULWindow hiddenPrivateWindow; |
|
84 |
|
85 /** |
|
86 * Return the (singleton) application hidden private window, automatically |
|
87 * created and maintained by this AppShellService. This window is created |
|
88 * in private browsing mode. |
|
89 * @param aResult the hidden private window. Do not unhide hidden window. |
|
90 * Do not taunt hidden window. |
|
91 */ |
|
92 readonly attribute nsIDOMWindow hiddenPrivateDOMWindow; |
|
93 |
|
94 /** |
|
95 * Return the (singleton) application hidden window as an nsIDOMWindow, |
|
96 * and, the corresponding JavaScript context pointer. This is useful |
|
97 * if you'd like to subsequently call OpenDialog on the hidden window. |
|
98 * @aHiddenDOMWindow the hidden window QI'd to type nsIDOMWindow |
|
99 * @aJSContext the corresponding JavaScript context |
|
100 */ |
|
101 [noscript] |
|
102 void getHiddenWindowAndJSContext(out nsIDOMWindow aHiddenDOMWindow, |
|
103 out JSContext aJSContext); |
|
104 |
|
105 /** |
|
106 * Return true if the application hidden window was provided by the |
|
107 * application. If it wasn't, the default hidden window was used. This will |
|
108 * usually be false on all non-mac platforms. |
|
109 */ |
|
110 readonly attribute boolean applicationProvidedHiddenWindow; |
|
111 |
|
112 /** |
|
113 * Add a window to the application's registry of windows. These windows |
|
114 * are generally shown in the Windows taskbar, and the application |
|
115 * knows it can't quit until it's out of registered windows. |
|
116 * @param aWindow the window to register |
|
117 * @note When this method is successful, it fires the global notification |
|
118 * "xul-window-registered" |
|
119 */ |
|
120 void registerTopLevelWindow(in nsIXULWindow aWindow); |
|
121 |
|
122 /** |
|
123 * Remove a window from the application's window registry. Note that |
|
124 * this method won't automatically attempt to quit the app when |
|
125 * the last window is unregistered. For that, see Quit(). |
|
126 * @param aWindow you see the pattern |
|
127 */ |
|
128 void unregisterTopLevelWindow(in nsIXULWindow aWindow); |
|
129 |
|
130 /** |
|
131 * Whether the hidden private window has been lazily created. |
|
132 */ |
|
133 [noscript] |
|
134 readonly attribute boolean hasHiddenPrivateWindow; |
|
135 |
|
136 /** |
|
137 * Start/stop tracking lags in the event loop. |
|
138 * If the event loop gets unresponsive, a "event-loop-lag" notification |
|
139 * is sent. Note that calling `startEventLoopLagTracking` when tracking |
|
140 * is already enabled has no effect. |
|
141 * @return true if tracking succeeded. |
|
142 */ |
|
143 bool startEventLoopLagTracking(); |
|
144 void stopEventLoopLagTracking(); |
|
145 }; |