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

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

Issue 1200303002: Android WebVR implementation, Cardboard 0.5.5 SDK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 5 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
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 #include "content/browser/vr/vr_device_manager.h" 5 #include "content/browser/vr/vr_device_manager.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "third_party/WebKit/public/platform/modules/vr/WebVR.h" 8 #include "third_party/WebKit/public/platform/modules/vr/WebVR.h"
9 9
10 #if defined(OS_ANDROID)
11 #include "content/browser/vr/android/cardboard/cardboard_vr_device_provider.h"
12 #endif
13
10 namespace content { 14 namespace content {
11 15
12 namespace { 16 namespace {
13 VRDeviceManager* g_vr_device_manager = nullptr; 17 VRDeviceManager* g_vr_device_manager = nullptr;
14 } 18 }
15 19
16 VRDeviceManager::VRDeviceManager() 20 VRDeviceManager::VRDeviceManager()
17 : vr_initialized_(false), keep_alive_(false) { 21 : vr_initialized_(false), keep_alive_(false) {
18 bindings_.set_error_handler(this); 22 bindings_.set_error_handler(this);
19 // Register VRDeviceProviders for the current platform 23 // Register VRDeviceProviders for the current platform
24 #if defined(OS_ANDROID)
25 scoped_ptr<VRDeviceProvider> cardboard_provider(
26 new CardboardVRDeviceProvider());
27 RegisterProvider(cardboard_provider.Pass());
28 #endif
20 } 29 }
21 30
22 VRDeviceManager::VRDeviceManager(scoped_ptr<VRDeviceProvider> provider) 31 VRDeviceManager::VRDeviceManager(scoped_ptr<VRDeviceProvider> provider)
23 : vr_initialized_(false), keep_alive_(true) { 32 : vr_initialized_(false), keep_alive_(true) {
24 thread_checker_.DetachFromThread(); 33 thread_checker_.DetachFromThread();
25 RegisterProvider(provider.Pass()); 34 RegisterProvider(provider.Pass());
26 SetInstance(this); 35 SetInstance(this);
27 } 36 }
28 37
29 VRDeviceManager::~VRDeviceManager() { 38 VRDeviceManager::~VRDeviceManager() {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 139 }
131 } 140 }
132 141
133 void VRDeviceManager::ResetSensor(uint32_t index) { 142 void VRDeviceManager::ResetSensor(uint32_t index) {
134 VRDevice* device = GetDevice(index); 143 VRDevice* device = GetDevice(index);
135 if (device) 144 if (device)
136 device->ResetSensor(); 145 device->ResetSensor();
137 } 146 }
138 147
139 } // namespace content 148 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698