2015-02-05 02:15:12 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* 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/. */
|
1999-10-22 06:35:18 +04:00
|
|
|
|
|
|
|
#ifndef nsWebBrowser_h__
|
|
|
|
#define nsWebBrowser_h__
|
|
|
|
|
2000-03-11 04:16:24 +03:00
|
|
|
// Local Includes
|
|
|
|
#include "nsDocShellTreeOwner.h"
|
1999-10-26 06:26:57 +04:00
|
|
|
|
2000-03-11 04:16:24 +03:00
|
|
|
// Core Includes
|
|
|
|
#include "nsCOMPtr.h"
|
2017-10-02 17:58:52 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
1999-10-22 06:35:18 +04:00
|
|
|
|
2000-02-14 12:39:21 +03:00
|
|
|
// Interfaces needed
|
|
|
|
#include "nsIBaseWindow.h"
|
|
|
|
#include "nsIDocShell.h"
|
2000-03-11 04:16:24 +03:00
|
|
|
#include "nsIDocShellTreeItem.h"
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
2001-09-06 01:28:38 +04:00
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
2000-02-14 12:39:21 +03:00
|
|
|
#include "nsIWidget.h"
|
2001-02-01 00:03:40 +03:00
|
|
|
#include "nsIWebProgress.h"
|
2000-02-14 12:39:21 +03:00
|
|
|
#include "nsIWebBrowser.h"
|
2000-02-24 06:51:35 +03:00
|
|
|
#include "nsIWebNavigation.h"
|
2000-11-30 03:43:42 +03:00
|
|
|
#include "nsIWebBrowserPersist.h"
|
2001-04-17 00:34:33 +04:00
|
|
|
#include "nsIWindowWatcher.h"
|
2002-01-01 15:58:53 +03:00
|
|
|
#include "nsIPrintSettings.h"
|
2012-08-15 22:52:42 +04:00
|
|
|
#include "nsIWidgetListener.h"
|
2000-02-14 12:39:21 +03:00
|
|
|
|
2016-09-05 15:43:51 +03:00
|
|
|
#include "mozilla/BasePrincipal.h"
|
2009-02-25 18:25:08 +03:00
|
|
|
#include "nsTArray.h"
|
2018-10-31 23:39:03 +03:00
|
|
|
#include "nsIWeakReferenceUtils.h"
|
2001-02-01 00:03:40 +03:00
|
|
|
|
1999-10-27 06:45:49 +04:00
|
|
|
class nsWebBrowserInitInfo {
|
|
|
|
public:
|
2015-05-11 22:35:13 +03:00
|
|
|
// nsIBaseWindow Stuff
|
|
|
|
int32_t x;
|
|
|
|
int32_t y;
|
|
|
|
int32_t cx;
|
|
|
|
int32_t cy;
|
|
|
|
bool visible;
|
|
|
|
nsString name;
|
1999-10-27 06:45:49 +04:00
|
|
|
};
|
|
|
|
|
2014-12-16 20:18:01 +03:00
|
|
|
// {cda5863a-aa9c-411e-be49-ea0d525ab4b5} -
|
2005-03-06 23:53:33 +03:00
|
|
|
#define NS_WEBBROWSER_CID \
|
2015-05-11 22:35:13 +03:00
|
|
|
{ \
|
|
|
|
0xcda5863a, 0xaa9c, 0x411e, { \
|
|
|
|
0xbe, 0x49, 0xea, 0x0d, 0x52, 0x5a, 0xb4, 0xb5 \
|
|
|
|
} \
|
|
|
|
}
|
2005-03-06 23:53:33 +03:00
|
|
|
|
2018-11-27 12:59:44 +03:00
|
|
|
class mozIDOMWindowProxy;
|
2020-11-23 19:21:38 +03:00
|
|
|
class nsDocShell;
|
2005-03-06 23:53:33 +03:00
|
|
|
|
2019-08-08 19:07:12 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class WindowGlobalChild;
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsWebBrowser final : public nsIWebBrowser,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsIWebNavigation,
|
|
|
|
public nsIDocShellTreeItem,
|
|
|
|
public nsIBaseWindow,
|
|
|
|
public nsIInterfaceRequestor,
|
|
|
|
public nsIWebBrowserPersist,
|
|
|
|
public nsIWebProgressListener,
|
|
|
|
public nsSupportsWeakReference {
|
2015-02-05 02:15:12 +03:00
|
|
|
friend class nsDocShellTreeOwner;
|
2015-05-11 22:35:13 +03:00
|
|
|
|
1999-10-22 06:35:18 +04: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 nsWebBrowser's
|
|
|
|
// MOZ_CAN_RUN_SCRIPT methods.
|
|
|
|
class WidgetListenerDelegate : public nsIWidgetListener {
|
|
|
|
public:
|
|
|
|
explicit WidgetListenerDelegate(nsWebBrowser* aWebBrowser)
|
|
|
|
: mWebBrowser(aWebBrowser) {}
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual void WindowActivated() override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual void WindowDeactivated() override;
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual bool PaintWindow(
|
|
|
|
nsIWidget* aWidget, mozilla::LayoutDeviceIntRegion aRegion) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// The lifetime of WidgetListenerDelegate is bound to nsWebBrowser so we
|
|
|
|
// just use raw pointer here.
|
|
|
|
nsWebBrowser* mWebBrowser;
|
|
|
|
};
|
|
|
|
|
2017-10-02 17:58:52 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWebBrowser, nsIWebBrowser)
|
2015-02-05 02:15:12 +03:00
|
|
|
|
|
|
|
NS_DECL_NSIBASEWINDOW
|
|
|
|
NS_DECL_NSIDOCSHELLTREEITEM
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
|
|
NS_DECL_NSIWEBBROWSER
|
|
|
|
NS_DECL_NSIWEBNAVIGATION
|
|
|
|
NS_DECL_NSIWEBBROWSERPERSIST
|
|
|
|
NS_DECL_NSICANCELABLE
|
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
2001-03-27 16:04:30 +04:00
|
|
|
|
2018-08-03 22:21:03 +03:00
|
|
|
void SetAllowDNSPrefetch(bool aAllowPrefetch);
|
2020-11-16 22:16:20 +03:00
|
|
|
void FocusActivate(uint64_t aActionId);
|
|
|
|
void FocusDeactivate(uint64_t aActionId);
|
2020-03-23 16:28:09 +03:00
|
|
|
void SetWillChangeProcess();
|
2018-08-03 22:21:03 +03:00
|
|
|
|
2018-11-27 12:59:44 +03:00
|
|
|
static already_AddRefed<nsWebBrowser> Create(
|
|
|
|
nsIWebBrowserChrome* aContainerWindow, nsIWidget* aParentWidget,
|
2019-04-01 13:59:40 +03:00
|
|
|
mozilla::dom::BrowsingContext* aBrowsingContext,
|
2020-05-08 06:28:44 +03:00
|
|
|
mozilla::dom::WindowGlobalChild* aInitialWindowChild);
|
2018-11-27 12:59:44 +03:00
|
|
|
|
1999-10-22 06:35:18 +04:00
|
|
|
protected:
|
2015-02-05 02:15:12 +03:00
|
|
|
virtual ~nsWebBrowser();
|
2020-07-16 23:41:12 +03:00
|
|
|
void InternalDestroy();
|
2015-02-05 02:15:12 +03:00
|
|
|
|
2020-07-16 23:41:37 +03:00
|
|
|
void SetDocShell(nsDocShell* aDocShell);
|
2020-07-16 23:41:27 +03:00
|
|
|
void EnsureDocShellTreeOwner();
|
2015-02-05 02:15:12 +03:00
|
|
|
|
2018-11-27 12:59:44 +03:00
|
|
|
nsIWidget* EnsureWidget();
|
|
|
|
|
2018-01-10 14:04:43 +03:00
|
|
|
// nsIWidgetListener methods for WidgetListenerDelegate.
|
|
|
|
MOZ_CAN_RUN_SCRIPT void WindowActivated();
|
|
|
|
MOZ_CAN_RUN_SCRIPT void WindowDeactivated();
|
|
|
|
MOZ_CAN_RUN_SCRIPT bool PaintWindow(nsIWidget* aWidget,
|
|
|
|
mozilla::LayoutDeviceIntRegion aRegion);
|
1999-10-26 06:26:57 +04:00
|
|
|
|
2018-11-27 12:59:44 +03:00
|
|
|
explicit nsWebBrowser(int aItemType);
|
|
|
|
|
1999-10-22 06:35:18 +04:00
|
|
|
protected:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsDocShellTreeOwner> mDocShellTreeOwner;
|
2020-07-16 23:41:37 +03:00
|
|
|
RefPtr<nsDocShell> mDocShell;
|
2017-01-12 19:38:48 +03:00
|
|
|
mozilla::OriginAttributes mOriginAttributes;
|
2015-05-11 22:35:13 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIWidget> mInternalWidget;
|
2015-02-05 02:15:12 +03:00
|
|
|
nsCOMPtr<nsIWindowWatcher> mWWatch;
|
2018-11-09 00:58:58 +03:00
|
|
|
const uint32_t mContentType;
|
2015-05-11 22:35:13 +03:00
|
|
|
bool mShouldEnableHistory;
|
2020-03-23 16:28:09 +03:00
|
|
|
bool mWillChangeProcess;
|
2015-05-11 22:35:13 +03:00
|
|
|
nativeWindow mParentNativeWindow;
|
|
|
|
nsIWebProgressListener* mProgressListener;
|
2015-02-05 02:15:12 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
|
|
|
|
2018-01-10 14:04:43 +03:00
|
|
|
WidgetListenerDelegate mWidgetListenerDelegate;
|
|
|
|
|
2015-02-05 02:15:12 +03:00
|
|
|
// cached background color
|
2015-05-11 22:35:13 +03:00
|
|
|
nscolor mBackgroundColor;
|
2015-02-05 02:15:12 +03:00
|
|
|
|
|
|
|
// persistence object
|
|
|
|
nsCOMPtr<nsIWebBrowserPersist> mPersist;
|
2015-05-11 22:35:13 +03:00
|
|
|
uint32_t mPersistCurrentState;
|
|
|
|
nsresult mPersistResult;
|
|
|
|
uint32_t mPersistFlags;
|
2015-02-05 02:15:12 +03:00
|
|
|
|
2015-05-11 22:35:13 +03:00
|
|
|
// Weak Reference interfaces...
|
|
|
|
nsIWidget* mParentWidget;
|
1999-10-22 06:35:18 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsWebBrowser_h__ */
|