dom/events/DataContainerEvent.h

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:d4249d2dd043
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_dom_DataContainerEvent_h_
7 #define mozilla_dom_DataContainerEvent_h_
8
9 #include "mozilla/dom/DataContainerEventBinding.h"
10 #include "mozilla/dom/Event.h"
11 #include "nsIDOMDataContainerEvent.h"
12 #include "nsInterfaceHashtable.h"
13
14 namespace mozilla {
15 namespace dom {
16
17 class DataContainerEvent : public Event,
18 public nsIDOMDataContainerEvent
19 {
20 public:
21 DataContainerEvent(EventTarget* aOwner,
22 nsPresContext* aPresContext,
23 WidgetEvent* aEvent);
24
25 NS_DECL_ISUPPORTS_INHERITED
26
27 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DataContainerEvent, Event)
28
29 NS_FORWARD_TO_EVENT
30
31 NS_DECL_NSIDOMDATACONTAINEREVENT
32
33 virtual JSObject*
34 WrapObject(JSContext* aCx) MOZ_OVERRIDE
35 {
36 return DataContainerEventBinding::Wrap(aCx, this);
37 }
38
39 already_AddRefed<nsIVariant> GetData(const nsAString& aKey)
40 {
41 nsCOMPtr<nsIVariant> val;
42 GetData(aKey, getter_AddRefs(val));
43 return val.forget();
44 }
45
46 void SetData(JSContext* aCx, const nsAString& aKey,
47 JS::Handle<JS::Value> aVal, ErrorResult& aRv);
48
49 private:
50 static PLDHashOperator
51 TraverseEntry(const nsAString& aKey, nsIVariant* aDataItem, void* aUserArg);
52
53 nsInterfaceHashtable<nsStringHashKey, nsIVariant> mData;
54 };
55
56 } // namespace dom
57 } // namespace mozilla
58
59 #endif // mozilla_dom_DataContainerEvent_h_

mercurial