1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 #ifndef __nsAppShellService_h
7 #define __nsAppShellService_h
8 
9 #include "nsIAppShellService.h"
10 #include "nsIObserver.h"
11 
12 // Interfaces Needed
13 #include "nsWebShellWindow.h"
14 #include "nsStringFwd.h"
15 #include "nsAutoPtr.h"
16 #include "nsITabParent.h"
17 #include "mozilla/Attributes.h"
18 
19 // {0099907D-123C-4853-A46A-43098B5FB68C}
20 #define NS_APPSHELLSERVICE_CID                      \
21   {                                                 \
22     0x99907d, 0x123c, 0x4853, {                     \
23       0xa4, 0x6a, 0x43, 0x9, 0x8b, 0x5f, 0xb6, 0x8c \
24     }                                               \
25   }
26 
27 class nsAppShellService final : public nsIAppShellService, public nsIObserver {
28  public:
29   NS_DECL_ISUPPORTS
30   NS_DECL_NSIAPPSHELLSERVICE
31   NS_DECL_NSIOBSERVER
32 
33   nsAppShellService();
34 
35  protected:
36   ~nsAppShellService();
37 
38   nsresult CreateHiddenWindowHelper(bool aIsPrivate);
39   void EnsurePrivateHiddenWindow();
40 
41   nsresult JustCreateTopWindow(nsIXULWindow *aParent, nsIURI *aUrl,
42                                uint32_t aChromeMask, int32_t aInitialWidth,
43                                int32_t aInitialHeight, bool aIsHiddenWindow,
44                                nsITabParent *aOpeningTab,
45                                mozIDOMWindowProxy *aOpenerWindow,
46                                nsWebShellWindow **aResult);
47   uint32_t CalculateWindowZLevel(nsIXULWindow *aParent, uint32_t aChromeMask);
48 
49   RefPtr<nsWebShellWindow> mHiddenWindow;
50   RefPtr<nsWebShellWindow> mHiddenPrivateWindow;
51   bool mXPCOMWillShutDown;
52   bool mXPCOMShuttingDown;
53   uint16_t mModalWindowCount;
54   bool mApplicationProvidedHiddenWindow;
55   uint32_t mScreenId;
56 };
57 
58 #endif
59