VRDisplayEvent.h (1921B)
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 file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_VRDisplayEvent_h_ 8 #define mozilla_dom_VRDisplayEvent_h_ 9 10 #include "js/RootingAPI.h" 11 #include "mozilla/AlreadyAddRefed.h" 12 #include "mozilla/Maybe.h" 13 #include "mozilla/RefPtr.h" 14 #include "mozilla/dom/Event.h" 15 #include "mozilla/dom/Nullable.h" 16 #include "mozilla/dom/VRDisplay.h" 17 #include "mozilla/dom/VRDisplayEventBinding.h" 18 #include "nsCycleCollectionParticipant.h" 19 #include "nsISupports.h" 20 #include "nsStringFwd.h" 21 22 struct JSContext; 23 24 namespace mozilla { 25 namespace gfx { 26 class VRDisplay; 27 } // namespace gfx 28 29 namespace dom { 30 31 class VRDisplayEvent final : public Event { 32 public: 33 NS_DECL_ISUPPORTS_INHERITED 34 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(VRDisplayEvent, Event) 35 36 VRDisplay* Display(); 37 Nullable<VRDisplayEventReason> GetReason() const; 38 39 protected: 40 virtual ~VRDisplayEvent() = default; 41 explicit VRDisplayEvent(mozilla::dom::EventTarget* aOwner); 42 VRDisplayEvent(EventTarget* aOwner, nsPresContext* aPresContext, 43 InternalClipboardEvent* aEvent); 44 45 Maybe<VRDisplayEventReason> mReason; 46 RefPtr<VRDisplay> mDisplay; 47 48 public: 49 virtual JSObject* WrapObjectInternal( 50 JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; 51 52 static already_AddRefed<VRDisplayEvent> Constructor( 53 mozilla::dom::EventTarget* aOwner, const nsAString& aType, 54 const VRDisplayEventInit& aEventInitDict); 55 56 static already_AddRefed<VRDisplayEvent> Constructor( 57 const GlobalObject& aGlobal, const nsAString& aType, 58 const VRDisplayEventInit& aEventInitDict); 59 }; 60 61 } // namespace dom 62 } // namespace mozilla 63 64 #endif