Bumping gaia.json for 8 gaia revision(s) a=gaia-bump
[gecko.git] / dom / base / nsWindowRoot.h
blob6e46b5ab570f2951441c02fc371fe00c63cbf452
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;
13 class nsIGlobalObject;
15 namespace mozilla {
16 class EventChainPostVisitor;
17 class EventChainPreVisitor;
18 } // namespace mozilla
20 #include "mozilla/Attributes.h"
21 #include "mozilla/EventListenerManager.h"
22 #include "nsIDOMEventTarget.h"
23 #include "nsPIWindowRoot.h"
24 #include "nsCycleCollectionParticipant.h"
25 #include "nsAutoPtr.h"
26 #include "nsTHashtable.h"
27 #include "nsHashKeys.h"
29 class nsWindowRoot : public nsPIWindowRoot
31 public:
32 explicit nsWindowRoot(nsPIDOMWindow* aWindow);
34 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
35 NS_DECL_NSIDOMEVENTTARGET
37 virtual mozilla::EventListenerManager*
38 GetExistingListenerManager() const MOZ_OVERRIDE;
39 virtual mozilla::EventListenerManager*
40 GetOrCreateListenerManager() MOZ_OVERRIDE;
42 using mozilla::dom::EventTarget::RemoveEventListener;
43 virtual void AddEventListener(const nsAString& aType,
44 mozilla::dom::EventListener* aListener,
45 bool aUseCapture,
46 const mozilla::dom::Nullable<bool>& aWantsUntrusted,
47 mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
49 // nsPIWindowRoot
51 virtual nsPIDOMWindow* GetWindow() MOZ_OVERRIDE;
53 virtual nsresult GetControllers(nsIControllers** aResult) MOZ_OVERRIDE;
54 virtual nsresult GetControllerForCommand(const char * aCommand,
55 nsIController** _retval) MOZ_OVERRIDE;
57 virtual void GetEnabledDisabledCommands(nsTArray<nsCString>& aEnabledCommands,
58 nsTArray<nsCString>& aDisabledCommands) MOZ_OVERRIDE;
60 virtual nsIDOMNode* GetPopupNode() MOZ_OVERRIDE;
61 virtual void SetPopupNode(nsIDOMNode* aNode) MOZ_OVERRIDE;
63 virtual void SetParentTarget(mozilla::dom::EventTarget* aTarget) MOZ_OVERRIDE
65 mParent = aTarget;
67 virtual mozilla::dom::EventTarget* GetParentTarget() MOZ_OVERRIDE { return mParent; }
68 virtual nsIDOMWindow* GetOwnerGlobal() MOZ_OVERRIDE;
70 nsIGlobalObject* GetParentObject();
72 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
74 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsWindowRoot,
75 nsIDOMEventTarget)
77 protected:
78 virtual ~nsWindowRoot();
80 void GetEnabledDisabledCommandsForControllers(nsIControllers* aControllers,
81 nsTHashtable<nsCharPtrHashKey>& aCommandsHandled,
82 nsTArray<nsCString>& aEnabledCommands,
83 nsTArray<nsCString>& aDisabledCommands);
85 // Members
86 nsCOMPtr<nsPIDOMWindow> mWindow;
87 // We own the manager, which owns event listeners attached to us.
88 nsRefPtr<mozilla::EventListenerManager> mListenerManager; // [Strong]
89 nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER]
91 nsCOMPtr<mozilla::dom::EventTarget> mParent;
94 extern already_AddRefed<mozilla::dom::EventTarget>
95 NS_NewWindowRoot(nsPIDOMWindow* aWindow);
97 #endif