toolkit/components/startup/public/nsIAppStartup.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/startup/public/nsIAppStartup.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,192 @@
     1.4 +/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +interface nsICmdLineService;
    1.12 +
    1.13 +[scriptable, uuid(bc0cb41f-4924-4c69-a65b-e35225a8650f)]
    1.14 +
    1.15 +interface nsIAppStartup : nsISupports
    1.16 +{
    1.17 +    /**
    1.18 +     * Create the hidden window.
    1.19 +     */
    1.20 +    void createHiddenWindow();
    1.21 +
    1.22 +    /**
    1.23 +     * Destroys the hidden window. This will have no effect if the hidden window
    1.24 +     * has not yet been created.
    1.25 +     */
    1.26 +    void destroyHiddenWindow();
    1.27 +
    1.28 +    /**
    1.29 +     * Runs an application event loop: normally the main event pump which
    1.30 +     * defines the lifetime of the application. If there are no windows open
    1.31 +     * and no outstanding calls to enterLastWindowClosingSurvivalArea this
    1.32 +     * method will exit immediately.
    1.33 +     *
    1.34 +     * @returnCode NS_SUCCESS_RESTART_APP
    1.35 +     *             This return code indicates that the application should be
    1.36 +     *             restarted because quit was called with the eRestart flag.
    1.37 +
    1.38 +     * @returnCode NS_SUCCESS_RESTART_METRO_APP
    1.39 +     *             This return code indicates that the application should be
    1.40 +     *             restarted in metro because quit was called with the
    1.41 +     *             eRestartTouchEnviroment flag.
    1.42 +     */
    1.43 +    void run();
    1.44 +
    1.45 +    /**
    1.46 +     * There are situations where all application windows will be
    1.47 +     * closed but we don't want to take this as a signal to quit the
    1.48 +     * app. Bracket the code where the last window could close with
    1.49 +     * these.
    1.50 +     */
    1.51 +    void enterLastWindowClosingSurvivalArea();
    1.52 +    void exitLastWindowClosingSurvivalArea();
    1.53 +
    1.54 +    /**
    1.55 +     * Startup Crash Detection
    1.56 +     *
    1.57 +     * Keeps track of application startup begining and success using flags to
    1.58 +     * determine whether the application is crashing on startup.
    1.59 +     * When the number of crashes crosses the acceptable threshold, safe mode
    1.60 +     * or other repair procedures are performed.
    1.61 +     */
    1.62 +
    1.63 +    /**
    1.64 +     * Whether automatic safe mode is necessary at this time.  This gets set
    1.65 +     * in trackStartupCrashBegin.
    1.66 +     *
    1.67 +     * @see trackStartupCrashBegin
    1.68 +     */
    1.69 +    readonly attribute boolean automaticSafeModeNecessary;
    1.70 +
    1.71 +    /**
    1.72 +     * Restart the application in safe mode
    1.73 +     * @param aQuitMode
    1.74 +     *        This parameter modifies how the app is shutdown.
    1.75 +     * @see nsIAppStartup::quit
    1.76 +     */
    1.77 +    void restartInSafeMode(in uint32_t aQuitMode);
    1.78 +
    1.79 +    /**
    1.80 +     * If the last startup crashed then increment a counter.
    1.81 +     * Set a flag so on next startup we can detect whether TrackStartupCrashEnd
    1.82 +     * was called (and therefore the application crashed).
    1.83 +     * @return whether safe mode is necessary
    1.84 +     */
    1.85 +    bool trackStartupCrashBegin();
    1.86 +
    1.87 +    /**
    1.88 +     * We have succesfully started without crashing. Clear flags that were
    1.89 +     * tracking past crashes.
    1.90 +     */
    1.91 +    void trackStartupCrashEnd();
    1.92 +
    1.93 +    /**
    1.94 +     * The following flags may be passed as the aMode parameter to the quit
    1.95 +     * method.  One and only one of the "Quit" flags must be specified.  The
    1.96 +     * eRestart flag may be bit-wise combined with one of the "Quit" flags to
    1.97 +     * cause the application to restart after it quits.
    1.98 +     */
    1.99 +
   1.100 +    /**
   1.101 +     * Attempt to quit if all windows are closed.
   1.102 +     */
   1.103 +    const uint32_t eConsiderQuit = 0x01;
   1.104 +
   1.105 +    /**
   1.106 +     * Try to close all windows, then quit if successful.
   1.107 +     */
   1.108 +    const uint32_t eAttemptQuit = 0x02;
   1.109 +
   1.110 +    /**
   1.111 +     * Quit, damnit!
   1.112 +     */
   1.113 +    const uint32_t eForceQuit = 0x03;
   1.114 +
   1.115 +    /**
   1.116 +     * Restart the application after quitting.  The application will be
   1.117 +     * restarted with the same profile and an empty command line.
   1.118 +     */
   1.119 +    const uint32_t eRestart = 0x10; 
   1.120 +
   1.121 +    /**
   1.122 +     * When restarting attempt to start in the i386 architecture. Only supported
   1.123 +     * on OSX.
   1.124 +     */
   1.125 +    const uint32_t eRestarti386 = 0x20;
   1.126 +
   1.127 +    /**
   1.128 +     * When restarting attempt to start in the x86_64 architecture. Only
   1.129 +     * supported on OSX.
   1.130 +     */
   1.131 +    const uint32_t eRestartx86_64 = 0x40;
   1.132 +
   1.133 +    /**
   1.134 +     * Restart the application in a touch-optimized environment (such as Metro)
   1.135 +     * after quitting. The application will be restarted with the same profile
   1.136 +     * and an empty command line.
   1.137 +     */
   1.138 +    const uint32_t eRestartTouchEnvironment = 0x80;
   1.139 +
   1.140 +    /**
   1.141 +     * Exit the event loop, and shut down the app.
   1.142 +     *
   1.143 +     * @param aMode
   1.144 +     *        This parameter modifies how the app is shutdown, and it is
   1.145 +     *        constructed from the constants defined above.
   1.146 +     */
   1.147 +    void quit(in uint32_t aMode);
   1.148 +
   1.149 +    /**
   1.150 +     * True if the application is in the process of shutting down.
   1.151 +     */
   1.152 +    readonly attribute boolean shuttingDown;
   1.153 +
   1.154 +    /**
   1.155 +     * True if the application is in the process of starting up.
   1.156 +     *
   1.157 +     * Startup is complete once all observers of final-ui-startup have returned.
   1.158 +     */
   1.159 +    readonly attribute boolean startingUp;
   1.160 +
   1.161 +    /**
   1.162 +     * Mark the startup as completed.
   1.163 +     *
   1.164 +     * Called at the end of startup by nsAppRunner.
   1.165 +     */
   1.166 +    [noscript] void doneStartingUp();
   1.167 +
   1.168 +    /**
   1.169 +     * True if the application is being restarted
   1.170 +     */
   1.171 +    readonly attribute boolean restarting;
   1.172 +
   1.173 +    /**
   1.174 +     * True if this is the startup following restart, i.e. if the application
   1.175 +     * was restarted using quit(eRestart*).
   1.176 +     */
   1.177 +    readonly attribute boolean wasRestarted;
   1.178 +
   1.179 +    /**
   1.180 +     * True if the application is being restarted in a touch-optimized
   1.181 +     * environment (such as Metro).
   1.182 +     */
   1.183 +    readonly attribute boolean restartingTouchEnvironment;
   1.184 +
   1.185 +    /** 
   1.186 +     * Returns an object with main, process, firstPaint, sessionRestored properties.
   1.187 +     * Properties may not be available depending on platform or application
   1.188 +     */
   1.189 +    [implicit_jscontext] jsval getStartupInfo();
   1.190 +
   1.191 +    /**
   1.192 +     * True if startup was interrupted by an interactive prompt.
   1.193 +     */
   1.194 +    attribute boolean interrupted;
   1.195 +};

mercurial