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
|
|
|
|
2019-11-04 20:18:56 +03:00
|
|
|
#ifndef nsXULWindow_h__
|
|
|
|
#define nsXULWindow_h__
|
2000-01-22 06:15:41 +03:00
|
|
|
|
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"
|
2000-02-08 16:40:10 +03:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
2001-09-06 01:28:38 +04:00
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
2019-11-04 20:18:56 +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"
|
2013-09-24 14:04:14 +04:00
|
|
|
#include "nsIWidgetListener.h"
|
2019-04-09 23:59:37 +03:00
|
|
|
#include "nsIRemoteTab.h"
|
2000-01-26 00:59:31 +03:00
|
|
|
|
2019-05-03 02:01:57 +03:00
|
|
|
#ifndef MOZ_NEW_XULSTORE
|
|
|
|
# include "nsIXULStore.h"
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
2018-04-27 03:53:54 +03:00
|
|
|
class nsAtom;
|
2018-07-04 00:20:43 +03:00
|
|
|
class nsXULTooltipListener;
|
2019-11-04 19:52:24 +03:00
|
|
|
|
2019-11-04 20:18:56 +03:00
|
|
|
// nsXULWindow
|
2000-01-22 06:15:41 +03:00
|
|
|
|
2019-11-04 20:18:56 +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;
|
|
|
|
|
2019-11-04 20:18:56 +03:00
|
|
|
class nsXULWindow : public nsIBaseWindow,
|
|
|
|
public nsIInterfaceRequestor,
|
|
|
|
public nsIXULWindow,
|
|
|
|
public nsSupportsWeakReference {
|
|
|
|
friend class nsChromeTreeOwner;
|
|
|
|
friend class nsContentTreeOwner;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2000-01-22 06:15:41 +03:00
|
|
|
public:
|
2013-07-19 06:31:36 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2000-02-08 16:40:10 +03:00
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
2019-11-04 20:18:56 +03:00
|
|
|
NS_DECL_NSIXULWINDOW
|
2000-01-22 06:15:41 +03:00
|
|
|
NS_DECL_NSIBASEWINDOW
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-11-04 20:18:56 +03:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULWINDOW_IMPL_CID)
|
2018-11-30 13:46:48 +03:00
|
|
|
|
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; }
|
2018-11-30 13:46:48 +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
|
|
|
|
};
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-11-04 20:18:56 +03:00
|
|
|
explicit nsXULWindow(uint32_t aChromeFlags);
|
|
|
|
virtual ~nsXULWindow();
|
2019-11-04 19:52:24 +03:00
|
|
|
|
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();
|
2017-03-29 10:43:54 +03:00
|
|
|
NS_IMETHOD ForceRoundedDimensions();
|
|
|
|
NS_IMETHOD GetAvailScreenSize(int32_t* aAvailWidth, int32_t* aAvailHeight);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-03-15 13:19:50 +03:00
|
|
|
void ApplyChromeFlags();
|
2019-04-13 15:39:47 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY void SizeShell();
|
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);
|
2018-07-20 19:32:30 +03:00
|
|
|
bool UpdateWindowStateFromMiscXULAttributes();
|
2009-08-06 00:52:08 +04:00
|
|
|
void SyncAttributesToWidget();
|
2015-10-14 04:33:51 +03:00
|
|
|
NS_IMETHOD SavePersistentAttributes();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-07-04 00:20:43 +03:00
|
|
|
bool NeedsTooltipListener();
|
|
|
|
void AddTooltipSupport();
|
|
|
|
void RemoveTooltipSupport();
|
2018-11-30 13:46:48 +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;
|
2018-11-30 13:46: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, bool aPrimary);
|
|
|
|
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);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-07-06 15:00:35 +03:00
|
|
|
NS_IMETHOD SizeShellTo(nsIDocShellTreeItem* aShellItem, int32_t aCX,
|
2012-08-22 19:56:38 +04:00
|
|
|
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,
|
2019-04-09 23:59:37 +03:00
|
|
|
nsIRemoteTab* aOpeningTab,
|
2016-10-07 21:59:59 +03:00
|
|
|
mozIDOMWindowProxy* aOpenerWindow,
|
2019-11-04 20:18:56 +03:00
|
|
|
nsIXULWindow** _retval);
|
2017-04-17 01:52:02 +03:00
|
|
|
NS_IMETHOD CreateNewContentWindow(int32_t aChromeFlags,
|
2019-04-09 23:59:37 +03:00
|
|
|
nsIRemoteTab* aOpeningTab,
|
2017-04-17 01:52:02 +03:00
|
|
|
mozIDOMWindowProxy* aOpenerWindow,
|
2019-04-09 23:59:37 +03:00
|
|
|
uint64_t aNextRemoteTabId,
|
2019-11-04 20:18:56 +03:00
|
|
|
nsIXULWindow** _retval);
|
2016-07-14 23:31:41 +03:00
|
|
|
NS_IMETHOD GetHasPrimaryContent(bool* aResult);
|
2018-11-30 13:46:48 +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,
|
2019-11-04 20:18:56 +03: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);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-04-27 03:53:54 +03:00
|
|
|
void LoadPersistentWindowState();
|
|
|
|
nsresult GetPersistentValue(const nsAtom* aAttr, nsAString& aValue);
|
|
|
|
nsresult SetPersistentValue(const nsAtom* aAttr, const nsAString& aValue);
|
2018-11-30 13:46:48 +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;
|
2018-10-31 23:39:03 +03:00
|
|
|
nsWeakPtr 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;
|
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
|
2018-03-19 06:22:38 +03:00
|
|
|
bool mSizingShellFromXUL; // true when in SizeShell()
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mShowAfterLoad;
|
2017-07-06 15:00:35 +03:00
|
|
|
bool mIntrinsicallySized;
|
2011-09-29 10:19:26 +04:00
|
|
|
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;
|
2019-04-09 23:59:37 +03:00
|
|
|
uint64_t mNextRemoteTabId;
|
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
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-04-10 00:38:15 +03:00
|
|
|
nsCOMPtr<nsIRemoteTab> mPrimaryBrowserParent;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-07-14 23:31:41 +03:00
|
|
|
private:
|
2019-04-10 00:38:15 +03:00
|
|
|
// GetPrimaryBrowserParentSize is called from xpidl methods and we don't have
|
|
|
|
// a good way to annotate those with MOZ_CAN_RUN_SCRIPT yet. It takes no
|
2017-12-05 19:18:16 +03:00
|
|
|
// refcounted args other than "this", and the "this" uses seem ok.
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult
|
2019-04-09 23:59:37 +03:00
|
|
|
GetPrimaryRemoteTabSize(int32_t* aWidth, int32_t* aHeight);
|
2016-07-14 23:31:41 +03:00
|
|
|
nsresult GetPrimaryContentShellSize(int32_t* aWidth, int32_t* aHeight);
|
2019-04-09 23:59:37 +03:00
|
|
|
nsresult SetPrimaryRemoteTabSize(int32_t aWidth, int32_t aHeight);
|
2019-05-03 02:01:57 +03:00
|
|
|
#ifndef MOZ_NEW_XULSTORE
|
|
|
|
nsCOMPtr<nsIXULStore> mLocalStore;
|
|
|
|
#endif
|
2000-01-26 00:59:31 +03:00
|
|
|
};
|
|
|
|
|
2019-11-04 20:18:56 +03:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsXULWindow, NS_XULWINDOW_IMPL_CID)
|
|
|
|
#endif /* nsXULWindow_h__ */
|