Index: third_party/WebKit/Source/modules/vr/VRController.h |
diff --git a/third_party/WebKit/Source/modules/vr/VRController.h b/third_party/WebKit/Source/modules/vr/VRController.h |
index 3e01a2fc715e5f48db600b1766a1c9725eb23e24..f74dd8f2d1b0469634c6668bcc7a64aea19f5b93 100644 |
--- a/third_party/WebKit/Source/modules/vr/VRController.h |
+++ b/third_party/WebKit/Source/modules/vr/VRController.h |
@@ -5,47 +5,59 @@ |
#ifndef VRController_h |
#define VRController_h |
-#include "core/frame/LocalFrame.h" |
+#include "core/dom/ContextLifecycleObserver.h" |
+#include "core/dom/Document.h" |
#include "device/vr/vr_service.mojom-blink.h" |
-#include "modules/ModulesExport.h" |
-#include "platform/Supplementable.h" |
+#include "modules/vr/VRDisplay.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
+#include "platform/heap/Handle.h" |
#include "wtf/Deque.h" |
#include <memory> |
namespace blink { |
+class NavigatorVR; |
class ServiceRegistry; |
class VRGetDevicesCallback; |
-class MODULES_EXPORT VRController final |
+class VRController final |
: public GarbageCollectedFinalized<VRController> |
- , public Supplement<LocalFrame> { |
+ , public device::blink::VRServiceClient |
+ , public ContextLifecycleObserver { |
USING_GARBAGE_COLLECTED_MIXIN(VRController); |
WTF_MAKE_NONCOPYABLE(VRController); |
public: |
+ VRController(NavigatorVR*); |
virtual ~VRController(); |
- void getDisplays(std::unique_ptr<VRGetDevicesCallback>); |
- |
+ // VRService. |
+ void getDisplays(ScriptPromiseResolver*); |
device::blink::VRPosePtr getPose(unsigned index); |
- |
void resetPose(unsigned index); |
- static void provideTo(LocalFrame&, ServiceRegistry*); |
- static VRController* from(LocalFrame&); |
- static const char* supplementName(); |
+ VRDisplay* createOrUpdateDisplay(const device::blink::VRDisplayPtr&); |
+ VRDisplayVector updateDisplays(mojo::WTFArray<device::blink::VRDisplayPtr>); |
+ VRDisplay* getDisplayForIndex(unsigned index); |
DECLARE_VIRTUAL_TRACE(); |
private: |
- VRController(LocalFrame&, ServiceRegistry*); |
- |
// Binding callbacks. |
void onGetDisplays(mojo::WTFArray<device::blink::VRDisplayPtr>); |
+ // VRServiceClient. |
+ void OnDisplayChanged(device::blink::VRDisplayPtr) override; |
+ |
+ // ContextLifecycleObserver. |
+ void contextDestroyed() override; |
+ |
+ Member<NavigatorVR> m_navigatorVR; |
+ VRDisplayVector m_displays; |
+ |
Deque<std::unique_ptr<VRGetDevicesCallback>> m_pendingGetDevicesCallbacks; |
device::blink::VRServicePtr m_service; |
+ mojo::Binding<device::blink::VRServiceClient> m_binding; |
}; |
} // namespace blink |