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