| 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 |
| 8 #include "core/frame/LocalFrameLifecycleObserver.h" | 9 #include "core/frame/LocalFrameLifecycleObserver.h" |
| 9 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| 11 #include "modules/vr/VRTypeConverters.h" |
| 10 #include "platform/Supplementable.h" | 12 #include "platform/Supplementable.h" |
| 11 #include "public/platform/modules/vr/WebVR.h" | 13 #include "wtf/Deque.h" |
| 12 #include "public/platform/modules/vr/WebVRClient.h" | 14 |
| 15 #include <memory> |
| 13 | 16 |
| 14 namespace blink { | 17 namespace blink { |
| 15 | 18 |
| 19 class ServiceRegistry; |
| 20 class VRGetDevicesCallback; |
| 21 |
| 16 class MODULES_EXPORT VRController final | 22 class MODULES_EXPORT VRController final |
| 17 : public GarbageCollectedFinalized<VRController> | 23 : public GarbageCollectedFinalized<VRController> |
| 18 , public Supplement<LocalFrame> | 24 , public Supplement<LocalFrame> |
| 19 , public LocalFrameLifecycleObserver { | 25 , public LocalFrameLifecycleObserver { |
| 20 USING_GARBAGE_COLLECTED_MIXIN(VRController); | 26 USING_GARBAGE_COLLECTED_MIXIN(VRController); |
| 21 WTF_MAKE_NONCOPYABLE(VRController); | 27 WTF_MAKE_NONCOPYABLE(VRController); |
| 22 public: | 28 public: |
| 23 virtual ~VRController(); | 29 virtual ~VRController(); |
| 24 | 30 |
| 25 void getDevices(WebVRGetDevicesCallback*); | 31 void getDevices(std::unique_ptr<VRGetDevicesCallback>); |
| 26 | 32 |
| 27 void getSensorState(unsigned index, WebHMDSensorState& into); | 33 void getSensorState(unsigned index, WebHMDSensorState& into); |
| 28 | 34 |
| 29 void resetSensor(unsigned index); | 35 void resetSensor(unsigned index); |
| 30 | 36 |
| 31 static void provideTo(LocalFrame&, WebVRClient*); | 37 static void provideTo(LocalFrame&, ServiceRegistry*); |
| 32 static VRController* from(LocalFrame&); | 38 static VRController* from(LocalFrame&); |
| 33 static const char* supplementName(); | 39 static const char* supplementName(); |
| 34 | 40 |
| 35 DECLARE_VIRTUAL_TRACE(); | 41 DECLARE_VIRTUAL_TRACE(); |
| 36 | 42 |
| 37 private: | 43 private: |
| 38 VRController(LocalFrame&, WebVRClient*); | 44 VRController(LocalFrame&, ServiceRegistry*); |
| 39 | 45 |
| 40 // Inherited from LocalFrameLifecycleObserver. | 46 // Inherited from LocalFrameLifecycleObserver. |
| 41 void willDetachFrameHost() override; | 47 void willDetachFrameHost() override; |
| 42 | 48 |
| 43 WebVRClient* m_client; | 49 // Binding callbacks. |
| 50 void OnGetDevices(const mojo::Array<mojom::VRDeviceInfoPtr>&); |
| 51 |
| 52 Deque<std::unique_ptr<VRGetDevicesCallback>> m_pendingGetDevicesCallbacks; |
| 53 mojom::VRServicePtr m_service; |
| 44 }; | 54 }; |
| 45 | 55 |
| 46 } // namespace blink | 56 } // namespace blink |
| 47 | 57 |
| 48 #endif // VRController_h | 58 #endif // VRController_h |
| OLD | NEW |