Source code

Revision control

Other Tools

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 "mozilla/dom/VRDisplayEventBinding.h"
11
#include "nsISupportsImpl.h" // for NS_INLINE_DECL_REFCOUNTING
12
#include "VRManagerChild.h"
13
14
class nsGlobalWindowInner;
15
16
namespace mozilla {
17
namespace dom {
18
19
class VREventObserver final : public gfx::VRManagerEventObserver {
20
public:
21
NS_INLINE_DECL_REFCOUNTING(VREventObserver, override)
22
explicit VREventObserver(nsGlobalWindowInner* aGlobalWindow);
23
24
void NotifyAfterLoad();
25
void NotifyVRDisplayMounted(uint32_t aDisplayID) override;
26
void NotifyVRDisplayUnmounted(uint32_t aDisplayID) override;
27
void NotifyVRDisplayNavigation(uint32_t aDisplayID);
28
void NotifyVRDisplayRequested(uint32_t aDisplayID);
29
void NotifyVRDisplayConnect(uint32_t aDisplayID) override;
30
void NotifyVRDisplayDisconnect(uint32_t aDisplayID) override;
31
void NotifyVRDisplayPresentChange(uint32_t aDisplayID) override;
32
void NotifyPresentationGenerationChanged(uint32_t aDisplayID) override;
33
void NotifyEnumerationCompleted() override;
34
35
void DisconnectFromOwner();
36
void UpdateSpentTimeIn2DTelemetry(bool aUpdate);
37
void StartActivity();
38
void StopActivity();
39
bool GetStopActivityStatus() const override;
40
41
private:
42
~VREventObserver();
43
44
RefPtr<nsGlobalWindowInner> mWindow;
45
// For WebVR telemetry for tracking users who view content
46
// in the 2D view.
47
TimeStamp mSpendTimeIn2DView;
48
bool mIs2DView;
49
bool mHasReset;
50
bool mStopActivity;
51
};
52
53
} // namespace dom
54
} // namespace mozilla
55
56
#endif // mozilla_dom_VREventObserver_h