|
1 /* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
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 nsICmdLineService; |
|
9 |
|
10 [scriptable, uuid(bc0cb41f-4924-4c69-a65b-e35225a8650f)] |
|
11 |
|
12 interface nsIAppStartup : nsISupports |
|
13 { |
|
14 /** |
|
15 * Create the hidden window. |
|
16 */ |
|
17 void createHiddenWindow(); |
|
18 |
|
19 /** |
|
20 * Destroys the hidden window. This will have no effect if the hidden window |
|
21 * has not yet been created. |
|
22 */ |
|
23 void destroyHiddenWindow(); |
|
24 |
|
25 /** |
|
26 * Runs an application event loop: normally the main event pump which |
|
27 * defines the lifetime of the application. If there are no windows open |
|
28 * and no outstanding calls to enterLastWindowClosingSurvivalArea this |
|
29 * method will exit immediately. |
|
30 * |
|
31 * @returnCode NS_SUCCESS_RESTART_APP |
|
32 * This return code indicates that the application should be |
|
33 * restarted because quit was called with the eRestart flag. |
|
34 |
|
35 * @returnCode NS_SUCCESS_RESTART_METRO_APP |
|
36 * This return code indicates that the application should be |
|
37 * restarted in metro because quit was called with the |
|
38 * eRestartTouchEnviroment flag. |
|
39 */ |
|
40 void run(); |
|
41 |
|
42 /** |
|
43 * There are situations where all application windows will be |
|
44 * closed but we don't want to take this as a signal to quit the |
|
45 * app. Bracket the code where the last window could close with |
|
46 * these. |
|
47 */ |
|
48 void enterLastWindowClosingSurvivalArea(); |
|
49 void exitLastWindowClosingSurvivalArea(); |
|
50 |
|
51 /** |
|
52 * Startup Crash Detection |
|
53 * |
|
54 * Keeps track of application startup begining and success using flags to |
|
55 * determine whether the application is crashing on startup. |
|
56 * When the number of crashes crosses the acceptable threshold, safe mode |
|
57 * or other repair procedures are performed. |
|
58 */ |
|
59 |
|
60 /** |
|
61 * Whether automatic safe mode is necessary at this time. This gets set |
|
62 * in trackStartupCrashBegin. |
|
63 * |
|
64 * @see trackStartupCrashBegin |
|
65 */ |
|
66 readonly attribute boolean automaticSafeModeNecessary; |
|
67 |
|
68 /** |
|
69 * Restart the application in safe mode |
|
70 * @param aQuitMode |
|
71 * This parameter modifies how the app is shutdown. |
|
72 * @see nsIAppStartup::quit |
|
73 */ |
|
74 void restartInSafeMode(in uint32_t aQuitMode); |
|
75 |
|
76 /** |
|
77 * If the last startup crashed then increment a counter. |
|
78 * Set a flag so on next startup we can detect whether TrackStartupCrashEnd |
|
79 * was called (and therefore the application crashed). |
|
80 * @return whether safe mode is necessary |
|
81 */ |
|
82 bool trackStartupCrashBegin(); |
|
83 |
|
84 /** |
|
85 * We have succesfully started without crashing. Clear flags that were |
|
86 * tracking past crashes. |
|
87 */ |
|
88 void trackStartupCrashEnd(); |
|
89 |
|
90 /** |
|
91 * The following flags may be passed as the aMode parameter to the quit |
|
92 * method. One and only one of the "Quit" flags must be specified. The |
|
93 * eRestart flag may be bit-wise combined with one of the "Quit" flags to |
|
94 * cause the application to restart after it quits. |
|
95 */ |
|
96 |
|
97 /** |
|
98 * Attempt to quit if all windows are closed. |
|
99 */ |
|
100 const uint32_t eConsiderQuit = 0x01; |
|
101 |
|
102 /** |
|
103 * Try to close all windows, then quit if successful. |
|
104 */ |
|
105 const uint32_t eAttemptQuit = 0x02; |
|
106 |
|
107 /** |
|
108 * Quit, damnit! |
|
109 */ |
|
110 const uint32_t eForceQuit = 0x03; |
|
111 |
|
112 /** |
|
113 * Restart the application after quitting. The application will be |
|
114 * restarted with the same profile and an empty command line. |
|
115 */ |
|
116 const uint32_t eRestart = 0x10; |
|
117 |
|
118 /** |
|
119 * When restarting attempt to start in the i386 architecture. Only supported |
|
120 * on OSX. |
|
121 */ |
|
122 const uint32_t eRestarti386 = 0x20; |
|
123 |
|
124 /** |
|
125 * When restarting attempt to start in the x86_64 architecture. Only |
|
126 * supported on OSX. |
|
127 */ |
|
128 const uint32_t eRestartx86_64 = 0x40; |
|
129 |
|
130 /** |
|
131 * Restart the application in a touch-optimized environment (such as Metro) |
|
132 * after quitting. The application will be restarted with the same profile |
|
133 * and an empty command line. |
|
134 */ |
|
135 const uint32_t eRestartTouchEnvironment = 0x80; |
|
136 |
|
137 /** |
|
138 * Exit the event loop, and shut down the app. |
|
139 * |
|
140 * @param aMode |
|
141 * This parameter modifies how the app is shutdown, and it is |
|
142 * constructed from the constants defined above. |
|
143 */ |
|
144 void quit(in uint32_t aMode); |
|
145 |
|
146 /** |
|
147 * True if the application is in the process of shutting down. |
|
148 */ |
|
149 readonly attribute boolean shuttingDown; |
|
150 |
|
151 /** |
|
152 * True if the application is in the process of starting up. |
|
153 * |
|
154 * Startup is complete once all observers of final-ui-startup have returned. |
|
155 */ |
|
156 readonly attribute boolean startingUp; |
|
157 |
|
158 /** |
|
159 * Mark the startup as completed. |
|
160 * |
|
161 * Called at the end of startup by nsAppRunner. |
|
162 */ |
|
163 [noscript] void doneStartingUp(); |
|
164 |
|
165 /** |
|
166 * True if the application is being restarted |
|
167 */ |
|
168 readonly attribute boolean restarting; |
|
169 |
|
170 /** |
|
171 * True if this is the startup following restart, i.e. if the application |
|
172 * was restarted using quit(eRestart*). |
|
173 */ |
|
174 readonly attribute boolean wasRestarted; |
|
175 |
|
176 /** |
|
177 * True if the application is being restarted in a touch-optimized |
|
178 * environment (such as Metro). |
|
179 */ |
|
180 readonly attribute boolean restartingTouchEnvironment; |
|
181 |
|
182 /** |
|
183 * Returns an object with main, process, firstPaint, sessionRestored properties. |
|
184 * Properties may not be available depending on platform or application |
|
185 */ |
|
186 [implicit_jscontext] jsval getStartupInfo(); |
|
187 |
|
188 /** |
|
189 * True if startup was interrupted by an interactive prompt. |
|
190 */ |
|
191 attribute boolean interrupted; |
|
192 }; |