1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpfe/appshell/src/nsWindowMediator.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,78 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsWindowMediator_h_ 1.10 +#define nsWindowMediator_h_ 1.11 + 1.12 +#include "mozilla/Mutex.h" 1.13 +#include "nsCOMPtr.h" 1.14 +#include "nsIWindowMediator.h" 1.15 +#include "nsIObserver.h" 1.16 +#include "nsTArray.h" 1.17 +#include "nsXPIDLString.h" 1.18 +#include "nsWeakReference.h" 1.19 +#include "nsCRT.h" 1.20 +#include "nsCOMArray.h" 1.21 + 1.22 +class nsAppShellWindowEnumerator; 1.23 +class nsASXULWindowEarlyToLateEnumerator; 1.24 +class nsASDOMWindowEarlyToLateEnumerator; 1.25 +class nsASDOMWindowFrontToBackEnumerator; 1.26 +class nsASXULWindowFrontToBackEnumerator; 1.27 +class nsASDOMWindowBackToFrontEnumerator; 1.28 +class nsASXULWindowBackToFrontEnumerator; 1.29 +class nsIWindowMediatorListener; 1.30 +struct nsWindowInfo; 1.31 +struct PRLock; 1.32 + 1.33 +class nsWindowMediator : 1.34 + public nsIWindowMediator, 1.35 + public nsIObserver, 1.36 + public nsSupportsWeakReference 1.37 +{ 1.38 +friend class nsAppShellWindowEnumerator; 1.39 +friend class nsASXULWindowEarlyToLateEnumerator; 1.40 +friend class nsASDOMWindowEarlyToLateEnumerator; 1.41 +friend class nsASDOMWindowFrontToBackEnumerator; 1.42 +friend class nsASXULWindowFrontToBackEnumerator; 1.43 +friend class nsASDOMWindowBackToFrontEnumerator; 1.44 +friend class nsASXULWindowBackToFrontEnumerator; 1.45 + 1.46 +public: 1.47 + nsWindowMediator(); 1.48 + virtual ~nsWindowMediator(); 1.49 + 1.50 + nsresult Init(); 1.51 + 1.52 + NS_DECL_ISUPPORTS 1.53 + NS_DECL_NSIWINDOWMEDIATOR 1.54 + NS_DECL_NSIOBSERVER 1.55 + 1.56 + static nsresult GetDOMWindow(nsIXULWindow* inWindow, 1.57 + nsCOMPtr<nsIDOMWindow>& outDOMWindow); 1.58 + 1.59 +private: 1.60 + int32_t AddEnumerator(nsAppShellWindowEnumerator* inEnumerator); 1.61 + int32_t RemoveEnumerator(nsAppShellWindowEnumerator* inEnumerator); 1.62 + nsWindowInfo *MostRecentWindowInfo(const char16_t* inType); 1.63 + 1.64 + nsresult UnregisterWindow(nsWindowInfo *inInfo); 1.65 + nsWindowInfo *GetInfoFor(nsIXULWindow *aWindow); 1.66 + nsWindowInfo *GetInfoFor(nsIWidget *aWindow); 1.67 + void SortZOrderFrontToBack(); 1.68 + void SortZOrderBackToFront(); 1.69 + 1.70 + nsTArray<nsAppShellWindowEnumerator*> mEnumeratorList; 1.71 + nsWindowInfo *mOldestWindow; 1.72 + nsWindowInfo *mTopmostWindow; 1.73 + int32_t mTimeStamp; 1.74 + bool mSortingZOrder; 1.75 + bool mReady; 1.76 + mozilla::Mutex mListLock; 1.77 + 1.78 + nsCOMArray<nsIWindowMediatorListener> mListeners; 1.79 +}; 1.80 + 1.81 +#endif