Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / base / nsWindowRoot.h
blobd798b77a4848791249ad1681c5f0d8fbf62f42b2
1 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsWindowRoot_h__
8 #define nsWindowRoot_h__
10 class nsPIDOMWindow;
11 class nsIDOMEventListener;
12 class nsIDOMEvent;
14 namespace mozilla {
15 class EventChainPostVisitor;
16 class EventChainPreVisitor;
17 } // namespace mozilla
19 #include "mozilla/Attributes.h"
20 #include "mozilla/EventListenerManager.h"
21 #include "nsIDOMEventTarget.h"
22 #include "nsPIWindowRoot.h"
23 #include "nsCycleCollectionParticipant.h"
24 #include "nsAutoPtr.h"
26 class nsWindowRoot : public nsPIWindowRoot
28 public:
29 explicit nsWindowRoot(nsPIDOMWindow* aWindow);
31 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
32 NS_DECL_NSIDOMEVENTTARGET
34 virtual mozilla::EventListenerManager*
35 GetExistingListenerManager() const MOZ_OVERRIDE;
36 virtual mozilla::EventListenerManager*
37 GetOrCreateListenerManager() MOZ_OVERRIDE;
39 using mozilla::dom::EventTarget::RemoveEventListener;
40 virtual void AddEventListener(const nsAString& aType,
41 mozilla::dom::EventListener* aListener,
42 bool aUseCapture,
43 const mozilla::dom::Nullable<bool>& aWantsUntrusted,
44 mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
46 // nsPIWindowRoot
48 virtual nsPIDOMWindow* GetWindow() MOZ_OVERRIDE;
50 virtual nsresult GetControllers(nsIControllers** aResult) MOZ_OVERRIDE;
51 virtual nsresult GetControllerForCommand(const char * aCommand,
52 nsIController** _retval) MOZ_OVERRIDE;
54 virtual nsIDOMNode* GetPopupNode() MOZ_OVERRIDE;
55 virtual void SetPopupNode(nsIDOMNode* aNode) MOZ_OVERRIDE;
57 virtual void SetParentTarget(mozilla::dom::EventTarget* aTarget) MOZ_OVERRIDE
59 mParent = aTarget;
61 virtual mozilla::dom::EventTarget* GetParentTarget() MOZ_OVERRIDE { return mParent; }
62 virtual nsIDOMWindow* GetOwnerGlobal() MOZ_OVERRIDE;
64 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsWindowRoot,
65 nsIDOMEventTarget)
67 protected:
68 virtual ~nsWindowRoot();
70 // Members
71 nsCOMPtr<nsPIDOMWindow> mWindow;
72 // We own the manager, which owns event listeners attached to us.
73 nsRefPtr<mozilla::EventListenerManager> mListenerManager; // [Strong]
74 nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER]
76 nsCOMPtr<mozilla::dom::EventTarget> mParent;
79 extern already_AddRefed<mozilla::dom::EventTarget>
80 NS_NewWindowRoot(nsPIDOMWindow* aWindow);
82 #endif