OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_VR_VR_SERVICE_H |
| 6 #define CONTENT_BROWSER_VR_VR_SERVICE_H |
| 7 |
| 8 #include <map> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/memory/singleton.h" |
| 13 #include "content/browser/vr/vr_device.h" |
| 14 #include "content/browser/vr/vr_device_provider.h" |
| 15 #include "content/common/content_export.h" |
| 16 |
| 17 namespace blink { |
| 18 class WebVRDevice; |
| 19 } |
| 20 |
| 21 namespace content { |
| 22 |
| 23 class CONTENT_EXPORT VRService { |
| 24 public: |
| 25 // Returns the VRService singleton. |
| 26 static VRService* GetInstance(); |
| 27 |
| 28 void Initialize(); |
| 29 void Shutdown(); |
| 30 void GetVRDevices(std::vector<blink::WebVRDevice>* webvr_devices); |
| 31 VRDevice* GetDevice(unsigned int index); |
| 32 |
| 33 private: |
| 34 friend struct DefaultSingletonTraits<VRService>; |
| 35 friend class VRServiceTest; |
| 36 |
| 37 VRService(); |
| 38 |
| 39 // Constructor for testing. Takes ownership of the given provider. |
| 40 explicit VRService(VRDeviceProvider* provider); |
| 41 virtual ~VRService(); |
| 42 |
| 43 void RegisterProvider(VRDeviceProvider* provider); |
| 44 |
| 45 typedef std::vector<VRDeviceProvider*> ProviderList; |
| 46 ProviderList providers_; |
| 47 |
| 48 typedef std::map<unsigned int, VRDevice*> DeviceMap; |
| 49 DeviceMap devices_; |
| 50 |
| 51 bool vr_initialized_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(VRService); |
| 54 }; |
| 55 |
| 56 } // namespace content |
| 57 |
| 58 #endif // CONTENT_BROWSER_VR_VR_SERVICE_H |
OLD | NEW |