VREventObserver.h (1772B)
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_VREventObserver_h 8 #define mozilla_dom_VREventObserver_h 9 10 #include "VRManagerChild.h" 11 #include "mozilla/dom/VRDisplayEventBinding.h" 12 #include "nsISupportsImpl.h" // for NS_INLINE_DECL_REFCOUNTING 13 14 class nsGlobalWindowInner; 15 16 namespace mozilla::dom { 17 18 class VREventObserver final : public gfx::VRManagerEventObserver { 19 public: 20 NS_INLINE_DECL_REFCOUNTING(VREventObserver, override) 21 explicit VREventObserver(nsGlobalWindowInner* aGlobalWindow); 22 23 void NotifyAfterLoad(); 24 void NotifyVRDisplayMounted(uint32_t aDisplayID) override; 25 void NotifyVRDisplayUnmounted(uint32_t aDisplayID) override; 26 void NotifyVRDisplayNavigation(uint32_t aDisplayID); 27 void NotifyVRDisplayRequested(uint32_t aDisplayID); 28 void NotifyVRDisplayConnect(uint32_t aDisplayID) override; 29 void NotifyVRDisplayDisconnect(uint32_t aDisplayID) override; 30 void NotifyVRDisplayPresentChange(uint32_t aDisplayID) override; 31 void NotifyPresentationGenerationChanged(uint32_t aDisplayID) override; 32 void NotifyEnumerationCompleted() override; 33 void NotifyDetectRuntimesCompleted() override; 34 35 void DisconnectFromOwner(); 36 void StartActivity(); 37 void StopActivity(); 38 bool GetStopActivityStatus() const override; 39 40 private: 41 ~VREventObserver(); 42 43 bool IsWebVR(uint32_t aDisplayID) const; 44 45 RefPtr<nsGlobalWindowInner> mWindow; 46 bool mIs2DView; 47 bool mStopActivity; 48 }; 49 50 } // namespace mozilla::dom 51 52 #endif // mozilla_dom_VREventObserver_h