2016-07-05 01:46:49 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_VREventObserver_h
|
|
|
|
#define mozilla_dom_VREventObserver_h
|
|
|
|
|
2016-10-19 01:18:10 +03:00
|
|
|
#include "mozilla/dom/VRDisplayEventBinding.h"
|
2017-02-14 22:21:09 +03:00
|
|
|
#include "nsISupportsImpl.h" // for NS_INLINE_DECL_REFCOUNTING
|
2019-08-07 11:29:32 +03:00
|
|
|
#include "VRManagerChild.h"
|
2016-10-19 01:18:10 +03:00
|
|
|
|
2017-11-04 01:25:38 +03:00
|
|
|
class nsGlobalWindowInner;
|
2016-07-05 01:46:49 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2019-08-07 11:29:32 +03:00
|
|
|
class VREventObserver final : public gfx::VRManagerEventObserver {
|
2016-07-05 01:46:49 +03:00
|
|
|
public:
|
2019-08-07 11:29:32 +03:00
|
|
|
NS_INLINE_DECL_REFCOUNTING(VREventObserver, override)
|
2017-11-04 01:25:38 +03:00
|
|
|
explicit VREventObserver(nsGlobalWindowInner* aGlobalWindow);
|
2016-07-05 01:46:49 +03:00
|
|
|
|
2018-01-05 01:27:03 +03:00
|
|
|
void NotifyAfterLoad();
|
2019-08-07 11:29:32 +03:00
|
|
|
void NotifyVRDisplayMounted(uint32_t aDisplayID) override;
|
|
|
|
void NotifyVRDisplayUnmounted(uint32_t aDisplayID) override;
|
2016-10-19 01:18:10 +03:00
|
|
|
void NotifyVRDisplayNavigation(uint32_t aDisplayID);
|
|
|
|
void NotifyVRDisplayRequested(uint32_t aDisplayID);
|
2019-08-07 11:29:32 +03:00
|
|
|
void NotifyVRDisplayConnect(uint32_t aDisplayID) override;
|
|
|
|
void NotifyVRDisplayDisconnect(uint32_t aDisplayID) override;
|
|
|
|
void NotifyVRDisplayPresentChange(uint32_t aDisplayID) override;
|
|
|
|
void NotifyPresentationGenerationChanged(uint32_t aDisplayID) override;
|
2019-08-23 09:30:56 +03:00
|
|
|
void NotifyEnumerationCompleted() override;
|
2020-01-04 01:47:26 +03:00
|
|
|
void NotifyDetectRuntimesCompleted() override;
|
2017-02-14 22:21:09 +03:00
|
|
|
|
|
|
|
void DisconnectFromOwner();
|
2017-11-06 13:04:07 +03:00
|
|
|
void UpdateSpentTimeIn2DTelemetry(bool aUpdate);
|
2018-10-29 01:49:15 +03:00
|
|
|
void StartActivity();
|
|
|
|
void StopActivity();
|
2019-08-07 11:29:32 +03:00
|
|
|
bool GetStopActivityStatus() const override;
|
2016-07-05 01:46:49 +03:00
|
|
|
|
|
|
|
private:
|
2017-02-14 22:21:09 +03:00
|
|
|
~VREventObserver();
|
|
|
|
|
2020-04-07 23:37:00 +03:00
|
|
|
bool IsWebVR(uint32_t aDisplayID) const;
|
|
|
|
|
2017-11-04 01:25:38 +03:00
|
|
|
RefPtr<nsGlobalWindowInner> mWindow;
|
2017-07-28 13:42:11 +03:00
|
|
|
// For WebVR telemetry for tracking users who view content
|
|
|
|
// in the 2D view.
|
|
|
|
TimeStamp mSpendTimeIn2DView;
|
|
|
|
bool mIs2DView;
|
2017-11-06 13:04:07 +03:00
|
|
|
bool mHasReset;
|
2018-10-29 01:49:15 +03:00
|
|
|
bool mStopActivity;
|
2016-07-05 01:46:49 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_VREventObserver_h
|