Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / xpfe / appshell / nsWindowMediator.h
blob35e4f809ae98c3b4e406770058c449cd65acef6a
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/. */
6 #ifndef nsWindowMediator_h_
7 #define nsWindowMediator_h_
9 #include "mozilla/Mutex.h"
10 #include "nsCOMPtr.h"
11 #include "nsIWindowMediator.h"
12 #include "nsIObserver.h"
13 #include "nsTArray.h"
14 #include "nsXPIDLString.h"
15 #include "nsWeakReference.h"
16 #include "nsCOMArray.h"
18 class nsAppShellWindowEnumerator;
19 class nsASXULWindowEarlyToLateEnumerator;
20 class nsASDOMWindowEarlyToLateEnumerator;
21 class nsASDOMWindowFrontToBackEnumerator;
22 class nsASXULWindowFrontToBackEnumerator;
23 class nsASDOMWindowBackToFrontEnumerator;
24 class nsASXULWindowBackToFrontEnumerator;
25 class nsIWindowMediatorListener;
26 struct nsWindowInfo;
27 struct PRLock;
29 class nsWindowMediator :
30 public nsIWindowMediator,
31 public nsIObserver,
32 public nsSupportsWeakReference
34 friend class nsAppShellWindowEnumerator;
35 friend class nsASXULWindowEarlyToLateEnumerator;
36 friend class nsASDOMWindowEarlyToLateEnumerator;
37 friend class nsASDOMWindowFrontToBackEnumerator;
38 friend class nsASXULWindowFrontToBackEnumerator;
39 friend class nsASDOMWindowBackToFrontEnumerator;
40 friend class nsASXULWindowBackToFrontEnumerator;
42 protected:
43 virtual ~nsWindowMediator();
45 public:
46 nsWindowMediator();
48 nsresult Init();
50 NS_DECL_ISUPPORTS
51 NS_DECL_NSIWINDOWMEDIATOR
52 NS_DECL_NSIOBSERVER
54 static nsresult GetDOMWindow(nsIXULWindow* inWindow,
55 nsCOMPtr<nsIDOMWindow>& outDOMWindow);
57 private:
58 int32_t AddEnumerator(nsAppShellWindowEnumerator* inEnumerator);
59 int32_t RemoveEnumerator(nsAppShellWindowEnumerator* inEnumerator);
60 nsWindowInfo *MostRecentWindowInfo(const char16_t* inType);
62 nsresult UnregisterWindow(nsWindowInfo *inInfo);
63 nsWindowInfo *GetInfoFor(nsIXULWindow *aWindow);
64 nsWindowInfo *GetInfoFor(nsIWidget *aWindow);
65 void SortZOrderFrontToBack();
66 void SortZOrderBackToFront();
68 nsTArray<nsAppShellWindowEnumerator*> mEnumeratorList;
69 nsWindowInfo *mOldestWindow;
70 nsWindowInfo *mTopmostWindow;
71 int32_t mTimeStamp;
72 bool mSortingZOrder;
73 bool mReady;
74 mozilla::Mutex mListLock;
76 nsCOMArray<nsIWindowMediatorListener> mListeners;
79 #endif