michael@0: /* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsICmdLineService; michael@0: michael@0: [scriptable, uuid(bc0cb41f-4924-4c69-a65b-e35225a8650f)] michael@0: michael@0: interface nsIAppStartup : nsISupports michael@0: { michael@0: /** michael@0: * Create the hidden window. michael@0: */ michael@0: void createHiddenWindow(); michael@0: michael@0: /** michael@0: * Destroys the hidden window. This will have no effect if the hidden window michael@0: * has not yet been created. michael@0: */ michael@0: void destroyHiddenWindow(); michael@0: michael@0: /** michael@0: * Runs an application event loop: normally the main event pump which michael@0: * defines the lifetime of the application. If there are no windows open michael@0: * and no outstanding calls to enterLastWindowClosingSurvivalArea this michael@0: * method will exit immediately. michael@0: * michael@0: * @returnCode NS_SUCCESS_RESTART_APP michael@0: * This return code indicates that the application should be michael@0: * restarted because quit was called with the eRestart flag. michael@0: michael@0: * @returnCode NS_SUCCESS_RESTART_METRO_APP michael@0: * This return code indicates that the application should be michael@0: * restarted in metro because quit was called with the michael@0: * eRestartTouchEnviroment flag. michael@0: */ michael@0: void run(); michael@0: michael@0: /** michael@0: * There are situations where all application windows will be michael@0: * closed but we don't want to take this as a signal to quit the michael@0: * app. Bracket the code where the last window could close with michael@0: * these. michael@0: */ michael@0: void enterLastWindowClosingSurvivalArea(); michael@0: void exitLastWindowClosingSurvivalArea(); michael@0: michael@0: /** michael@0: * Startup Crash Detection michael@0: * michael@0: * Keeps track of application startup begining and success using flags to michael@0: * determine whether the application is crashing on startup. michael@0: * When the number of crashes crosses the acceptable threshold, safe mode michael@0: * or other repair procedures are performed. michael@0: */ michael@0: michael@0: /** michael@0: * Whether automatic safe mode is necessary at this time. This gets set michael@0: * in trackStartupCrashBegin. michael@0: * michael@0: * @see trackStartupCrashBegin michael@0: */ michael@0: readonly attribute boolean automaticSafeModeNecessary; michael@0: michael@0: /** michael@0: * Restart the application in safe mode michael@0: * @param aQuitMode michael@0: * This parameter modifies how the app is shutdown. michael@0: * @see nsIAppStartup::quit michael@0: */ michael@0: void restartInSafeMode(in uint32_t aQuitMode); michael@0: michael@0: /** michael@0: * If the last startup crashed then increment a counter. michael@0: * Set a flag so on next startup we can detect whether TrackStartupCrashEnd michael@0: * was called (and therefore the application crashed). michael@0: * @return whether safe mode is necessary michael@0: */ michael@0: bool trackStartupCrashBegin(); michael@0: michael@0: /** michael@0: * We have succesfully started without crashing. Clear flags that were michael@0: * tracking past crashes. michael@0: */ michael@0: void trackStartupCrashEnd(); michael@0: michael@0: /** michael@0: * The following flags may be passed as the aMode parameter to the quit michael@0: * method. One and only one of the "Quit" flags must be specified. The michael@0: * eRestart flag may be bit-wise combined with one of the "Quit" flags to michael@0: * cause the application to restart after it quits. michael@0: */ michael@0: michael@0: /** michael@0: * Attempt to quit if all windows are closed. michael@0: */ michael@0: const uint32_t eConsiderQuit = 0x01; michael@0: michael@0: /** michael@0: * Try to close all windows, then quit if successful. michael@0: */ michael@0: const uint32_t eAttemptQuit = 0x02; michael@0: michael@0: /** michael@0: * Quit, damnit! michael@0: */ michael@0: const uint32_t eForceQuit = 0x03; michael@0: michael@0: /** michael@0: * Restart the application after quitting. The application will be michael@0: * restarted with the same profile and an empty command line. michael@0: */ michael@0: const uint32_t eRestart = 0x10; michael@0: michael@0: /** michael@0: * When restarting attempt to start in the i386 architecture. Only supported michael@0: * on OSX. michael@0: */ michael@0: const uint32_t eRestarti386 = 0x20; michael@0: michael@0: /** michael@0: * When restarting attempt to start in the x86_64 architecture. Only michael@0: * supported on OSX. michael@0: */ michael@0: const uint32_t eRestartx86_64 = 0x40; michael@0: michael@0: /** michael@0: * Restart the application in a touch-optimized environment (such as Metro) michael@0: * after quitting. The application will be restarted with the same profile michael@0: * and an empty command line. michael@0: */ michael@0: const uint32_t eRestartTouchEnvironment = 0x80; michael@0: michael@0: /** michael@0: * Exit the event loop, and shut down the app. michael@0: * michael@0: * @param aMode michael@0: * This parameter modifies how the app is shutdown, and it is michael@0: * constructed from the constants defined above. michael@0: */ michael@0: void quit(in uint32_t aMode); michael@0: michael@0: /** michael@0: * True if the application is in the process of shutting down. michael@0: */ michael@0: readonly attribute boolean shuttingDown; michael@0: michael@0: /** michael@0: * True if the application is in the process of starting up. michael@0: * michael@0: * Startup is complete once all observers of final-ui-startup have returned. michael@0: */ michael@0: readonly attribute boolean startingUp; michael@0: michael@0: /** michael@0: * Mark the startup as completed. michael@0: * michael@0: * Called at the end of startup by nsAppRunner. michael@0: */ michael@0: [noscript] void doneStartingUp(); michael@0: michael@0: /** michael@0: * True if the application is being restarted michael@0: */ michael@0: readonly attribute boolean restarting; michael@0: michael@0: /** michael@0: * True if this is the startup following restart, i.e. if the application michael@0: * was restarted using quit(eRestart*). michael@0: */ michael@0: readonly attribute boolean wasRestarted; michael@0: michael@0: /** michael@0: * True if the application is being restarted in a touch-optimized michael@0: * environment (such as Metro). michael@0: */ michael@0: readonly attribute boolean restartingTouchEnvironment; michael@0: michael@0: /** michael@0: * Returns an object with main, process, firstPaint, sessionRestored properties. michael@0: * Properties may not be available depending on platform or application michael@0: */ michael@0: [implicit_jscontext] jsval getStartupInfo(); michael@0: michael@0: /** michael@0: * True if startup was interrupted by an interactive prompt. michael@0: */ michael@0: attribute boolean interrupted; michael@0: };