| 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 DEVICE_VR_VR_DEVICE_MANAGER_H | 5 #ifndef DEVICE_VR_VR_DEVICE_MANAGER_H |
| 6 #define DEVICE_VR_VR_DEVICE_MANAGER_H | 6 #define DEVICE_VR_VR_DEVICE_MANAGER_H |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 18 #include "device/vr/vr_device.h" | 18 #include "device/vr/vr_device.h" |
| 19 #include "device/vr/vr_device_provider.h" | 19 #include "device/vr/vr_device_provider.h" |
| 20 #include "device/vr/vr_export.h" | 20 #include "device/vr/vr_export.h" |
| 21 #include "device/vr/vr_service.mojom.h" | 21 #include "device/vr/vr_service.mojom.h" |
| 22 #include "device/vr/vr_service_impl.h" | 22 #include "device/vr/vr_service_impl.h" |
| 23 #include "mojo/public/cpp/bindings/binding_set.h" | 23 #include "mojo/public/cpp/bindings/binding_set.h" |
| 24 | 24 |
| 25 namespace device { | 25 namespace device { |
| 26 | 26 |
| 27 // Singleton used to provide the platform's VR devices to VRServiceImpl |
| 28 // instances. |
| 27 class VRDeviceManager { | 29 class VRDeviceManager { |
| 28 public: | 30 public: |
| 29 DEVICE_VR_EXPORT virtual ~VRDeviceManager(); | 31 DEVICE_VR_EXPORT virtual ~VRDeviceManager(); |
| 30 | 32 |
| 31 // Returns the VRDeviceManager singleton. | 33 // Returns the VRDeviceManager singleton. |
| 32 static VRDeviceManager* GetInstance(); | 34 static VRDeviceManager* GetInstance(); |
| 33 | 35 |
| 34 // Adds a listener for device manager events. VRDeviceManager does not own | 36 // Adds a listener for device manager events. VRDeviceManager does not own |
| 35 // this object. | 37 // this object. |
| 36 void AddService(VRServiceImpl* service); | 38 // Automatically connects all currently available VR devices by querying |
| 39 // the device providers and, for each returned device, calling |
| 40 // VRServiceImpl::ConnectDevice. |
| 41 DEVICE_VR_EXPORT void AddService(VRServiceImpl* service); |
| 37 void RemoveService(VRServiceImpl* service); | 42 void RemoveService(VRServiceImpl* service); |
| 38 | 43 |
| 39 DEVICE_VR_EXPORT bool GetVRDevices(VRServiceImpl* service); | |
| 40 DEVICE_VR_EXPORT unsigned int GetNumberOfConnectedDevices(); | 44 DEVICE_VR_EXPORT unsigned int GetNumberOfConnectedDevices(); |
| 41 | 45 |
| 42 void ListeningForActivateChanged(bool listening); | 46 void ListeningForActivateChanged(bool listening); |
| 43 | 47 |
| 44 private: | 48 private: |
| 45 friend class VRDeviceManagerTest; | 49 friend class VRDeviceManagerTest; |
| 46 friend class VRDisplayImplTest; | 50 friend class VRDisplayImplTest; |
| 47 friend class VRServiceImplTest; | 51 friend class VRServiceImplTest; |
| 48 | 52 |
| 49 VRDeviceManager(); | 53 VRDeviceManager(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 base::ThreadChecker thread_checker_; | 88 base::ThreadChecker thread_checker_; |
| 85 | 89 |
| 86 base::RepeatingTimer timer_; | 90 base::RepeatingTimer timer_; |
| 87 | 91 |
| 88 DISALLOW_COPY_AND_ASSIGN(VRDeviceManager); | 92 DISALLOW_COPY_AND_ASSIGN(VRDeviceManager); |
| 89 }; | 93 }; |
| 90 | 94 |
| 91 } // namespace content | 95 } // namespace content |
| 92 | 96 |
| 93 #endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H | 97 #endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H |
| OLD | NEW |