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