dom/events/DataContainerEvent.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/events/DataContainerEvent.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef mozilla_dom_DataContainerEvent_h_
    1.10 +#define mozilla_dom_DataContainerEvent_h_
    1.11 +
    1.12 +#include "mozilla/dom/DataContainerEventBinding.h"
    1.13 +#include "mozilla/dom/Event.h"
    1.14 +#include "nsIDOMDataContainerEvent.h"
    1.15 +#include "nsInterfaceHashtable.h"
    1.16 +
    1.17 +namespace mozilla {
    1.18 +namespace dom {
    1.19 +
    1.20 +class DataContainerEvent : public Event,
    1.21 +                           public nsIDOMDataContainerEvent
    1.22 +{
    1.23 +public:
    1.24 +  DataContainerEvent(EventTarget* aOwner,
    1.25 +                     nsPresContext* aPresContext,
    1.26 +                     WidgetEvent* aEvent);
    1.27 +
    1.28 +  NS_DECL_ISUPPORTS_INHERITED
    1.29 +
    1.30 +  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DataContainerEvent, Event)
    1.31 +
    1.32 +  NS_FORWARD_TO_EVENT
    1.33 +
    1.34 +  NS_DECL_NSIDOMDATACONTAINEREVENT
    1.35 +
    1.36 +  virtual JSObject*
    1.37 +  WrapObject(JSContext* aCx) MOZ_OVERRIDE
    1.38 +  {
    1.39 +    return DataContainerEventBinding::Wrap(aCx, this);
    1.40 +  }
    1.41 +
    1.42 +  already_AddRefed<nsIVariant> GetData(const nsAString& aKey)
    1.43 +  {
    1.44 +    nsCOMPtr<nsIVariant> val;
    1.45 +    GetData(aKey, getter_AddRefs(val));
    1.46 +    return val.forget();
    1.47 +  }
    1.48 +
    1.49 +  void SetData(JSContext* aCx, const nsAString& aKey,
    1.50 +               JS::Handle<JS::Value> aVal, ErrorResult& aRv);
    1.51 +
    1.52 +private:
    1.53 +  static PLDHashOperator
    1.54 +    TraverseEntry(const nsAString& aKey, nsIVariant* aDataItem, void* aUserArg);
    1.55 +
    1.56 +  nsInterfaceHashtable<nsStringHashKey, nsIVariant> mData;
    1.57 +};
    1.58 +
    1.59 +} // namespace dom
    1.60 +} // namespace mozilla
    1.61 +
    1.62 +#endif // mozilla_dom_DataContainerEvent_h_

mercurial