2015-05-03 19:32:37 +00: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 11:12:37 +00: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 08:21:20 +00:00
|
|
|
|
|
|
|
#ifndef nsWindowRoot_h__
|
|
|
|
#define nsWindowRoot_h__
|
|
|
|
|
|
|
|
class nsIDOMEvent;
|
2014-10-17 23:05:16 +00:00
|
|
|
class nsIGlobalObject;
|
2000-11-04 08:21:20 +00:00
|
|
|
|
2013-06-05 16:15:48 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-03-17 06:56:53 +00:00
|
|
|
#include "mozilla/EventListenerManager.h"
|
2007-05-14 09:11:38 +00:00
|
|
|
#include "nsIDOMEventTarget.h"
|
2016-06-23 14:14:19 +00:00
|
|
|
#include "nsIWeakReferenceUtils.h"
|
2000-11-04 08:21:20 +00:00
|
|
|
#include "nsPIWindowRoot.h"
|
2007-01-04 22:31:26 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2014-12-09 15:48:27 +00:00
|
|
|
#include "nsTHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
2000-11-04 08:21:20 +00:00
|
|
|
|
2015-03-21 18:35:18 +00:00
|
|
|
class nsWindowRoot final : public nsPIWindowRoot
|
2000-11-04 08:21:20 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-01-30 17:05:36 +00: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 17:42:36 +00:00
|
|
|
|
2007-01-04 22:31:26 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
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 17:42:36 +00:00
|
|
|
NS_DECL_NSIDOMEVENTTARGET
|
2013-10-22 23:32:04 +00:00
|
|
|
|
2014-03-17 06:56:53 +00:00
|
|
|
virtual mozilla::EventListenerManager*
|
2015-03-21 16:28:04 +00:00
|
|
|
GetExistingListenerManager() const override;
|
2014-03-17 06:56:53 +00:00
|
|
|
virtual mozilla::EventListenerManager*
|
2015-03-21 16:28:04 +00:00
|
|
|
GetOrCreateListenerManager() override;
|
2013-10-22 23:32:04 +00:00
|
|
|
|
2013-04-16 21:16:08 +00:00
|
|
|
using mozilla::dom::EventTarget::RemoveEventListener;
|
|
|
|
virtual void AddEventListener(const nsAString& aType,
|
2013-09-24 00:25:17 +00:00
|
|
|
mozilla::dom::EventListener* aListener,
|
2016-04-26 08:23:17 +00:00
|
|
|
const mozilla::dom::AddEventListenerOptionsOrBoolean& aOptions,
|
2013-04-16 21:16:08 +00:00
|
|
|
const mozilla::dom::Nullable<bool>& aWantsUntrusted,
|
2015-03-21 16:28:04 +00:00
|
|
|
mozilla::ErrorResult& aRv) override;
|
2007-02-15 23:04:33 +00:00
|
|
|
|
2000-11-04 08:21:20 +00:00
|
|
|
// nsPIWindowRoot
|
|
|
|
|
2016-01-30 17:05:36 +00:00
|
|
|
virtual nsPIDOMWindowOuter* GetWindow() override;
|
2010-02-20 16:07:03 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult GetControllers(nsIControllers** aResult) override;
|
2010-02-20 16:07:03 +00:00
|
|
|
virtual nsresult GetControllerForCommand(const char * aCommand,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsIController** _retval) override;
|
2010-02-20 16:07:03 +00:00
|
|
|
|
2014-12-09 15:48:27 +00:00
|
|
|
virtual void GetEnabledDisabledCommands(nsTArray<nsCString>& aEnabledCommands,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsTArray<nsCString>& aDisabledCommands) override;
|
2014-12-09 15:48:27 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIDOMNode* GetPopupNode() override;
|
|
|
|
virtual void SetPopupNode(nsIDOMNode* aNode) override;
|
2007-07-06 13:47:50 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void SetParentTarget(mozilla::dom::EventTarget* aTarget) override
|
2010-02-20 17:05:20 +00:00
|
|
|
{
|
|
|
|
mParent = aTarget;
|
|
|
|
}
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual mozilla::dom::EventTarget* GetParentTarget() override { return mParent; }
|
2016-01-30 17:05:36 +00:00
|
|
|
virtual nsPIDOMWindowOuter* GetOwnerGlobalForBindings() override;
|
2015-05-12 19:56:39 +00:00
|
|
|
virtual nsIGlobalObject* GetOwnerGlobal() const override;
|
2010-02-20 17:05:20 +00:00
|
|
|
|
2014-10-17 23:05:16 +00:00
|
|
|
nsIGlobalObject* GetParentObject();
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2014-10-07 09:44:48 +00:00
|
|
|
|
2013-01-29 13:44:01 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsWindowRoot,
|
|
|
|
nsIDOMEventTarget)
|
2007-01-04 22:31:26 +00:00
|
|
|
|
2015-06-08 17:24:56 +00:00
|
|
|
virtual void AddBrowser(mozilla::dom::TabParent* aBrowser) override;
|
|
|
|
virtual void RemoveBrowser(mozilla::dom::TabParent* aBrowser) override;
|
|
|
|
virtual void EnumerateBrowsers(BrowserEnumerator aEnumFunc, void *aArg) override;
|
2015-06-08 05:39:39 +00:00
|
|
|
|
2016-06-09 11:59:31 +00:00
|
|
|
virtual bool ShowAccelerators() override
|
|
|
|
{
|
|
|
|
return mShowAccelerators;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool ShowFocusRings() override
|
|
|
|
{
|
|
|
|
return mShowFocusRings;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void SetShowAccelerators(bool aEnable) override
|
|
|
|
{
|
|
|
|
mShowAccelerators = aEnable;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void SetShowFocusRings(bool aEnable) override
|
|
|
|
{
|
|
|
|
mShowFocusRings = aEnable;
|
|
|
|
}
|
|
|
|
|
2000-11-04 08:21:20 +00:00
|
|
|
protected:
|
2014-06-23 19:56:07 +00:00
|
|
|
virtual ~nsWindowRoot();
|
|
|
|
|
2014-12-09 15:48:27 +00:00
|
|
|
void GetEnabledDisabledCommandsForControllers(nsIControllers* aControllers,
|
|
|
|
nsTHashtable<nsCharPtrHashKey>& aCommandsHandled,
|
|
|
|
nsTArray<nsCString>& aEnabledCommands,
|
|
|
|
nsTArray<nsCString>& aDisabledCommands);
|
|
|
|
|
2000-11-04 08:21:20 +00:00
|
|
|
// Members
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> mWindow;
|
2014-03-17 06:56:53 +00:00
|
|
|
// We own the manager, which owns event listeners attached to us.
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<mozilla::EventListenerManager> mListenerManager; // [Strong]
|
2016-06-23 14:14:19 +00:00
|
|
|
nsWeakPtr mPopupNode;
|
2010-02-20 17:05:20 +00:00
|
|
|
|
2016-06-09 11:59:31 +00:00
|
|
|
// True if focus rings and accelerators are enabled for this
|
|
|
|
// window hierarchy.
|
|
|
|
bool mShowAccelerators;
|
|
|
|
bool mShowFocusRings;
|
|
|
|
|
2013-04-06 00:44:15 +00:00
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> mParent;
|
2015-06-08 05:39:39 +00:00
|
|
|
|
|
|
|
// The TabParents that are currently registered with this top-level window.
|
|
|
|
typedef nsTHashtable<nsRefPtrHashKey<nsIWeakReference>> WeakBrowserTable;
|
|
|
|
WeakBrowserTable mWeakBrowsers;
|
2000-11-04 08:21:20 +00:00
|
|
|
};
|
|
|
|
|
2013-04-06 00:44:15 +00:00
|
|
|
extern already_AddRefed<mozilla::dom::EventTarget>
|
2016-01-30 17:05:36 +00:00
|
|
|
NS_NewWindowRoot(nsPIDOMWindowOuter* aWindow);
|
2000-11-04 08:21:20 +00:00
|
|
|
|
|
|
|
#endif
|