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 CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H | 5 #ifndef CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H |
6 #define CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H | 6 #define CONTENT_BROWSER_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 <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
17 #include "content/browser/vr/vr_device.h" | 17 #include "content/browser/vr/vr_device.h" |
18 #include "content/browser/vr/vr_device_provider.h" | 18 #include "content/browser/vr/vr_device_provider.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
20 #include "content/common/vr_service.mojom.h" | 20 #include "content/common/vr_service.mojom.h" |
21 #include "mojo/public/cpp/bindings/binding_set.h" | 21 #include "mojo/public/cpp/bindings/binding_set.h" |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 class VRDeviceManager : public mojom::VRService { | 25 class VRDeviceManager : public mojom::VRService { |
26 public: | 26 public: |
27 ~VRDeviceManager() override; | 27 ~VRDeviceManager() override; |
28 | 28 |
29 static void BindRequest(mojo::InterfaceRequest<mojom::VRService> request); | 29 static void BindRequest(mojo::InterfaceRequest<mojom::VRService> request); |
30 | 30 |
31 // Returns the VRDeviceManager singleton. | 31 // Returns the VRDeviceManager singleton. |
32 static VRDeviceManager* GetInstance(); | 32 static VRDeviceManager* GetInstance(); |
33 | 33 |
34 mojo::Array<mojom::VRDeviceInfoPtr> GetVRDevices(); | 34 mojo::Array<mojom::VRDeviceInfoPtr> GetVRDevices(); |
35 VRDevice* GetDevice(unsigned int index); | 35 VRDevice* GetDevice(unsigned int index); |
36 | 36 |
37 private: | 37 private: |
38 friend class VRDeviceManagerTest; | 38 friend class VRDeviceManagerTest; |
39 | 39 |
40 VRDeviceManager(); | 40 VRDeviceManager(); |
41 // Constructor for testing. | 41 // Constructor for testing. |
42 explicit VRDeviceManager(scoped_ptr<VRDeviceProvider> provider); | 42 explicit VRDeviceManager(std::unique_ptr<VRDeviceProvider> provider); |
43 | 43 |
44 static void SetInstance(VRDeviceManager* service); | 44 static void SetInstance(VRDeviceManager* service); |
45 static bool HasInstance(); | 45 static bool HasInstance(); |
46 | 46 |
47 void InitializeProviders(); | 47 void InitializeProviders(); |
48 void RegisterProvider(scoped_ptr<VRDeviceProvider> provider); | 48 void RegisterProvider(std::unique_ptr<VRDeviceProvider> provider); |
49 | 49 |
50 // mojom::VRService implementation | 50 // mojom::VRService implementation |
51 void GetDevices(const GetDevicesCallback& callback) override; | 51 void GetDevices(const GetDevicesCallback& callback) override; |
52 void GetSensorState(uint32_t index, | 52 void GetSensorState(uint32_t index, |
53 const GetSensorStateCallback& callback) override; | 53 const GetSensorStateCallback& callback) override; |
54 void ResetSensor(uint32_t index) override; | 54 void ResetSensor(uint32_t index) override; |
55 | 55 |
56 // Mojo connection error handler. | 56 // Mojo connection error handler. |
57 void OnConnectionError(); | 57 void OnConnectionError(); |
58 | 58 |
(...skipping 12 matching lines...) Expand all Loading... |
71 bool keep_alive_; | 71 bool keep_alive_; |
72 | 72 |
73 base::ThreadChecker thread_checker_; | 73 base::ThreadChecker thread_checker_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(VRDeviceManager); | 75 DISALLOW_COPY_AND_ASSIGN(VRDeviceManager); |
76 }; | 76 }; |
77 | 77 |
78 } // namespace content | 78 } // namespace content |
79 | 79 |
80 #endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H | 80 #endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H |
OLD | NEW |