2015-05-03 22:32:37 +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/. */
|
2000-11-04 11:21:20 +03:00
|
|
|
|
|
|
|
#ifndef nsWindowRoot_h__
|
|
|
|
#define nsWindowRoot_h__
|
|
|
|
|
2014-10-18 03:05:16 +04:00
|
|
|
class nsIGlobalObject;
|
2000-11-04 11:21:20 +03:00
|
|
|
|
2013-06-05 20:15:48 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-03-17 10:56:53 +04:00
|
|
|
#include "mozilla/EventListenerManager.h"
|
2016-06-23 17:14:19 +03:00
|
|
|
#include "nsIWeakReferenceUtils.h"
|
2000-11-04 11:21:20 +03:00
|
|
|
#include "nsPIWindowRoot.h"
|
2007-01-05 01:31:26 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2014-12-09 18:48:27 +03:00
|
|
|
#include "nsTHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
2000-11-04 11:21:20 +03:00
|
|
|
|
2015-03-21 21:35:18 +03:00
|
|
|
class nsWindowRoot final : public nsPIWindowRoot {
|
2000-11-04 11:21:20 +03:00
|
|
|
public:
|
2016-01-30 20:05:36 +03:00
|
|
|
explicit nsWindowRoot(nsPIDOMWindowOuter* aWindow);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
|
2007-01-05 01:31:26 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2013-10-23 03:32:04 +04:00
|
|
|
|
2020-05-15 22:04:42 +03:00
|
|
|
mozilla::EventListenerManager* GetExistingListenerManager() const override;
|
|
|
|
mozilla::EventListenerManager* GetOrCreateListenerManager() override;
|
2013-10-23 03:32:04 +04:00
|
|
|
|
2018-04-05 20:42:42 +03:00
|
|
|
bool ComputeDefaultWantsUntrusted(mozilla::ErrorResult& aRv) final;
|
2018-04-05 20:42:41 +03:00
|
|
|
|
|
|
|
bool DispatchEvent(mozilla::dom::Event& aEvent,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aRv) override;
|
2018-04-05 20:42:41 +03:00
|
|
|
|
|
|
|
void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override;
|
2007-02-16 02:04:33 +03:00
|
|
|
|
2018-04-05 20:42:41 +03:00
|
|
|
nsresult PostHandleEvent(mozilla::EventChainPostVisitor& aVisitor) override;
|
|
|
|
|
2000-11-04 11:21:20 +03:00
|
|
|
// nsPIWindowRoot
|
|
|
|
|
2020-05-15 22:04:42 +03:00
|
|
|
nsPIDOMWindowOuter* GetWindow() override;
|
2010-02-20 19:07:03 +03:00
|
|
|
|
2020-05-15 22:04:42 +03:00
|
|
|
nsresult GetControllers(bool aForVisibleWindow,
|
|
|
|
nsIControllers** aResult) override;
|
|
|
|
nsresult GetControllerForCommand(const char* aCommand, bool aForVisibleWindow,
|
|
|
|
nsIController** _retval) override;
|
2010-02-20 19:07:03 +03:00
|
|
|
|
2020-05-15 22:04:42 +03:00
|
|
|
void GetEnabledDisabledCommands(
|
2014-12-09 18:48:27 +03:00
|
|
|
nsTArray<nsCString>& aEnabledCommands,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsTArray<nsCString>& aDisabledCommands) override;
|
2014-12-09 18:48:27 +03:00
|
|
|
|
2020-05-15 22:04:42 +03:00
|
|
|
already_AddRefed<nsINode> GetPopupNode() override;
|
|
|
|
void SetPopupNode(nsINode* aNode) override;
|
2007-07-06 17:47:50 +04:00
|
|
|
|
2020-05-15 22:04:42 +03:00
|
|
|
void SetParentTarget(mozilla::dom::EventTarget* aTarget) override {
|
2010-02-20 20:05:20 +03:00
|
|
|
mParent = aTarget;
|
|
|
|
}
|
2020-05-15 22:04:42 +03:00
|
|
|
mozilla::dom::EventTarget* GetParentTarget() override { return mParent; }
|
|
|
|
nsPIDOMWindowOuter* GetOwnerGlobalForBindingsInternal() override;
|
|
|
|
nsIGlobalObject* GetOwnerGlobal() const override;
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2014-10-18 03:05:16 +04:00
|
|
|
nsIGlobalObject* GetParentObject();
|
|
|
|
|
2020-05-15 22:04:42 +03:00
|
|
|
JSObject* WrapObject(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
|
2014-10-07 13:44:48 +04:00
|
|
|
|
2018-04-20 07:49:30 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsWindowRoot)
|
2007-01-05 01:31:26 +03:00
|
|
|
|
2020-05-15 22:04:42 +03:00
|
|
|
void AddBrowser(nsIRemoteTab* aBrowser) override;
|
|
|
|
void RemoveBrowser(nsIRemoteTab* aBrowser) override;
|
|
|
|
void EnumerateBrowsers(BrowserEnumerator aEnumFunc, void* aArg) override;
|
2015-06-08 08:39:39 +03:00
|
|
|
|
2020-05-15 22:04:42 +03:00
|
|
|
bool ShowFocusRings() override { return mShowFocusRings; }
|
2016-06-09 14:59:31 +03:00
|
|
|
|
2020-05-15 22:04:42 +03:00
|
|
|
void SetShowFocusRings(bool aEnable) override { mShowFocusRings = aEnable; }
|
2016-06-09 14:59:31 +03:00
|
|
|
|
2000-11-04 11:21:20 +03:00
|
|
|
protected:
|
2014-06-23 23:56:07 +04:00
|
|
|
virtual ~nsWindowRoot();
|
|
|
|
|
2014-12-09 18:48:27 +03:00
|
|
|
void GetEnabledDisabledCommandsForControllers(
|
|
|
|
nsIControllers* aControllers,
|
2019-05-21 20:06:06 +03:00
|
|
|
nsTHashtable<nsCStringHashKey>& aCommandsHandled,
|
2014-12-09 18:48:27 +03:00
|
|
|
nsTArray<nsCString>& aEnabledCommands,
|
|
|
|
nsTArray<nsCString>& aDisabledCommands);
|
|
|
|
|
2000-11-04 11:21:20 +03:00
|
|
|
// Members
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> mWindow;
|
2014-03-17 10:56:53 +04:00
|
|
|
// We own the manager, which owns event listeners attached to us.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::EventListenerManager> mListenerManager; // [Strong]
|
2016-06-23 17:14:19 +03:00
|
|
|
nsWeakPtr mPopupNode;
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2019-06-03 18:29:06 +03:00
|
|
|
// True if focus rings are enabled for this window hierarchy.
|
2016-06-09 14:59:31 +03:00
|
|
|
bool mShowFocusRings;
|
|
|
|
|
2013-04-06 04:44:15 +04:00
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> mParent;
|
2015-06-08 08:39:39 +03:00
|
|
|
|
2019-04-10 00:38:15 +03:00
|
|
|
// The BrowserParents that are currently registered with this top-level
|
|
|
|
// window.
|
2015-06-08 08:39:39 +03:00
|
|
|
typedef nsTHashtable<nsRefPtrHashKey<nsIWeakReference>> WeakBrowserTable;
|
|
|
|
WeakBrowserTable mWeakBrowsers;
|
2000-11-04 11:21:20 +03:00
|
|
|
};
|
|
|
|
|
2013-04-06 04:44:15 +04:00
|
|
|
extern already_AddRefed<mozilla::dom::EventTarget> NS_NewWindowRoot(
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowOuter* aWindow);
|
2000-11-04 11:21:20 +03:00
|
|
|
|
|
|
|
#endif
|