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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsWindowMediator_h_ |
michael@0 | 7 | #define nsWindowMediator_h_ |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/Mutex.h" |
michael@0 | 10 | #include "nsCOMPtr.h" |
michael@0 | 11 | #include "nsIWindowMediator.h" |
michael@0 | 12 | #include "nsIObserver.h" |
michael@0 | 13 | #include "nsTArray.h" |
michael@0 | 14 | #include "nsXPIDLString.h" |
michael@0 | 15 | #include "nsWeakReference.h" |
michael@0 | 16 | #include "nsCRT.h" |
michael@0 | 17 | #include "nsCOMArray.h" |
michael@0 | 18 | |
michael@0 | 19 | class nsAppShellWindowEnumerator; |
michael@0 | 20 | class nsASXULWindowEarlyToLateEnumerator; |
michael@0 | 21 | class nsASDOMWindowEarlyToLateEnumerator; |
michael@0 | 22 | class nsASDOMWindowFrontToBackEnumerator; |
michael@0 | 23 | class nsASXULWindowFrontToBackEnumerator; |
michael@0 | 24 | class nsASDOMWindowBackToFrontEnumerator; |
michael@0 | 25 | class nsASXULWindowBackToFrontEnumerator; |
michael@0 | 26 | class nsIWindowMediatorListener; |
michael@0 | 27 | struct nsWindowInfo; |
michael@0 | 28 | struct PRLock; |
michael@0 | 29 | |
michael@0 | 30 | class nsWindowMediator : |
michael@0 | 31 | public nsIWindowMediator, |
michael@0 | 32 | public nsIObserver, |
michael@0 | 33 | public nsSupportsWeakReference |
michael@0 | 34 | { |
michael@0 | 35 | friend class nsAppShellWindowEnumerator; |
michael@0 | 36 | friend class nsASXULWindowEarlyToLateEnumerator; |
michael@0 | 37 | friend class nsASDOMWindowEarlyToLateEnumerator; |
michael@0 | 38 | friend class nsASDOMWindowFrontToBackEnumerator; |
michael@0 | 39 | friend class nsASXULWindowFrontToBackEnumerator; |
michael@0 | 40 | friend class nsASDOMWindowBackToFrontEnumerator; |
michael@0 | 41 | friend class nsASXULWindowBackToFrontEnumerator; |
michael@0 | 42 | |
michael@0 | 43 | public: |
michael@0 | 44 | nsWindowMediator(); |
michael@0 | 45 | virtual ~nsWindowMediator(); |
michael@0 | 46 | |
michael@0 | 47 | nsresult Init(); |
michael@0 | 48 | |
michael@0 | 49 | NS_DECL_ISUPPORTS |
michael@0 | 50 | NS_DECL_NSIWINDOWMEDIATOR |
michael@0 | 51 | NS_DECL_NSIOBSERVER |
michael@0 | 52 | |
michael@0 | 53 | static nsresult GetDOMWindow(nsIXULWindow* inWindow, |
michael@0 | 54 | nsCOMPtr<nsIDOMWindow>& outDOMWindow); |
michael@0 | 55 | |
michael@0 | 56 | private: |
michael@0 | 57 | int32_t AddEnumerator(nsAppShellWindowEnumerator* inEnumerator); |
michael@0 | 58 | int32_t RemoveEnumerator(nsAppShellWindowEnumerator* inEnumerator); |
michael@0 | 59 | nsWindowInfo *MostRecentWindowInfo(const char16_t* inType); |
michael@0 | 60 | |
michael@0 | 61 | nsresult UnregisterWindow(nsWindowInfo *inInfo); |
michael@0 | 62 | nsWindowInfo *GetInfoFor(nsIXULWindow *aWindow); |
michael@0 | 63 | nsWindowInfo *GetInfoFor(nsIWidget *aWindow); |
michael@0 | 64 | void SortZOrderFrontToBack(); |
michael@0 | 65 | void SortZOrderBackToFront(); |
michael@0 | 66 | |
michael@0 | 67 | nsTArray<nsAppShellWindowEnumerator*> mEnumeratorList; |
michael@0 | 68 | nsWindowInfo *mOldestWindow; |
michael@0 | 69 | nsWindowInfo *mTopmostWindow; |
michael@0 | 70 | int32_t mTimeStamp; |
michael@0 | 71 | bool mSortingZOrder; |
michael@0 | 72 | bool mReady; |
michael@0 | 73 | mozilla::Mutex mListLock; |
michael@0 | 74 | |
michael@0 | 75 | nsCOMArray<nsIWindowMediatorListener> mListeners; |
michael@0 | 76 | }; |
michael@0 | 77 | |
michael@0 | 78 | #endif |