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/. */
|
1998-12-03 01:35:53 +00:00
|
|
|
|
|
|
|
#ifndef nsWebShellWindow_h__
|
|
|
|
#define nsWebShellWindow_h__
|
|
|
|
|
Rollup of bug 645263 and bug 646259: Switch to mozilla:: sync primitives. r=cjones,dbaron,doublec,ehsan src=bsmedberg
Bug 645263, part 0: Count sync primitive ctor/dtors. r=dbaron
Bug 645263, part 1: Migrate content/media to mozilla:: sync primitives. r=doublec
Bug 645263, part 2: Migrate modules/plugin to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 3: Migrate nsComponentManagerImpl to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 4: Migrate everything else to mozilla:: sync primitives. r=dbaron
Bug 645263, part 5: Remove nsAutoLock.*. sr=bsmedberg
Bug 645263, part 6: Make editor test be nicer to deadlock detector. r=ehsan
Bug 645263, part 7: Disable tracemalloc backtraces for xpcshell tests. r=dbaron
Bug 646259: Fix nsCacheService to use a CondVar for notifying. r=cjones
2011-04-01 04:29:02 +00:00
|
|
|
#include "mozilla/Mutex.h"
|
2000-12-14 23:27:59 +00:00
|
|
|
#include "nsIWebProgressListener.h"
|
2000-02-23 20:07:31 +00:00
|
|
|
#include "nsITimer.h"
|
1999-01-30 00:39:25 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2000-01-26 02:21:42 +00:00
|
|
|
#include "nsXULWindow.h"
|
2012-08-15 18:52:42 +00:00
|
|
|
#include "nsIWidgetListener.h"
|
2019-04-09 20:59:37 +00:00
|
|
|
#include "nsIRemoteTab.h"
|
1998-12-03 01:35:53 +00:00
|
|
|
|
|
|
|
/* Forward declarations.... */
|
1999-06-23 03:29:44 +00:00
|
|
|
class nsIURI;
|
1998-12-03 01:35:53 +00:00
|
|
|
|
2013-10-22 13:27:34 +00:00
|
|
|
struct nsWidgetInitData;
|
|
|
|
|
2012-07-23 14:40:36 +00:00
|
|
|
namespace mozilla {
|
2019-04-13 01:05:21 +00:00
|
|
|
class PresShell;
|
2012-07-23 14:40:36 +00:00
|
|
|
class WebShellWindowTimerCallback;
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsWebShellWindow final : public nsXULWindow,
|
2018-01-10 11:04:43 +00:00
|
|
|
public nsIWebProgressListener {
|
1998-12-03 01:35:53 +00:00
|
|
|
public:
|
2018-01-10 11:04:43 +00:00
|
|
|
// The implementation of non-refcounted nsIWidgetListener, which would hold a
|
|
|
|
// strong reference on stack before calling nsWebShellWindow's
|
|
|
|
// MOZ_CAN_RUN_SCRIPT methods.
|
|
|
|
class WidgetListenerDelegate : public nsIWidgetListener {
|
|
|
|
public:
|
|
|
|
explicit WidgetListenerDelegate(nsWebShellWindow* aWebShellWindow)
|
|
|
|
: mWebShellWindow(aWebShellWindow) {}
|
|
|
|
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual nsIXULWindow* GetXULWindow() override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
2019-04-13 01:05:21 +00:00
|
|
|
virtual mozilla::PresShell* GetPresShell() override;
|
2018-01-10 11:04:43 +00:00
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual bool WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth,
|
|
|
|
int32_t aHeight) override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual bool RequestWindowClose(nsIWidget* aWidget) override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual void SizeModeChanged(nsSizeMode sizeMode) override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual void UIResolutionChanged() override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual void FullscreenWillChange(bool aInFullscreen) override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual void FullscreenChanged(bool aInFullscreen) override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual void OcclusionStateChanged(bool aIsFullyOccluded) override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual void OSToolbarButtonPressed() override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
|
|
|
|
nsIWidget* aRequestBelow,
|
|
|
|
nsIWidget** aActualBelow) override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual void WindowActivated() override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
virtual void WindowDeactivated() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// The lifetime of WidgetListenerDelegate is bound to nsWebShellWindow so
|
|
|
|
// we just use a raw pointer here.
|
|
|
|
nsWebShellWindow* mWebShellWindow;
|
|
|
|
};
|
|
|
|
|
2014-09-02 22:24:24 +00:00
|
|
|
explicit nsWebShellWindow(uint32_t aChromeFlags);
|
1998-12-03 01:35:53 +00:00
|
|
|
|
1999-01-21 07:24:01 +00:00
|
|
|
// nsISupports interface...
|
2005-01-03 22:51:17 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
1998-12-03 01:35:53 +00:00
|
|
|
|
1999-01-21 07:24:01 +00:00
|
|
|
// nsWebShellWindow methods...
|
2009-09-29 02:20:46 +00:00
|
|
|
nsresult Initialize(nsIXULWindow* aParent, nsIXULWindow* aOpener,
|
2012-08-22 15:56:38 +00:00
|
|
|
nsIURI* aUrl, int32_t aInitialWidth,
|
|
|
|
int32_t aInitialHeight, bool aIsHiddenWindow,
|
2019-04-09 20:59:37 +00:00
|
|
|
nsIRemoteTab* aOpeningTab,
|
2016-10-07 18:59:59 +00:00
|
|
|
mozIDOMWindowProxy* aOpenerWIndow,
|
2005-02-19 22:42:01 +00:00
|
|
|
nsWidgetInitData& widgetInitData);
|
|
|
|
|
|
|
|
nsresult Toolbar();
|
1998-12-03 01:35:53 +00:00
|
|
|
|
2000-12-14 23:27:59 +00:00
|
|
|
// nsIWebProgressListener
|
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
1999-02-21 21:04:21 +00:00
|
|
|
|
2000-04-11 23:52:50 +00:00
|
|
|
// nsIBaseWindow
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD Destroy() override;
|
1999-08-22 23:52:07 +00:00
|
|
|
|
2018-01-10 11:04:43 +00:00
|
|
|
// nsIWidgetListener methods for WidgetListenerDelegate.
|
|
|
|
nsIXULWindow* GetXULWindow() { return this; }
|
2019-04-13 01:05:21 +00:00
|
|
|
mozilla::PresShell* GetPresShell();
|
2018-01-10 11:04:43 +00:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY);
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight);
|
|
|
|
MOZ_CAN_RUN_SCRIPT bool RequestWindowClose(nsIWidget* aWidget);
|
|
|
|
MOZ_CAN_RUN_SCRIPT void SizeModeChanged(nsSizeMode aSizeMode);
|
|
|
|
MOZ_CAN_RUN_SCRIPT void UIResolutionChanged();
|
|
|
|
MOZ_CAN_RUN_SCRIPT void FullscreenWillChange(bool aInFullscreen);
|
|
|
|
MOZ_CAN_RUN_SCRIPT void FullscreenChanged(bool aInFullscreen);
|
|
|
|
MOZ_CAN_RUN_SCRIPT void OcclusionStateChanged(bool aIsFullyOccluded);
|
|
|
|
MOZ_CAN_RUN_SCRIPT void OSToolbarButtonPressed();
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
|
|
|
|
nsIWidget* aRequestBelow, nsIWidget** aActualBelow);
|
|
|
|
MOZ_CAN_RUN_SCRIPT void WindowActivated();
|
|
|
|
MOZ_CAN_RUN_SCRIPT void WindowDeactivated();
|
2012-08-15 18:52:42 +00:00
|
|
|
|
1998-12-03 01:35:53 +00:00
|
|
|
protected:
|
2012-07-23 14:40:36 +00:00
|
|
|
friend class mozilla::WebShellWindowTimerCallback;
|
2017-07-06 12:00:35 +00:00
|
|
|
|
2005-02-19 22:42:01 +00:00
|
|
|
virtual ~nsWebShellWindow();
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool ExecuteCloseHandler();
|
2012-08-22 15:56:38 +00:00
|
|
|
void ConstrainToOpenerScreen(int32_t* aX, int32_t* aY);
|
1999-02-15 05:38:15 +00:00
|
|
|
|
2000-02-23 20:07:31 +00:00
|
|
|
nsCOMPtr<nsITimer> mSPTimer;
|
Rollup of bug 645263 and bug 646259: Switch to mozilla:: sync primitives. r=cjones,dbaron,doublec,ehsan src=bsmedberg
Bug 645263, part 0: Count sync primitive ctor/dtors. r=dbaron
Bug 645263, part 1: Migrate content/media to mozilla:: sync primitives. r=doublec
Bug 645263, part 2: Migrate modules/plugin to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 3: Migrate nsComponentManagerImpl to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 4: Migrate everything else to mozilla:: sync primitives. r=dbaron
Bug 645263, part 5: Remove nsAutoLock.*. sr=bsmedberg
Bug 645263, part 6: Make editor test be nicer to deadlock detector. r=ehsan
Bug 645263, part 7: Disable tracemalloc backtraces for xpcshell tests. r=dbaron
Bug 646259: Fix nsCacheService to use a CondVar for notifying. r=cjones
2011-04-01 04:29:02 +00:00
|
|
|
mozilla::Mutex mSPTimerLock;
|
2018-01-10 11:04:43 +00:00
|
|
|
WidgetListenerDelegate mWidgetListenerDelegate;
|
2000-02-23 20:07:31 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void SetPersistenceTimer(uint32_t aDirtyFlags);
|
2012-07-23 14:40:36 +00:00
|
|
|
void FirePersistenceTimer();
|
1998-12-03 01:35:53 +00:00
|
|
|
};
|
|
|
|
|
1999-02-04 11:00:41 +00:00
|
|
|
#endif /* nsWebShellWindow_h__ */
|