dom/events/EventListenerService.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:36e9803e18fe
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #ifndef mozilla_EventListenerService_h_
7 #define mozilla_EventListenerService_h_
8
9 #include "jsapi.h"
10 #include "mozilla/Attributes.h"
11 #include "nsAutoPtr.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "nsIDOMEventListener.h"
14 #include "nsIEventListenerService.h"
15 #include "nsString.h"
16
17 namespace mozilla {
18
19 template<typename T>
20 class Maybe;
21
22 class EventListenerInfo MOZ_FINAL : public nsIEventListenerInfo
23 {
24 public:
25 EventListenerInfo(const nsAString& aType,
26 already_AddRefed<nsIDOMEventListener> aListener,
27 bool aCapturing,
28 bool aAllowsUntrusted,
29 bool aInSystemEventGroup)
30 : mType(aType)
31 , mListener(aListener)
32 , mCapturing(aCapturing)
33 , mAllowsUntrusted(aAllowsUntrusted)
34 , mInSystemEventGroup(aInSystemEventGroup)
35 {
36 }
37
38 virtual ~EventListenerInfo() {}
39
40 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
41 NS_DECL_CYCLE_COLLECTION_CLASS(EventListenerInfo)
42 NS_DECL_NSIEVENTLISTENERINFO
43
44 protected:
45 bool GetJSVal(JSContext* aCx,
46 Maybe<JSAutoCompartment>& aAc,
47 JS::MutableHandle<JS::Value> aJSVal);
48
49 nsString mType;
50 // nsReftPtr because that is what nsListenerStruct uses too.
51 nsRefPtr<nsIDOMEventListener> mListener;
52 bool mCapturing;
53 bool mAllowsUntrusted;
54 bool mInSystemEventGroup;
55 };
56
57 class EventListenerService MOZ_FINAL : public nsIEventListenerService
58 {
59 public:
60 NS_DECL_ISUPPORTS
61 NS_DECL_NSIEVENTLISTENERSERVICE
62 };
63
64 } // namespace mozilla
65
66 #endif // mozilla_EventListenerService_h_

mercurial