Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 "nsCRT.h"
17 #include "nsCOMArray.h"
19 class nsAppShellWindowEnumerator;
20 class nsASXULWindowEarlyToLateEnumerator;
21 class nsASDOMWindowEarlyToLateEnumerator;
22 class nsASDOMWindowFrontToBackEnumerator;
23 class nsASXULWindowFrontToBackEnumerator;
24 class nsASDOMWindowBackToFrontEnumerator;
25 class nsASXULWindowBackToFrontEnumerator;
26 class nsIWindowMediatorListener;
27 struct nsWindowInfo;
28 struct PRLock;
30 class nsWindowMediator :
31 public nsIWindowMediator,
32 public nsIObserver,
33 public nsSupportsWeakReference
34 {
35 friend class nsAppShellWindowEnumerator;
36 friend class nsASXULWindowEarlyToLateEnumerator;
37 friend class nsASDOMWindowEarlyToLateEnumerator;
38 friend class nsASDOMWindowFrontToBackEnumerator;
39 friend class nsASXULWindowFrontToBackEnumerator;
40 friend class nsASDOMWindowBackToFrontEnumerator;
41 friend class nsASXULWindowBackToFrontEnumerator;
43 public:
44 nsWindowMediator();
45 virtual ~nsWindowMediator();
47 nsresult Init();
49 NS_DECL_ISUPPORTS
50 NS_DECL_NSIWINDOWMEDIATOR
51 NS_DECL_NSIOBSERVER
53 static nsresult GetDOMWindow(nsIXULWindow* inWindow,
54 nsCOMPtr<nsIDOMWindow>& outDOMWindow);
56 private:
57 int32_t AddEnumerator(nsAppShellWindowEnumerator* inEnumerator);
58 int32_t RemoveEnumerator(nsAppShellWindowEnumerator* inEnumerator);
59 nsWindowInfo *MostRecentWindowInfo(const char16_t* inType);
61 nsresult UnregisterWindow(nsWindowInfo *inInfo);
62 nsWindowInfo *GetInfoFor(nsIXULWindow *aWindow);
63 nsWindowInfo *GetInfoFor(nsIWidget *aWindow);
64 void SortZOrderFrontToBack();
65 void SortZOrderBackToFront();
67 nsTArray<nsAppShellWindowEnumerator*> mEnumeratorList;
68 nsWindowInfo *mOldestWindow;
69 nsWindowInfo *mTopmostWindow;
70 int32_t mTimeStamp;
71 bool mSortingZOrder;
72 bool mReady;
73 mozilla::Mutex mListLock;
75 nsCOMArray<nsIWindowMediatorListener> mListeners;
76 };
78 #endif