1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 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/. */ 6 7 #ifndef mozilla_dom_TimeEvent_h_ 8 #define mozilla_dom_TimeEvent_h_ 9 10 #include "mozilla/dom/Event.h" 11 #include "mozilla/dom/TimeEventBinding.h" 12 #include "nsIDOMTimeEvent.h" 13 14 class nsGlobalWindow; 15 16 namespace mozilla { 17 namespace dom { 18 19 class TimeEvent final : public Event, 20 public nsIDOMTimeEvent 21 { 22 public: 23 TimeEvent(EventTarget* aOwner, 24 nsPresContext* aPresContext, 25 InternalSMILTimeEvent* aEvent); 26 27 // nsISupports interface: 28 NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TimeEvent,Event)29 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TimeEvent, Event) 30 31 // nsIDOMTimeEvent interface: 32 NS_DECL_NSIDOMTIMEEVENT 33 34 // Forward to base class 35 NS_FORWARD_TO_EVENT 36 37 virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override 38 { 39 return TimeEventBinding::Wrap(aCx, this, aGivenProto); 40 } 41 42 void InitTimeEvent(const nsAString& aType, nsGlobalWindow* aView, 43 int32_t aDetail); 44 45 Detail()46 int32_t Detail() const 47 { 48 return mDetail; 49 } 50 GetView()51 nsPIDOMWindowOuter* GetView() const 52 { 53 return mView; 54 } 55 56 private: ~TimeEvent()57 ~TimeEvent() {} 58 59 nsCOMPtr<nsPIDOMWindowOuter> mView; 60 int32_t mDetail; 61 }; 62 63 } // namespace dom 64 } // namespace mozilla 65 66 already_AddRefed<mozilla::dom::TimeEvent> 67 NS_NewDOMTimeEvent(mozilla::dom::EventTarget* aOwner, 68 nsPresContext* aPresContext, 69 mozilla::InternalSMILTimeEvent* aEvent); 70 71 #endif // mozilla_dom_TimeEvent_h_ 72