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