/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * 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/. */#ifndef nsXULWindow_h__#define nsXULWindow_h__// Local Includes#include"nsChromeTreeOwner.h"#include"nsContentTreeOwner.h"// Helper classes#include"nsCOMPtr.h"#include"nsTArray.h"#include"nsString.h"#include"nsWeakReference.h"#include"nsCOMArray.h"#include"nsRect.h"#include"Units.h"// Interfaces needed#include"nsIBaseWindow.h"#include"nsIDocShell.h"#include"nsIDocShellTreeItem.h"#include"nsIDOMWindow.h"#include"nsIInterfaceRequestor.h"#include"nsIInterfaceRequestorUtils.h"#include"nsIXULWindow.h"#include"nsIPrompt.h"#include"nsIAuthPrompt.h"#include"nsIXULBrowserWindow.h"#include"nsIWeakReference.h"#include"nsIWidgetListener.h"#include"nsITabParent.h"namespacemozilla{namespacedom{classElement;}// namespace dom}// namespace mozilla// nsXULWindow#define NS_XULWINDOW_IMPL_CID \{ /* 8eaec2f3-ed02-4be2-8e0f-342798477298 */ \ 0x8eaec2f3, \ 0xed02, \ 0x4be2, \ { 0x8e, 0x0f, 0x34, 0x27, 0x98, 0x47, 0x72, 0x98 } \}classnsContentShellInfo;classnsXULWindow:publicnsIBaseWindow,publicnsIInterfaceRequestor,publicnsIXULWindow,publicnsSupportsWeakReference{friendclassnsChromeTreeOwner;friendclassnsContentTreeOwner;public:NS_DECL_THREADSAFE_ISUPPORTSNS_DECL_NSIINTERFACEREQUESTORNS_DECL_NSIXULWINDOWNS_DECL_NSIBASEWINDOWNS_DECLARE_STATIC_IID_ACCESSOR(NS_XULWINDOW_IMPL_CID)voidLockUntilChromeLoad(){mLockedUntilChromeLoad=true;}boolIsLocked()const{returnmLockedUntilChromeLoad;}voidIgnoreXULSizeMode(boolaEnable){mIgnoreXULSizeMode=aEnable;}voidWasRegistered(){mRegistered=true;}protected:enumpersistentAttributes{PAD_MISC=0x1,PAD_POSITION=0x2,PAD_SIZE=0x4};explicitnsXULWindow(uint32_taChromeFlags);virtual~nsXULWindow();NS_IMETHODEnsureChromeTreeOwner();NS_IMETHODEnsureContentTreeOwner();NS_IMETHODEnsurePrimaryContentTreeOwner();NS_IMETHODEnsurePrompter();NS_IMETHODEnsureAuthPrompter();voidOnChromeLoaded();voidStaggerPosition(int32_t&aRequestedX,int32_t&aRequestedY,int32_taSpecWidth,int32_taSpecHeight);boolLoadPositionFromXUL(int32_taSpecWidth,int32_taSpecHeight);boolLoadSizeFromXUL(int32_t&aSpecWidth,int32_t&aSpecHeight);voidSetSpecifiedSize(int32_taSpecWidth,int32_taSpecHeight);boolLoadMiscPersistentAttributesFromXUL();voidSyncAttributesToWidget();NS_IMETHODSavePersistentAttributes();NS_IMETHODGetWindowDOMWindow(mozIDOMWindowProxy**aDOMWindow);mozilla::dom::Element*GetWindowDOMElement()const;// See nsIDocShellTreeOwner for docs on next two methodsnsresultContentShellAdded(nsIDocShellTreeItem*aContentShell,boolaPrimary,boolaTargetable,constnsAString&aID);nsresultContentShellRemoved(nsIDocShellTreeItem*aContentShell);NS_IMETHODGetPrimaryContentSize(int32_t*aWidth,int32_t*aHeight);NS_IMETHODSetPrimaryContentSize(int32_taWidth,int32_taHeight);nsresultGetRootShellSize(int32_t*aWidth,int32_t*aHeight);nsresultSetRootShellSize(int32_taWidth,int32_taHeight);NS_IMETHODSizeShellTo(nsIDocShellTreeItem*aShellItem,int32_taCX,int32_taCY);NS_IMETHODExitModalLoop(nsresultaStatus);NS_IMETHODCreateNewChromeWindow(int32_taChromeFlags,nsITabParent*aOpeningTab,mozIDOMWindowProxy*aOpenerWindow,nsIXULWindow**_retval);NS_IMETHODCreateNewContentWindow(int32_taChromeFlags,nsITabParent*aOpeningTab,mozIDOMWindowProxy*aOpenerWindow,nsIXULWindow**_retval);NS_IMETHODGetHasPrimaryContent(bool*aResult);voidEnableParent(boolaEnable);boolConstrainToZLevel(boolaImmediate,nsWindowZ*aPlacement,nsIWidget*aReqBelow,nsIWidget**aActualBelow);voidPlaceWindowLayersBehind(uint32_taLowLevel,uint32_taHighLevel,nsIXULWindow*aBehind);voidSetContentScrollbarVisibility(boolaVisible);boolGetContentScrollbarVisibility();voidPersistentAttributesDirty(uint32_taDirtyFlags);nsChromeTreeOwner*mChromeTreeOwner;nsContentTreeOwner*mContentTreeOwner;nsContentTreeOwner*mPrimaryContentTreeOwner;nsCOMPtr<nsIWidget>mWindow;nsCOMPtr<nsIDocShell>mDocShell;nsCOMPtr<nsPIDOMWindowOuter>mDOMWindow;nsCOMPtr<nsIWeakReference>mParentWindow;nsCOMPtr<nsIPrompt>mPrompter;nsCOMPtr<nsIAuthPrompt>mAuthPrompter;nsCOMPtr<nsIXULBrowserWindow>mXULBrowserWindow;nsCOMPtr<nsIDocShellTreeItem>mPrimaryContentShell;nsTArray<nsContentShellInfo*>mContentShells;// array of doc shells by idnsresultmModalStatus;boolmContinueModalLoop;boolmDebuting;// being made visible right nowboolmChromeLoaded;// True when chrome has loadedboolmShowAfterLoad;boolmIntrinsicallySized;boolmCenterAfterLoad;boolmIsHiddenWindow;boolmLockedUntilChromeLoad;boolmIgnoreXULSize;boolmIgnoreXULPosition;boolmChromeFlagsFrozen;boolmIgnoreXULSizeMode;// mDestroying is used to prevent reentry into into Destroy(), which can// otherwise happen due to script running as we tear down various things.boolmDestroying;boolmRegistered;uint32_tmPersistentAttributesDirty;// persistentAttributesuint32_tmPersistentAttributesMask;uint32_tmChromeFlags;nsStringmTitle;nsIntRectmOpenerScreenRect;// the screen rect of the openernsCOMArray<nsIWeakReference>mTargetableShells;// targetable shells onlynsCOMPtr<nsITabParent>mPrimaryTabParent;private:nsresultGetPrimaryTabParentSize(int32_t*aWidth,int32_t*aHeight);nsresultGetPrimaryContentShellSize(int32_t*aWidth,int32_t*aHeight);nsresultSetPrimaryTabParentSize(int32_taWidth,int32_taHeight);};NS_DEFINE_STATIC_IID_ACCESSOR(nsXULWindow,NS_XULWINDOW_IMPL_CID)// nsContentShellInfo// Used to map shell IDs to nsIDocShellTreeItems.classnsContentShellInfo{public:nsContentShellInfo(constnsAString&aID,nsIWeakReference*aContentShell);~nsContentShellInfo();public:nsStringid;// The identifier of the content shellnsWeakPtrchild;// content shell (weak reference to nsIDocShellTreeItem)};#endif /* nsXULWindow_h__ */