2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2000-02-05 08:38:13 +03:00
|
|
|
|
2009-01-03 07:06:52 +03:00
|
|
|
#ifndef nsWindowMediator_h_
|
|
|
|
#define nsWindowMediator_h_
|
2000-02-05 08:38:13 +03:00
|
|
|
|
2001-04-17 00:35:46 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2000-02-05 08:38:13 +03:00
|
|
|
#include "nsIWindowMediator.h"
|
2009-10-17 10:20:08 +04:00
|
|
|
#include "nsIObserver.h"
|
2009-03-08 12:38:59 +03:00
|
|
|
#include "nsTArray.h"
|
2017-08-17 08:29:03 +03:00
|
|
|
#include "nsString.h"
|
2009-10-17 10:20:08 +04:00
|
|
|
#include "nsWeakReference.h"
|
2017-03-06 04:50:52 +03:00
|
|
|
#include "nsTObserverArray.h"
|
2000-02-05 08:38:13 +03:00
|
|
|
|
2001-09-05 03:30:41 +04:00
|
|
|
class nsAppShellWindowEnumerator;
|
2019-11-05 20:56:28 +03:00
|
|
|
class nsASAppWindowEarlyToLateEnumerator;
|
2001-09-05 03:30:41 +04:00
|
|
|
class nsASDOMWindowEarlyToLateEnumerator;
|
2019-11-05 20:56:28 +03:00
|
|
|
class nsASAppWindowFrontToBackEnumerator;
|
|
|
|
class nsASAppWindowBackToFrontEnumerator;
|
2012-12-10 14:27:14 +04:00
|
|
|
class nsIWindowMediatorListener;
|
2000-02-05 08:38:13 +03:00
|
|
|
struct nsWindowInfo;
|
|
|
|
|
2018-03-20 12:27:00 +03:00
|
|
|
class nsWindowMediator : public nsIWindowMediator,
|
2009-10-17 10:20:08 +04:00
|
|
|
public nsIObserver,
|
|
|
|
public nsSupportsWeakReference {
|
2001-09-05 03:30:41 +04:00
|
|
|
friend class nsAppShellWindowEnumerator;
|
2019-11-05 20:56:28 +03:00
|
|
|
friend class nsASAppWindowEarlyToLateEnumerator;
|
2001-09-05 03:30:41 +04:00
|
|
|
friend class nsASDOMWindowEarlyToLateEnumerator;
|
2019-11-05 20:56:28 +03:00
|
|
|
friend class nsASAppWindowFrontToBackEnumerator;
|
|
|
|
friend class nsASAppWindowBackToFrontEnumerator;
|
2000-02-05 08:38:13 +03:00
|
|
|
|
2014-06-24 20:36:45 +04:00
|
|
|
protected:
|
|
|
|
virtual ~nsWindowMediator();
|
|
|
|
|
2000-02-05 08:38:13 +03:00
|
|
|
public:
|
2002-03-09 05:54:13 +03:00
|
|
|
nsWindowMediator();
|
2009-01-05 08:22:36 +03:00
|
|
|
|
2000-02-05 08:38:13 +03:00
|
|
|
nsresult Init();
|
|
|
|
|
2009-01-03 07:06:52 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
2009-01-05 08:22:36 +03:00
|
|
|
NS_DECL_NSIWINDOWMEDIATOR
|
2009-10-17 10:20:08 +04:00
|
|
|
NS_DECL_NSIOBSERVER
|
2000-02-05 08:38:13 +03:00
|
|
|
|
2019-11-05 20:56:28 +03:00
|
|
|
static nsresult GetDOMWindow(nsIAppWindow* inWindow,
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter>& outDOMWindow);
|
2013-12-04 02:03:45 +04:00
|
|
|
|
2000-02-05 08:38:13 +03:00
|
|
|
private:
|
2020-04-24 16:31:14 +03:00
|
|
|
void AddEnumerator(nsAppShellWindowEnumerator* inEnumerator);
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t RemoveEnumerator(nsAppShellWindowEnumerator* inEnumerator);
|
2015-12-11 21:32:15 +03:00
|
|
|
nsWindowInfo* MostRecentWindowInfo(const char16_t* inType,
|
2015-12-11 21:32:15 +03:00
|
|
|
bool aSkipPrivateBrowsingOrClosed = false);
|
2000-04-02 02:07:41 +04:00
|
|
|
|
2009-01-03 07:06:52 +03:00
|
|
|
nsresult UnregisterWindow(nsWindowInfo* inInfo);
|
2019-11-05 20:56:28 +03:00
|
|
|
nsWindowInfo* GetInfoFor(nsIAppWindow* aWindow);
|
2003-10-07 05:20:13 +04:00
|
|
|
nsWindowInfo* GetInfoFor(nsIWidget* aWindow);
|
|
|
|
void SortZOrderFrontToBack();
|
|
|
|
void SortZOrderBackToFront();
|
2000-04-02 02:07:41 +04:00
|
|
|
|
2009-03-08 12:38:59 +03:00
|
|
|
nsTArray<nsAppShellWindowEnumerator*> mEnumeratorList;
|
2009-01-05 08:22:36 +03:00
|
|
|
nsWindowInfo* mOldestWindow;
|
|
|
|
nsWindowInfo* mTopmostWindow;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mTimeStamp;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mSortingZOrder;
|
|
|
|
bool mReady;
|
2009-01-03 07:06:52 +03:00
|
|
|
|
2017-03-06 04:50:52 +03:00
|
|
|
typedef nsTObserverArray<nsCOMPtr<nsIWindowMediatorListener>> ListenerArray;
|
|
|
|
ListenerArray mListeners;
|
2000-02-05 08:38:13 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|