2000-08-31 06:07:04 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2000-01-22 06:15:41 +03:00
|
|
|
*
|
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-01-22 06:15:41 +03:00
|
|
|
|
|
|
|
#ifndef nsXULWindow_h__
|
|
|
|
#define nsXULWindow_h__
|
|
|
|
|
2000-01-26 00:59:31 +03:00
|
|
|
// Local Includes
|
|
|
|
#include "nsChromeTreeOwner.h"
|
|
|
|
#include "nsContentTreeOwner.h"
|
|
|
|
|
|
|
|
// Helper classes
|
2000-01-22 06:15:41 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2009-03-08 12:38:59 +03:00
|
|
|
#include "nsTArray.h"
|
2000-01-26 00:59:31 +03:00
|
|
|
#include "nsString.h"
|
2000-02-25 06:11:21 +03:00
|
|
|
#include "nsWeakReference.h"
|
2006-02-22 06:58:48 +03:00
|
|
|
#include "nsCOMArray.h"
|
2013-10-22 17:27:34 +04:00
|
|
|
#include "nsRect.h"
|
2015-12-03 16:19:50 +03:00
|
|
|
#include "Units.h"
|
2000-01-26 00:59:31 +03:00
|
|
|
|
|
|
|
// Interfaces needed
|
2000-01-22 06:15:41 +03:00
|
|
|
#include "nsIBaseWindow.h"
|
|
|
|
#include "nsIDocShell.h"
|
2000-01-26 00:59:31 +03:00
|
|
|
#include "nsIDocShellTreeItem.h"
|
2011-07-15 14:31:34 +04:00
|
|
|
#include "nsIDOMWindow.h"
|
2000-02-08 16:40:10 +03:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
2001-09-06 01:28:38 +04:00
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
2000-02-08 16:40:10 +03:00
|
|
|
#include "nsIXULWindow.h"
|
2001-04-10 22:30:25 +04:00
|
|
|
#include "nsIPrompt.h"
|
|
|
|
#include "nsIAuthPrompt.h"
|
2004-08-21 18:47:51 +04:00
|
|
|
#include "nsIXULBrowserWindow.h"
|
2005-02-23 08:29:44 +03:00
|
|
|
#include "nsIWeakReference.h"
|
2013-09-24 14:04:14 +04:00
|
|
|
#include "nsIWidgetListener.h"
|
2014-06-06 06:51:14 +04:00
|
|
|
#include "nsITabParent.h"
|
2000-01-26 00:59:31 +03:00
|
|
|
|
2013-07-18 10:54:08 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class Element;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2013-07-18 10:54:08 +04:00
|
|
|
|
2000-01-26 00:59:31 +03:00
|
|
|
// nsXULWindow
|
2000-01-22 06:15:41 +03:00
|
|
|
|
2006-02-22 06:58:48 +03:00
|
|
|
#define NS_XULWINDOW_IMPL_CID \
|
2009-09-29 06:20:46 +04:00
|
|
|
{ /* 8eaec2f3-ed02-4be2-8e0f-342798477298 */ \
|
|
|
|
0x8eaec2f3, \
|
|
|
|
0xed02, \
|
|
|
|
0x4be2, \
|
|
|
|
{ 0x8e, 0x0f, 0x34, 0x27, 0x98, 0x47, 0x72, 0x98 } \
|
2006-02-22 06:58:48 +03:00
|
|
|
}
|
|
|
|
|
2009-03-08 12:38:59 +03:00
|
|
|
class nsContentShellInfo;
|
|
|
|
|
2002-06-27 02:34:09 +04:00
|
|
|
class nsXULWindow : public nsIBaseWindow,
|
|
|
|
public nsIInterfaceRequestor,
|
2005-02-20 01:42:01 +03:00
|
|
|
public nsIXULWindow,
|
2002-06-27 02:34:09 +04:00
|
|
|
public nsSupportsWeakReference
|
2000-01-22 06:15:41 +03:00
|
|
|
{
|
|
|
|
friend class nsChromeTreeOwner;
|
|
|
|
friend class nsContentTreeOwner;
|
|
|
|
|
|
|
|
public:
|
2013-07-19 06:31:36 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2000-01-22 06:15:41 +03:00
|
|
|
|
2000-02-08 16:40:10 +03:00
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
2000-01-22 06:15:41 +03:00
|
|
|
NS_DECL_NSIXULWINDOW
|
|
|
|
NS_DECL_NSIBASEWINDOW
|
|
|
|
|
2006-02-22 06:58:48 +03:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULWINDOW_IMPL_CID)
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
void LockUntilChromeLoad() { mLockedUntilChromeLoad = true; }
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsLocked() const { return mLockedUntilChromeLoad; }
|
|
|
|
void IgnoreXULSizeMode(bool aEnable) { mIgnoreXULSizeMode = aEnable; }
|
2016-06-02 20:28:28 +03:00
|
|
|
void WasRegistered() { mRegistered = true; }
|
2005-02-20 01:42:01 +03:00
|
|
|
|
2000-01-22 06:15:41 +03:00
|
|
|
protected:
|
2003-10-07 05:20:16 +04:00
|
|
|
enum persistentAttributes {
|
|
|
|
PAD_MISC = 0x1,
|
|
|
|
PAD_POSITION = 0x2,
|
|
|
|
PAD_SIZE = 0x4
|
|
|
|
};
|
|
|
|
|
2014-09-03 02:24:24 +04:00
|
|
|
explicit nsXULWindow(uint32_t aChromeFlags);
|
2000-01-27 08:59:42 +03:00
|
|
|
virtual ~nsXULWindow();
|
2000-01-22 06:15:41 +03:00
|
|
|
|
|
|
|
NS_IMETHOD EnsureChromeTreeOwner();
|
|
|
|
NS_IMETHOD EnsureContentTreeOwner();
|
2000-01-30 10:29:38 +03:00
|
|
|
NS_IMETHOD EnsurePrimaryContentTreeOwner();
|
2001-04-10 22:30:25 +04:00
|
|
|
NS_IMETHOD EnsurePrompter();
|
|
|
|
NS_IMETHOD EnsureAuthPrompter();
|
2013-07-18 10:54:08 +04:00
|
|
|
|
2000-02-08 16:40:10 +03:00
|
|
|
void OnChromeLoaded();
|
2012-08-22 19:56:38 +04:00
|
|
|
void StaggerPosition(int32_t &aRequestedX, int32_t &aRequestedY,
|
|
|
|
int32_t aSpecWidth, int32_t aSpecHeight);
|
2016-03-02 00:05:10 +03:00
|
|
|
bool LoadPositionFromXUL(int32_t aSpecWidth, int32_t aSpecHeight);
|
|
|
|
bool LoadSizeFromXUL(int32_t& aSpecWidth, int32_t& aSpecHeight);
|
|
|
|
void SetSpecifiedSize(int32_t aSpecWidth, int32_t aSpecHeight);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool LoadMiscPersistentAttributesFromXUL();
|
2009-08-06 00:52:08 +04:00
|
|
|
void SyncAttributesToWidget();
|
2015-10-14 04:33:51 +03:00
|
|
|
NS_IMETHOD SavePersistentAttributes();
|
2000-02-08 16:40:10 +03:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
NS_IMETHOD GetWindowDOMWindow(mozIDOMWindowProxy** aDOMWindow);
|
2013-07-18 10:54:08 +04:00
|
|
|
mozilla::dom::Element* GetWindowDOMElement() const;
|
2006-02-22 06:58:48 +03:00
|
|
|
|
2007-10-06 03:37:25 +04:00
|
|
|
// See nsIDocShellTreeOwner for docs on next two methods
|
2014-06-02 16:08:21 +04:00
|
|
|
nsresult ContentShellAdded(nsIDocShellTreeItem* aContentShell,
|
2016-12-09 05:41:45 +03:00
|
|
|
bool aPrimary,
|
|
|
|
const nsAString& aID);
|
2014-06-02 16:08:21 +04:00
|
|
|
nsresult ContentShellRemoved(nsIDocShellTreeItem* aContentShell);
|
2016-07-14 23:31:41 +03:00
|
|
|
NS_IMETHOD GetPrimaryContentSize(int32_t* aWidth,
|
|
|
|
int32_t* aHeight);
|
|
|
|
NS_IMETHOD SetPrimaryContentSize(int32_t aWidth,
|
|
|
|
int32_t aHeight);
|
|
|
|
nsresult GetRootShellSize(int32_t* aWidth,
|
|
|
|
int32_t* aHeight);
|
|
|
|
nsresult SetRootShellSize(int32_t aWidth,
|
|
|
|
int32_t aHeight);
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD SizeShellTo(nsIDocShellTreeItem* aShellItem, int32_t aCX,
|
|
|
|
int32_t aCY);
|
2000-07-13 03:56:14 +04:00
|
|
|
NS_IMETHOD ExitModalLoop(nsresult aStatus);
|
2016-10-07 21:59:59 +03:00
|
|
|
NS_IMETHOD CreateNewChromeWindow(int32_t aChromeFlags, nsITabParent* aOpeningTab, mozIDOMWindowProxy* aOpenerWindow, nsIXULWindow **_retval);
|
|
|
|
NS_IMETHOD CreateNewContentWindow(int32_t aChromeFlags, nsITabParent* aOpeningTab, mozIDOMWindowProxy* aOpenerWindow, nsIXULWindow **_retval);
|
2016-07-14 23:31:41 +03:00
|
|
|
NS_IMETHOD GetHasPrimaryContent(bool* aResult);
|
2000-01-22 06:15:41 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void EnableParent(bool aEnable);
|
|
|
|
bool ConstrainToZLevel(bool aImmediate, nsWindowZ *aPlacement,
|
2003-09-24 18:31:03 +04:00
|
|
|
nsIWidget *aReqBelow, nsIWidget **aActualBelow);
|
2012-08-22 19:56:38 +04:00
|
|
|
void PlaceWindowLayersBehind(uint32_t aLowLevel, uint32_t aHighLevel,
|
2003-09-24 18:31:03 +04:00
|
|
|
nsIXULWindow *aBehind);
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetContentScrollbarVisibility(bool aVisible);
|
|
|
|
bool GetContentScrollbarVisibility();
|
2015-10-14 04:33:51 +03:00
|
|
|
void PersistentAttributesDirty(uint32_t aDirtyFlags);
|
2016-12-09 05:41:45 +03:00
|
|
|
nsresult GetTabCount(uint32_t* aResult);
|
2000-02-25 06:11:21 +03:00
|
|
|
|
2000-01-22 06:15:41 +03:00
|
|
|
nsChromeTreeOwner* mChromeTreeOwner;
|
|
|
|
nsContentTreeOwner* mContentTreeOwner;
|
2000-01-30 10:29:38 +03:00
|
|
|
nsContentTreeOwner* mPrimaryContentTreeOwner;
|
2000-01-22 06:15:41 +03:00
|
|
|
nsCOMPtr<nsIWidget> mWindow;
|
|
|
|
nsCOMPtr<nsIDocShell> mDocShell;
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> mDOMWindow;
|
2000-02-25 06:11:21 +03:00
|
|
|
nsCOMPtr<nsIWeakReference> mParentWindow;
|
2001-04-10 22:30:25 +04:00
|
|
|
nsCOMPtr<nsIPrompt> mPrompter;
|
|
|
|
nsCOMPtr<nsIAuthPrompt> mAuthPrompter;
|
2004-08-21 18:47:51 +04:00
|
|
|
nsCOMPtr<nsIXULBrowserWindow> mXULBrowserWindow;
|
2005-02-22 03:17:35 +03:00
|
|
|
nsCOMPtr<nsIDocShellTreeItem> mPrimaryContentShell;
|
2009-03-08 12:38:59 +03:00
|
|
|
nsTArray<nsContentShellInfo*> mContentShells; // array of doc shells by id
|
2000-07-13 03:56:14 +04:00
|
|
|
nsresult mModalStatus;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mContinueModalLoop;
|
|
|
|
bool mDebuting; // being made visible right now
|
|
|
|
bool mChromeLoaded; // True when chrome has loaded
|
|
|
|
bool mShowAfterLoad;
|
|
|
|
bool mIntrinsicallySized;
|
|
|
|
bool mCenterAfterLoad;
|
|
|
|
bool mIsHiddenWindow;
|
|
|
|
bool mLockedUntilChromeLoad;
|
|
|
|
bool mIgnoreXULSize;
|
|
|
|
bool mIgnoreXULPosition;
|
|
|
|
bool mChromeFlagsFrozen;
|
|
|
|
bool mIgnoreXULSizeMode;
|
2012-11-15 20:28:40 +04:00
|
|
|
// mDestroying is used to prevent reentry into into Destroy(), which can
|
|
|
|
// otherwise happen due to script running as we tear down various things.
|
|
|
|
bool mDestroying;
|
2016-06-02 20:28:28 +03:00
|
|
|
bool mRegistered;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mPersistentAttributesDirty; // persistentAttributes
|
|
|
|
uint32_t mPersistentAttributesMask;
|
|
|
|
uint32_t mChromeFlags;
|
2005-02-01 11:50:50 +03:00
|
|
|
nsString mTitle;
|
2009-09-29 06:20:46 +04:00
|
|
|
nsIntRect mOpenerScreenRect; // the screen rect of the opener
|
2006-02-22 06:58:48 +03:00
|
|
|
|
2015-10-01 20:06:51 +03:00
|
|
|
nsCOMPtr<nsITabParent> mPrimaryTabParent;
|
2016-07-14 23:31:41 +03:00
|
|
|
private:
|
|
|
|
nsresult GetPrimaryTabParentSize(int32_t* aWidth, int32_t* aHeight);
|
|
|
|
nsresult GetPrimaryContentShellSize(int32_t* aWidth, int32_t* aHeight);
|
|
|
|
nsresult SetPrimaryTabParentSize(int32_t aWidth, int32_t aHeight);
|
2000-01-26 00:59:31 +03:00
|
|
|
};
|
|
|
|
|
2006-02-22 06:58:48 +03:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsXULWindow, NS_XULWINDOW_IMPL_CID)
|
|
|
|
|
2000-01-26 00:59:31 +03:00
|
|
|
// nsContentShellInfo
|
2009-03-08 12:38:59 +03:00
|
|
|
// Used to map shell IDs to nsIDocShellTreeItems.
|
2000-01-26 00:59:31 +03:00
|
|
|
|
|
|
|
class nsContentShellInfo
|
|
|
|
{
|
|
|
|
public:
|
2001-10-31 05:46:21 +03:00
|
|
|
nsContentShellInfo(const nsAString& aID,
|
2005-02-23 08:29:44 +03:00
|
|
|
nsIWeakReference* aContentShell);
|
2000-01-26 00:59:31 +03:00
|
|
|
~nsContentShellInfo();
|
|
|
|
|
|
|
|
public:
|
2015-11-19 12:32:05 +03:00
|
|
|
nsString id; // The identifier of the content shell
|
2005-02-23 08:29:44 +03:00
|
|
|
nsWeakPtr child; // content shell (weak reference to nsIDocShellTreeItem)
|
2000-01-22 06:15:41 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsXULWindow_h__ */
|