2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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 05:38:13 +00:00
|
|
|
|
2009-01-03 04:06:52 +00:00
|
|
|
#ifndef nsWindowMediator_h_
|
|
|
|
#define nsWindowMediator_h_
|
2000-02-05 05:38:13 +00:00
|
|
|
|
2001-04-16 20:35:46 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2000-02-05 05:38:13 +00:00
|
|
|
#include "nsIWindowMediator.h"
|
2009-10-17 06:20:08 +00:00
|
|
|
#include "nsIObserver.h"
|
2009-03-08 09:38:59 +00:00
|
|
|
#include "nsTArray.h"
|
2017-08-17 05:29:03 +00:00
|
|
|
#include "nsString.h"
|
2009-10-17 06:20:08 +00:00
|
|
|
#include "nsWeakReference.h"
|
2017-03-06 01:50:52 +00:00
|
|
|
#include "nsTObserverArray.h"
|
2000-02-05 05:38:13 +00:00
|
|
|
|
2001-09-04 23:30:41 +00:00
|
|
|
class nsAppShellWindowEnumerator;
|
|
|
|
class nsASXULWindowEarlyToLateEnumerator;
|
|
|
|
class nsASDOMWindowEarlyToLateEnumerator;
|
|
|
|
class nsASXULWindowFrontToBackEnumerator;
|
|
|
|
class nsASXULWindowBackToFrontEnumerator;
|
2012-12-10 10:27:14 +00:00
|
|
|
class nsIWindowMediatorListener;
|
2000-02-05 05:38:13 +00:00
|
|
|
struct nsWindowInfo;
|
|
|
|
|
2018-03-20 09:27:00 +00:00
|
|
|
class nsWindowMediator : public nsIWindowMediator,
|
2009-10-17 06:20:08 +00:00
|
|
|
public nsIObserver,
|
|
|
|
public nsSupportsWeakReference {
|
2001-09-04 23:30:41 +00:00
|
|
|
friend class nsAppShellWindowEnumerator;
|
|
|
|
friend class nsASXULWindowEarlyToLateEnumerator;
|
|
|
|
friend class nsASDOMWindowEarlyToLateEnumerator;
|
|
|
|
friend class nsASXULWindowFrontToBackEnumerator;
|
|
|
|
friend class nsASXULWindowBackToFrontEnumerator;
|
2000-02-05 05:38:13 +00:00
|
|
|
|
2014-06-24 16:36:45 +00:00
|
|
|
protected:
|
|
|
|
virtual ~nsWindowMediator();
|
|
|
|
|
2000-02-05 05:38:13 +00:00
|
|
|
public:
|
2002-03-09 02:54:13 +00:00
|
|
|
nsWindowMediator();
|
2009-01-05 05:22:36 +00:00
|
|
|
|
2000-02-05 05:38:13 +00:00
|
|
|
nsresult Init();
|
|
|
|
|
2009-01-03 04:06:52 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
2009-01-05 05:22:36 +00:00
|
|
|
NS_DECL_NSIWINDOWMEDIATOR
|
2009-10-17 06:20:08 +00:00
|
|
|
NS_DECL_NSIOBSERVER
|
2000-02-05 05:38:13 +00:00
|
|
|
|
2013-12-03 22:03:45 +00:00
|
|
|
static nsresult GetDOMWindow(nsIXULWindow *inWindow,
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> &outDOMWindow);
|
2013-12-03 22:03:45 +00:00
|
|
|
|
2000-02-05 05:38:13 +00:00
|
|
|
private:
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t AddEnumerator(nsAppShellWindowEnumerator *inEnumerator);
|
|
|
|
int32_t RemoveEnumerator(nsAppShellWindowEnumerator *inEnumerator);
|
2015-12-11 18:32:15 +00:00
|
|
|
nsWindowInfo *MostRecentWindowInfo(const char16_t *inType,
|
2015-12-11 18:32:15 +00:00
|
|
|
bool aSkipPrivateBrowsingOrClosed = false);
|
2000-04-01 22:07:41 +00:00
|
|
|
|
2009-01-03 04:06:52 +00:00
|
|
|
nsresult UnregisterWindow(nsWindowInfo *inInfo);
|
2003-10-07 01:20:13 +00:00
|
|
|
nsWindowInfo *GetInfoFor(nsIXULWindow *aWindow);
|
|
|
|
nsWindowInfo *GetInfoFor(nsIWidget *aWindow);
|
|
|
|
void SortZOrderFrontToBack();
|
|
|
|
void SortZOrderBackToFront();
|
2000-04-01 22:07:41 +00:00
|
|
|
|
2009-03-08 09:38:59 +00:00
|
|
|
nsTArray<nsAppShellWindowEnumerator *> mEnumeratorList;
|
2009-01-05 05:22:36 +00:00
|
|
|
nsWindowInfo *mOldestWindow;
|
|
|
|
nsWindowInfo *mTopmostWindow;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mTimeStamp;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mSortingZOrder;
|
|
|
|
bool mReady;
|
2009-01-03 04:06:52 +00:00
|
|
|
|
2017-03-06 01:50:52 +00:00
|
|
|
typedef nsTObserverArray<nsCOMPtr<nsIWindowMediatorListener>> ListenerArray;
|
|
|
|
ListenerArray mListeners;
|
2000-02-05 05:38:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|