toolkit/components/startup/public/nsIAppStartup.idl

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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

mercurial