| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VRController_h | 5 #ifndef VRController_h |
| 6 #define VRController_h | 6 #define VRController_h |
| 7 | 7 |
| 8 #include "core/frame/LocalFrameLifecycleObserver.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "device/vr/vr_service.mojom-blink.h" | 9 #include "device/vr/vr_service.mojom-blink.h" |
| 10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| 11 #include "platform/Supplementable.h" | 11 #include "platform/Supplementable.h" |
| 12 #include "wtf/Deque.h" | 12 #include "wtf/Deque.h" |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class ServiceRegistry; | 18 class ServiceRegistry; |
| 19 class VRGetDevicesCallback; | 19 class VRGetDevicesCallback; |
| 20 | 20 |
| 21 class MODULES_EXPORT VRController final | 21 class MODULES_EXPORT VRController final |
| 22 : public GarbageCollectedFinalized<VRController> | 22 : public GarbageCollectedFinalized<VRController> |
| 23 , public Supplement<LocalFrame> | 23 , public Supplement<LocalFrame> { |
| 24 , public LocalFrameLifecycleObserver { | |
| 25 USING_GARBAGE_COLLECTED_MIXIN(VRController); | 24 USING_GARBAGE_COLLECTED_MIXIN(VRController); |
| 26 WTF_MAKE_NONCOPYABLE(VRController); | 25 WTF_MAKE_NONCOPYABLE(VRController); |
| 27 public: | 26 public: |
| 28 virtual ~VRController(); | 27 virtual ~VRController(); |
| 29 | 28 |
| 30 void getDisplays(std::unique_ptr<VRGetDevicesCallback>); | 29 void getDisplays(std::unique_ptr<VRGetDevicesCallback>); |
| 31 | 30 |
| 32 device::blink::VRPosePtr getPose(unsigned index); | 31 device::blink::VRPosePtr getPose(unsigned index); |
| 33 | 32 |
| 34 void resetPose(unsigned index); | 33 void resetPose(unsigned index); |
| 35 | 34 |
| 36 static void provideTo(LocalFrame&, ServiceRegistry*); | 35 static void provideTo(LocalFrame&, ServiceRegistry*); |
| 37 static VRController* from(LocalFrame&); | 36 static VRController* from(LocalFrame&); |
| 38 static const char* supplementName(); | 37 static const char* supplementName(); |
| 39 | 38 |
| 40 DECLARE_VIRTUAL_TRACE(); | 39 DECLARE_VIRTUAL_TRACE(); |
| 41 | 40 |
| 42 private: | 41 private: |
| 43 VRController(LocalFrame&, ServiceRegistry*); | 42 VRController(LocalFrame&, ServiceRegistry*); |
| 44 | 43 |
| 45 // Inherited from LocalFrameLifecycleObserver. | |
| 46 void willDetachFrameHost() override; | |
| 47 | |
| 48 // Binding callbacks. | 44 // Binding callbacks. |
| 49 void onGetDisplays(mojo::WTFArray<device::blink::VRDisplayPtr>); | 45 void onGetDisplays(mojo::WTFArray<device::blink::VRDisplayPtr>); |
| 50 | 46 |
| 51 Deque<std::unique_ptr<VRGetDevicesCallback>> m_pendingGetDevicesCallbacks; | 47 Deque<std::unique_ptr<VRGetDevicesCallback>> m_pendingGetDevicesCallbacks; |
| 52 device::blink::VRServicePtr m_service; | 48 device::blink::VRServicePtr m_service; |
| 53 }; | 49 }; |
| 54 | 50 |
| 55 } // namespace blink | 51 } // namespace blink |
| 56 | 52 |
| 57 #endif // VRController_h | 53 #endif // VRController_h |
| OLD | NEW |