xpfe/appshell/src/nsWindowMediator.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:55834bc2ba3e
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 nsWindowMediator_h_
7 #define nsWindowMediator_h_
8
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"
18
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;
29
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;
42
43 public:
44 nsWindowMediator();
45 virtual ~nsWindowMediator();
46
47 nsresult Init();
48
49 NS_DECL_ISUPPORTS
50 NS_DECL_NSIWINDOWMEDIATOR
51 NS_DECL_NSIOBSERVER
52
53 static nsresult GetDOMWindow(nsIXULWindow* inWindow,
54 nsCOMPtr<nsIDOMWindow>& outDOMWindow);
55
56 private:
57 int32_t AddEnumerator(nsAppShellWindowEnumerator* inEnumerator);
58 int32_t RemoveEnumerator(nsAppShellWindowEnumerator* inEnumerator);
59 nsWindowInfo *MostRecentWindowInfo(const char16_t* inType);
60
61 nsresult UnregisterWindow(nsWindowInfo *inInfo);
62 nsWindowInfo *GetInfoFor(nsIXULWindow *aWindow);
63 nsWindowInfo *GetInfoFor(nsIWidget *aWindow);
64 void SortZOrderFrontToBack();
65 void SortZOrderBackToFront();
66
67 nsTArray<nsAppShellWindowEnumerator*> mEnumeratorList;
68 nsWindowInfo *mOldestWindow;
69 nsWindowInfo *mTopmostWindow;
70 int32_t mTimeStamp;
71 bool mSortingZOrder;
72 bool mReady;
73 mozilla::Mutex mListLock;
74
75 nsCOMArray<nsIWindowMediatorListener> mListeners;
76 };
77
78 #endif

mercurial