| 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> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // Adds a listener for device manager events. VRDeviceManager does not own | 36 // Adds a listener for device manager events. VRDeviceManager does not own |
| 37 // this object. | 37 // this object. |
| 38 // Automatically connects all currently available VR devices by querying | 38 // Automatically connects all currently available VR devices by querying |
| 39 // the device providers and, for each returned device, calling | 39 // the device providers and, for each returned device, calling |
| 40 // VRServiceImpl::ConnectDevice. | 40 // VRServiceImpl::ConnectDevice. |
| 41 DEVICE_VR_EXPORT void AddService(VRServiceImpl* service); | 41 DEVICE_VR_EXPORT void AddService(VRServiceImpl* service); |
| 42 void RemoveService(VRServiceImpl* service); | 42 void RemoveService(VRServiceImpl* service); |
| 43 | 43 |
| 44 DEVICE_VR_EXPORT unsigned int GetNumberOfConnectedDevices(); | 44 DEVICE_VR_EXPORT unsigned int GetNumberOfConnectedDevices(); |
| 45 | 45 |
| 46 void ListeningForActivateChanged(bool listening); | 46 void ListeningForActivateChanged(bool listening, VRServiceImpl* service); |
| 47 |
| 48 bool IsMostRecentlyListeningForActivate(VRServiceImpl* service); |
| 47 | 49 |
| 48 private: | 50 private: |
| 49 friend class VRDeviceManagerTest; | 51 friend class VRDeviceManagerTest; |
| 50 friend class VRDisplayImplTest; | 52 friend class VRDisplayImplTest; |
| 51 friend class VRServiceImplTest; | 53 friend class VRServiceImplTest; |
| 52 | 54 |
| 53 VRDeviceManager(); | 55 VRDeviceManager(); |
| 54 // Constructor for testing. | 56 // Constructor for testing. |
| 55 DEVICE_VR_EXPORT explicit VRDeviceManager( | 57 DEVICE_VR_EXPORT explicit VRDeviceManager( |
| 56 std::unique_ptr<VRDeviceProvider> provider); | 58 std::unique_ptr<VRDeviceProvider> provider); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 70 using ProviderList = std::vector<std::unique_ptr<VRDeviceProvider>>; | 72 using ProviderList = std::vector<std::unique_ptr<VRDeviceProvider>>; |
| 71 ProviderList providers_; | 73 ProviderList providers_; |
| 72 | 74 |
| 73 // Devices are owned by their providers. | 75 // Devices are owned by their providers. |
| 74 using DeviceMap = std::map<unsigned int, VRDevice*>; | 76 using DeviceMap = std::map<unsigned int, VRDevice*>; |
| 75 DeviceMap devices_; | 77 DeviceMap devices_; |
| 76 | 78 |
| 77 bool vr_initialized_; | 79 bool vr_initialized_; |
| 78 | 80 |
| 79 std::set<VRServiceImpl*> services_; | 81 std::set<VRServiceImpl*> services_; |
| 82 VRServiceImpl* most_recently_listening_for_activate_ = nullptr; |
| 80 | 83 |
| 81 // For testing. If true will not delete self when consumer count reaches 0. | 84 // For testing. If true will not delete self when consumer count reaches 0. |
| 82 bool keep_alive_; | 85 bool keep_alive_; |
| 83 | 86 |
| 84 bool has_scheduled_poll_; | 87 bool has_scheduled_poll_; |
| 85 | 88 |
| 86 bool has_activate_listeners_; | 89 bool has_activate_listeners_; |
| 87 | 90 |
| 88 base::ThreadChecker thread_checker_; | 91 base::ThreadChecker thread_checker_; |
| 89 | 92 |
| 90 base::RepeatingTimer timer_; | 93 base::RepeatingTimer timer_; |
| 91 | 94 |
| 92 DISALLOW_COPY_AND_ASSIGN(VRDeviceManager); | 95 DISALLOW_COPY_AND_ASSIGN(VRDeviceManager); |
| 93 }; | 96 }; |
| 94 | 97 |
| 95 } // namespace content | 98 } // namespace content |
| 96 | 99 |
| 97 #endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H | 100 #endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H |
| OLD | NEW |