michael@0: /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsWindowRoot_h__ michael@0: #define nsWindowRoot_h__ michael@0: michael@0: class nsPIDOMWindow; michael@0: class nsIDOMEventListener; michael@0: class nsIDOMEvent; michael@0: michael@0: namespace mozilla { michael@0: class EventChainPostVisitor; michael@0: class EventChainPreVisitor; michael@0: } // namespace mozilla michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "mozilla/EventListenerManager.h" michael@0: #include "nsIDOMEventTarget.h" michael@0: #include "nsPIWindowRoot.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "nsAutoPtr.h" michael@0: michael@0: class nsWindowRoot : public nsPIWindowRoot michael@0: { michael@0: public: michael@0: nsWindowRoot(nsPIDOMWindow* aWindow); michael@0: virtual ~nsWindowRoot(); michael@0: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_NSIDOMEVENTTARGET michael@0: michael@0: virtual mozilla::EventListenerManager* michael@0: GetExistingListenerManager() const MOZ_OVERRIDE; michael@0: virtual mozilla::EventListenerManager* michael@0: GetOrCreateListenerManager() MOZ_OVERRIDE; michael@0: michael@0: using mozilla::dom::EventTarget::RemoveEventListener; michael@0: virtual void AddEventListener(const nsAString& aType, michael@0: mozilla::dom::EventListener* aListener, michael@0: bool aUseCapture, michael@0: const mozilla::dom::Nullable& aWantsUntrusted, michael@0: mozilla::ErrorResult& aRv) MOZ_OVERRIDE; michael@0: michael@0: // nsPIWindowRoot michael@0: michael@0: virtual nsPIDOMWindow* GetWindow() MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult GetControllers(nsIControllers** aResult) MOZ_OVERRIDE; michael@0: virtual nsresult GetControllerForCommand(const char * aCommand, michael@0: nsIController** _retval) MOZ_OVERRIDE; michael@0: michael@0: virtual nsIDOMNode* GetPopupNode() MOZ_OVERRIDE; michael@0: virtual void SetPopupNode(nsIDOMNode* aNode) MOZ_OVERRIDE; michael@0: michael@0: virtual void SetParentTarget(mozilla::dom::EventTarget* aTarget) MOZ_OVERRIDE michael@0: { michael@0: mParent = aTarget; michael@0: } michael@0: virtual mozilla::dom::EventTarget* GetParentTarget() MOZ_OVERRIDE { return mParent; } michael@0: virtual nsIDOMWindow* GetOwnerGlobal() MOZ_OVERRIDE; michael@0: michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsWindowRoot, michael@0: nsIDOMEventTarget) michael@0: michael@0: protected: michael@0: // Members michael@0: nsCOMPtr mWindow; michael@0: // We own the manager, which owns event listeners attached to us. michael@0: nsRefPtr mListenerManager; // [Strong] michael@0: nsCOMPtr mPopupNode; // [OWNER] michael@0: michael@0: nsCOMPtr mParent; michael@0: }; michael@0: michael@0: extern already_AddRefed michael@0: NS_NewWindowRoot(nsPIDOMWindow* aWindow); michael@0: michael@0: #endif