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/. */
7 #ifndef mozilla_dom_VREventObserver_h
8 #define mozilla_dom_VREventObserver_h
10 #include "mozilla/dom/VRDisplayEventBinding.h"
11 #include "nsISupportsImpl.h" // for NS_INLINE_DECL_REFCOUNTING
12 #include "VRManagerChild.h"
14 class nsGlobalWindowInner
;
16 namespace mozilla::dom
{
18 class VREventObserver final
: public gfx::VRManagerEventObserver
{
20 NS_INLINE_DECL_REFCOUNTING(VREventObserver
, override
)
21 explicit VREventObserver(nsGlobalWindowInner
* aGlobalWindow
);
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
;
35 void DisconnectFromOwner();
36 void UpdateSpentTimeIn2DTelemetry(bool aUpdate
);
39 bool GetStopActivityStatus() const override
;
44 bool IsWebVR(uint32_t aDisplayID
) const;
46 RefPtr
<nsGlobalWindowInner
> mWindow
;
47 // For WebVR telemetry for tracking users who view content
49 TimeStamp mSpendTimeIn2DView
;
55 } // namespace mozilla::dom
57 #endif // mozilla_dom_VREventObserver_h