Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: content/browser/vr/vr_device_manager.h

Issue 1808203005: [OnionSoup] Moving VR service from content to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT! Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/vr/vr_device.h ('k') | content/browser/vr/vr_device_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/linked_ptr.h" 15 #include "base/memory/linked_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"
21 #include "mojo/public/cpp/bindings/binding_set.h" 20 #include "mojo/public/cpp/bindings/binding_set.h"
21 #include "third_party/WebKit/public/platform/modules/vr/vr_service.mojom.h"
22 22
23 namespace content { 23 namespace content {
24 24
25 class VRDeviceManager : public mojom::VRService { 25 class VRDeviceManager : public blink::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(
30 mojo::InterfaceRequest<blink::mojom::VRService> request);
30 31
31 // Returns the VRDeviceManager singleton. 32 // Returns the VRDeviceManager singleton.
32 static VRDeviceManager* GetInstance(); 33 static VRDeviceManager* GetInstance();
33 34
34 mojo::Array<mojom::VRDeviceInfoPtr> GetVRDevices(); 35 mojo::Array<blink::mojom::VRDeviceInfoPtr> GetVRDevices();
35 VRDevice* GetDevice(unsigned int index); 36 VRDevice* GetDevice(unsigned int index);
36 37
37 private: 38 private:
38 friend class VRDeviceManagerTest; 39 friend class VRDeviceManagerTest;
39 40
40 VRDeviceManager(); 41 VRDeviceManager();
41 // Constructor for testing. 42 // Constructor for testing.
42 explicit VRDeviceManager(std::unique_ptr<VRDeviceProvider> provider); 43 explicit VRDeviceManager(std::unique_ptr<VRDeviceProvider> provider);
43 44
44 static void SetInstance(VRDeviceManager* service); 45 static void SetInstance(VRDeviceManager* service);
(...skipping 13 matching lines...) Expand all
58 59
59 using ProviderList = std::vector<linked_ptr<VRDeviceProvider>>; 60 using ProviderList = std::vector<linked_ptr<VRDeviceProvider>>;
60 ProviderList providers_; 61 ProviderList providers_;
61 62
62 // Devices are owned by their providers. 63 // Devices are owned by their providers.
63 using DeviceMap = std::map<unsigned int, VRDevice*>; 64 using DeviceMap = std::map<unsigned int, VRDevice*>;
64 DeviceMap devices_; 65 DeviceMap devices_;
65 66
66 bool vr_initialized_; 67 bool vr_initialized_;
67 68
68 mojo::BindingSet<mojom::VRService> bindings_; 69 mojo::BindingSet<blink::mojom::VRService> bindings_;
69 70
70 // For testing. If true will not delete self when consumer count reaches 0. 71 // For testing. If true will not delete self when consumer count reaches 0.
71 bool keep_alive_; 72 bool keep_alive_;
72 73
73 base::ThreadChecker thread_checker_; 74 base::ThreadChecker thread_checker_;
74 75
75 DISALLOW_COPY_AND_ASSIGN(VRDeviceManager); 76 DISALLOW_COPY_AND_ASSIGN(VRDeviceManager);
76 }; 77 };
77 78
78 } // namespace content 79 } // namespace content
79 80
80 #endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H 81 #endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H
OLDNEW
« no previous file with comments | « content/browser/vr/vr_device.h ('k') | content/browser/vr/vr_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698