Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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
27 {
28 public:
29 nsWindowRoot(nsPIDOMWindow* aWindow);
30 virtual ~nsWindowRoot();
32 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
33 NS_DECL_NSIDOMEVENTTARGET
35 virtual mozilla::EventListenerManager*
36 GetExistingListenerManager() const MOZ_OVERRIDE;
37 virtual mozilla::EventListenerManager*
38 GetOrCreateListenerManager() MOZ_OVERRIDE;
40 using mozilla::dom::EventTarget::RemoveEventListener;
41 virtual void AddEventListener(const nsAString& aType,
42 mozilla::dom::EventListener* aListener,
43 bool aUseCapture,
44 const mozilla::dom::Nullable<bool>& aWantsUntrusted,
45 mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
47 // nsPIWindowRoot
49 virtual nsPIDOMWindow* GetWindow() MOZ_OVERRIDE;
51 virtual nsresult GetControllers(nsIControllers** aResult) MOZ_OVERRIDE;
52 virtual nsresult GetControllerForCommand(const char * aCommand,
53 nsIController** _retval) MOZ_OVERRIDE;
55 virtual nsIDOMNode* GetPopupNode() MOZ_OVERRIDE;
56 virtual void SetPopupNode(nsIDOMNode* aNode) MOZ_OVERRIDE;
58 virtual void SetParentTarget(mozilla::dom::EventTarget* aTarget) MOZ_OVERRIDE
59 {
60 mParent = aTarget;
61 }
62 virtual mozilla::dom::EventTarget* GetParentTarget() MOZ_OVERRIDE { return mParent; }
63 virtual nsIDOMWindow* GetOwnerGlobal() MOZ_OVERRIDE;
65 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsWindowRoot,
66 nsIDOMEventTarget)
68 protected:
69 // Members
70 nsCOMPtr<nsPIDOMWindow> mWindow;
71 // We own the manager, which owns event listeners attached to us.
72 nsRefPtr<mozilla::EventListenerManager> mListenerManager; // [Strong]
73 nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER]
75 nsCOMPtr<mozilla::dom::EventTarget> mParent;
76 };
78 extern already_AddRefed<mozilla::dom::EventTarget>
79 NS_NewWindowRoot(nsPIDOMWindow* aWindow);
81 #endif