Chromium Code Reviews| 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 <set> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/memory/singleton.h" | |
| 14 #include "base/threading/thread_checker.h" | |
| 15 #include "content/browser/vr/vr_device.h" | |
| 16 #include "content/browser/vr/vr_device_provider.h" | |
| 17 #include "content/browser/vr/vr_service_consumer.h" | |
| 18 #include "content/common/content_export.h" | |
| 19 | |
| 20 namespace blink { | |
| 21 class WebVRDevice; | |
| 22 } | |
| 23 | |
| 24 namespace content { | |
| 25 | |
| 26 class CONTENT_EXPORT VRService { | |
| 27 public: | |
| 28 // Returns the VRService singleton. | |
| 29 static VRService* GetInstance(); | |
| 30 | |
| 31 void GetVRDevices(std::vector<blink::WebVRDevice>* webvr_devices); | |
| 32 VRDevice* GetDevice(unsigned int index); | |
| 33 | |
| 34 private: | |
| 35 friend struct DefaultSingletonTraits<VRService>; | |
| 36 friend class VRServiceTest; | |
| 37 friend class VRServiceConsumer; | |
| 38 | |
| 39 VRService(); | |
| 40 // Constructor for testing. Takes ownership of the given provider. | |
|
no sievers
2015/03/26 19:55:15
If so, then you can pass scoped_ptr
| |
| 41 explicit VRService(VRDeviceProvider* provider); | |
| 42 virtual ~VRService(); | |
| 43 | |
| 44 void AddConsumer(VRServiceConsumer* consumer); | |
| 45 void RemoveConsumer(VRServiceConsumer* consumer); | |
| 46 | |
| 47 void InitializeProviders(); | |
| 48 void ReleaseProviderDevices(); | |
| 49 | |
| 50 void RegisterProvider(VRDeviceProvider* provider); | |
| 51 | |
| 52 typedef std::vector<VRDeviceProvider*> ProviderList; | |
| 53 ProviderList providers_; | |
| 54 | |
| 55 typedef std::map<unsigned int, VRDevice*> DeviceMap; | |
| 56 DeviceMap devices_; | |
| 57 | |
| 58 bool vr_initialized_; | |
| 59 | |
| 60 typedef std::set<VRServiceConsumer*> ConsumerSet; | |
| 61 ConsumerSet consumers_; | |
| 62 | |
| 63 base::ThreadChecker thread_checker_; | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(VRService); | |
| 66 }; | |
| 67 | |
| 68 } // namespace content | |
| 69 | |
| 70 #endif // CONTENT_BROWSER_VR_VR_SERVICE_H | |
| OLD | NEW |