1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is Mozilla Communicator client code. This file was split
16 : * from xpfe/appshell/src/nsAppShellService.h
17 : *
18 : * The Initial Developer of the Original Code is
19 : * Netscape Communications Corporation.
20 : * Portions created by the Initial Developer are Copyright (C) 1998
21 : * the Initial Developer. All Rights Reserved.
22 : *
23 : * Contributor(s):
24 : * Benjamin Smedberg <bsmedberg@covad.net>
25 : * David Rajchenbach-Teller <dteller@mozilla.com>
26 : *
27 : * Alternatively, the contents of this file may be used under the terms of
28 : * either of the GNU General Public License Version 2 or later (the "GPL"),
29 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 : * in which case the provisions of the GPL or the LGPL are applicable instead
31 : * of those above. If you wish to allow use of your version of this file only
32 : * under the terms of either the GPL or the LGPL, and not to allow others to
33 : * use your version of this file under the terms of the MPL, indicate your
34 : * decision by deleting the provisions above and replace them with the notice
35 : * and other provisions required by the GPL or the LGPL. If you do not delete
36 : * the provisions above, a recipient may use your version of this file under
37 : * the terms of any one of the MPL, the GPL or the LGPL.
38 : *
39 : * ***** END LICENSE BLOCK ***** */
40 :
41 : #ifndef nsAppStartup_h__
42 : #define nsAppStartup_h__
43 :
44 : #include "nsIAppStartup.h"
45 : #include "nsIWindowCreator2.h"
46 : #include "nsIObserver.h"
47 : #include "nsWeakReference.h"
48 :
49 : #include "nsINativeAppSupport.h"
50 : #include "nsIAppShell.h"
51 :
52 : #if defined(XP_WIN)
53 : //XPerf-backed probes
54 : #include "mozilla/perfprobe.h"
55 : #include "nsAutoPtr.h"
56 : #endif //defined(XP_WIN)
57 :
58 :
59 : struct PLEvent;
60 :
61 : // {7DD4D320-C84B-4624-8D45-7BB9B2356977}
62 : #define NS_TOOLKIT_APPSTARTUP_CID \
63 : { 0x7dd4d320, 0xc84b, 0x4624, { 0x8d, 0x45, 0x7b, 0xb9, 0xb2, 0x35, 0x69, 0x77 } }
64 :
65 :
66 : class nsAppStartup : public nsIAppStartup,
67 : public nsIWindowCreator2,
68 : public nsIObserver,
69 : public nsSupportsWeakReference
70 : {
71 : public:
72 : NS_DECL_ISUPPORTS
73 : NS_DECL_NSIAPPSTARTUP
74 : NS_DECL_NSIWINDOWCREATOR
75 : NS_DECL_NSIWINDOWCREATOR2
76 : NS_DECL_NSIOBSERVER
77 :
78 : nsAppStartup();
79 : nsresult Init();
80 :
81 : private:
82 16 : ~nsAppStartup() { }
83 :
84 : void CloseAllWindows();
85 :
86 : friend class nsAppExitEvent;
87 :
88 : nsCOMPtr<nsIAppShell> mAppShell;
89 :
90 : PRInt32 mConsiderQuitStopper; // if > 0, Quit(eConsiderQuit) fails
91 : bool mRunning; // Have we started the main event loop?
92 : bool mShuttingDown; // Quit method reentrancy check
93 : bool mAttemptingQuit; // Quit(eAttemptQuit) still trying
94 : bool mRestart; // Quit(eRestart)
95 : bool mInterrupted; // Was startup interrupted by an interactive prompt?
96 : bool mIsSafeModeNecessary; // Whether safe mode is necessary
97 : bool mStartupCrashTrackingEnded; // Whether startup crash tracking has already ended
98 :
99 : #if defined(XP_WIN)
100 : //Interaction with OS-provided profiling probes
101 : typedef mozilla::probes::ProbeManager ProbeManager;
102 : typedef mozilla::probes::Probe Probe;
103 : nsRefPtr<ProbeManager> mProbesManager;
104 : nsRefPtr<Probe> mPlacesInitCompleteProbe;
105 : nsRefPtr<Probe> mSessionWindowRestoredProbe;
106 : #endif
107 : };
108 :
109 : #endif // nsAppStartup_h__
|