2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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/. */
|
1998-12-03 04:35:53 +03: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 08:29:02 +04:00
|
|
|
#include "mozilla/Mutex.h"
|
2000-12-15 02:27:59 +03:00
|
|
|
#include "nsIWebProgressListener.h"
|
2000-02-23 23:07:31 +03:00
|
|
|
#include "nsITimer.h"
|
1999-01-30 03:39:25 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2000-01-26 05:21:42 +03:00
|
|
|
#include "nsXULWindow.h"
|
2012-08-15 22:52:42 +04:00
|
|
|
#include "nsIWidgetListener.h"
|
2014-06-06 06:51:14 +04:00
|
|
|
#include "nsITabParent.h"
|
1998-12-03 04:35:53 +03:00
|
|
|
|
|
|
|
/* Forward declarations.... */
|
1999-06-23 07:29:44 +04:00
|
|
|
class nsIURI;
|
1998-12-03 04:35:53 +03:00
|
|
|
|
2013-10-22 17:27:34 +04:00
|
|
|
struct nsWidgetInitData;
|
|
|
|
|
2012-07-23 18:40:36 +04:00
|
|
|
namespace mozilla {
|
|
|
|
class WebShellWindowTimerCallback;
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsWebShellWindow final : public nsXULWindow,
|
2018-01-10 14:04:43 +03:00
|
|
|
public nsIWebProgressListener {
|
1998-12-03 04:35:53 +03:00
|
|
|
public:
|
2018-01-10 14:04:43 +03: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
|
|
|
|
virtual nsIPresShell* GetPresShell() override;
|
|
|
|
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-03 02:24:24 +04:00
|
|
|
explicit nsWebShellWindow(uint32_t aChromeFlags);
|
1998-12-03 04:35:53 +03:00
|
|
|
|
1999-01-21 10:24:01 +03:00
|
|
|
// nsISupports interface...
|
2005-01-04 01:51:17 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
1998-12-03 04:35:53 +03:00
|
|
|
|
1999-01-21 10:24:01 +03:00
|
|
|
// nsWebShellWindow methods...
|
2009-09-29 06:20:46 +04:00
|
|
|
nsresult Initialize(nsIXULWindow* aParent, nsIXULWindow* aOpener,
|
2012-08-22 19:56:38 +04:00
|
|
|
nsIURI* aUrl, int32_t aInitialWidth,
|
|
|
|
int32_t aInitialHeight, bool aIsHiddenWindow,
|
2014-06-06 06:51:14 +04:00
|
|
|
nsITabParent* aOpeningTab,
|
2016-10-07 21:59:59 +03:00
|
|
|
mozIDOMWindowProxy* aOpenerWIndow,
|
2005-02-20 01:42:01 +03:00
|
|
|
nsWidgetInitData& widgetInitData);
|
|
|
|
|
|
|
|
nsresult Toolbar();
|
1998-12-03 04:35:53 +03:00
|
|
|
|
2000-12-15 02:27:59 +03:00
|
|
|
// nsIWebProgressListener
|
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
1999-02-22 00:04:21 +03:00
|
|
|
|
2000-04-12 03:52:50 +04:00
|
|
|
// nsIBaseWindow
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Destroy() override;
|
1999-08-23 03:52:07 +04:00
|
|
|
|
2018-01-10 14:04:43 +03:00
|
|
|
// nsIWidgetListener methods for WidgetListenerDelegate.
|
|
|
|
nsIXULWindow* GetXULWindow() { return this; }
|
|
|
|
nsIPresShell* GetPresShell();
|
|
|
|
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 22:52:42 +04:00
|
|
|
|
1998-12-03 04:35:53 +03:00
|
|
|
protected:
|
2012-07-23 18:40:36 +04:00
|
|
|
friend class mozilla::WebShellWindowTimerCallback;
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2005-02-20 01:42:01 +03:00
|
|
|
virtual ~nsWebShellWindow();
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ExecuteCloseHandler();
|
2012-08-22 19:56:38 +04:00
|
|
|
void ConstrainToOpenerScreen(int32_t* aX, int32_t* aY);
|
1999-02-15 08:38:15 +03:00
|
|
|
|
2000-02-23 23:07:31 +03: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 08:29:02 +04:00
|
|
|
mozilla::Mutex mSPTimerLock;
|
2018-01-10 14:04:43 +03:00
|
|
|
WidgetListenerDelegate mWidgetListenerDelegate;
|
2000-02-23 23:07:31 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetPersistenceTimer(uint32_t aDirtyFlags);
|
2012-07-23 18:40:36 +04:00
|
|
|
void FirePersistenceTimer();
|
1998-12-03 04:35:53 +03:00
|
|
|
};
|
|
|
|
|
1999-02-04 14:00:41 +03:00
|
|
|
#endif /* nsWebShellWindow_h__ */
|