mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
94617f91cf
Backed out changeset 499f6dffd9cb (bug 1434399) Backed out changeset 018290612415 (bug 1434399) Backed out changeset f4c3179f8e59 (bug 1434399) Backed out changeset f3ce2826b857 (bug 1434399) Backed out changeset 6d2391af01dd (bug 1434399) Backed out changeset dc98ed8c609a (bug 1434399) Backed out changeset 8eaa395d6200 (bug 1434399) Backed out changeset 19b18f4a53be (bug 1434399) Backed out changeset 8ff378a6e96a (bug 1434399) Backed out changeset 60fe73be1a26 (bug 1434399) Backed out changeset faefb2751fdc (bug 1434399) Backed out changeset 55cdf8b3a959 (bug 1434399) Backed out changeset b578cc8efb92 (bug 1434399) Backed out changeset 54cc4cb2fca1 (bug 1434399) Backed out changeset f5343ef34d6c (bug 1434399) Backed out changeset 8fb30e066cbd (bug 1434399) Backed out changeset 21341b656b0f (bug 1434399) Backed out changeset fab1f8b087a2 (bug 1434399) Backed out changeset 55250a54852a (bug 1434399)
127 lines
4.3 KiB
C++
127 lines
4.3 KiB
C++
/* -*- 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
|
|
* 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/. */
|
|
|
|
#ifndef nsWindowRoot_h__
|
|
#define nsWindowRoot_h__
|
|
|
|
class nsIDOMEvent;
|
|
class nsIGlobalObject;
|
|
|
|
#include "mozilla/Attributes.h"
|
|
#include "mozilla/EventListenerManager.h"
|
|
#include "nsIDOMEventTarget.h"
|
|
#include "nsIWeakReferenceUtils.h"
|
|
#include "nsPIWindowRoot.h"
|
|
#include "nsCycleCollectionParticipant.h"
|
|
#include "nsTHashtable.h"
|
|
#include "nsHashKeys.h"
|
|
|
|
class nsWindowRoot final : public nsPIWindowRoot
|
|
{
|
|
public:
|
|
explicit nsWindowRoot(nsPIDOMWindowOuter* aWindow);
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
NS_DECL_NSIDOMEVENTTARGET
|
|
|
|
virtual mozilla::EventListenerManager*
|
|
GetExistingListenerManager() const override;
|
|
virtual mozilla::EventListenerManager*
|
|
GetOrCreateListenerManager() override;
|
|
|
|
using mozilla::dom::EventTarget::RemoveEventListener;
|
|
virtual void AddEventListener(const nsAString& aType,
|
|
mozilla::dom::EventListener* aListener,
|
|
const mozilla::dom::AddEventListenerOptionsOrBoolean& aOptions,
|
|
const mozilla::dom::Nullable<bool>& aWantsUntrusted,
|
|
mozilla::ErrorResult& aRv) override;
|
|
|
|
// nsPIWindowRoot
|
|
|
|
virtual nsPIDOMWindowOuter* GetWindow() override;
|
|
|
|
virtual nsresult GetControllers(bool aForVisibleWindow,
|
|
nsIControllers** aResult) override;
|
|
virtual nsresult GetControllerForCommand(const char * aCommand,
|
|
bool aForVisibleWindow,
|
|
nsIController** _retval) override;
|
|
|
|
virtual void GetEnabledDisabledCommands(nsTArray<nsCString>& aEnabledCommands,
|
|
nsTArray<nsCString>& aDisabledCommands) override;
|
|
|
|
virtual already_AddRefed<nsINode> GetPopupNode() override;
|
|
virtual void SetPopupNode(nsINode* aNode) override;
|
|
|
|
virtual void SetParentTarget(mozilla::dom::EventTarget* aTarget) override
|
|
{
|
|
mParent = aTarget;
|
|
}
|
|
virtual mozilla::dom::EventTarget* GetParentTarget() override { return mParent; }
|
|
virtual nsPIDOMWindowOuter* GetOwnerGlobalForBindings() override;
|
|
virtual nsIGlobalObject* GetOwnerGlobal() const override;
|
|
|
|
nsIGlobalObject* GetParentObject();
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsWindowRoot,
|
|
nsIDOMEventTarget)
|
|
|
|
virtual void AddBrowser(mozilla::dom::TabParent* aBrowser) override;
|
|
virtual void RemoveBrowser(mozilla::dom::TabParent* aBrowser) override;
|
|
virtual void EnumerateBrowsers(BrowserEnumerator aEnumFunc, void *aArg) override;
|
|
|
|
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;
|
|
}
|
|
|
|
protected:
|
|
virtual ~nsWindowRoot();
|
|
|
|
void GetEnabledDisabledCommandsForControllers(nsIControllers* aControllers,
|
|
nsTHashtable<nsCharPtrHashKey>& aCommandsHandled,
|
|
nsTArray<nsCString>& aEnabledCommands,
|
|
nsTArray<nsCString>& aDisabledCommands);
|
|
|
|
// Members
|
|
nsCOMPtr<nsPIDOMWindowOuter> mWindow;
|
|
// We own the manager, which owns event listeners attached to us.
|
|
RefPtr<mozilla::EventListenerManager> mListenerManager; // [Strong]
|
|
nsWeakPtr mPopupNode;
|
|
|
|
// True if focus rings and accelerators are enabled for this
|
|
// window hierarchy.
|
|
bool mShowAccelerators;
|
|
bool mShowFocusRings;
|
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> mParent;
|
|
|
|
// The TabParents that are currently registered with this top-level window.
|
|
typedef nsTHashtable<nsRefPtrHashKey<nsIWeakReference>> WeakBrowserTable;
|
|
WeakBrowserTable mWeakBrowsers;
|
|
};
|
|
|
|
extern already_AddRefed<mozilla::dom::EventTarget>
|
|
NS_NewWindowRoot(nsPIDOMWindowOuter* aWindow);
|
|
|
|
#endif
|