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

Unified Diff: device/vr/vr_device_manager.cc

Issue 2746233002: Fixes 2D-to-WebVR site transitions when browsing in VR. (Closed)
Patch Set: Fixed export Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/vr/vr_device_manager.h ('k') | device/vr/vr_device_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/vr_device_manager.cc
diff --git a/device/vr/vr_device_manager.cc b/device/vr/vr_device_manager.cc
index 6f8fc72c7b7f63f274b06b11eb4ba99f677c7c00..249b3c9259ccfa8208f218a67c8a590e83bc5273 100644
--- a/device/vr/vr_device_manager.cc
+++ b/device/vr/vr_device_manager.cc
@@ -68,7 +68,26 @@ void VRDeviceManager::AddService(VRServiceImpl* service) {
// Loop through any currently active devices and send Connected messages to
// the service. Future devices that come online will send a Connected message
// when they are created.
- GetVRDevices(service);
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ InitializeProviders();
+
+ std::vector<VRDevice*> devices;
+ for (const auto& provider : providers_) {
+ provider->GetDevices(&devices);
+ }
+
+ for (auto* device : devices) {
+ if (device->id() == VR_DEVICE_LAST_ID) {
+ continue;
+ }
+
+ if (devices_.find(device->id()) == devices_.end()) {
+ devices_[device->id()] = device;
+ }
+
+ service->ConnectDevice(device);
+ }
services_.insert(service);
}
@@ -87,34 +106,6 @@ void VRDeviceManager::RemoveService(VRServiceImpl* service) {
}
}
-bool VRDeviceManager::GetVRDevices(VRServiceImpl* service) {
- DCHECK(thread_checker_.CalledOnValidThread());
-
- InitializeProviders();
-
- std::vector<VRDevice*> devices;
- for (const auto& provider : providers_)
- provider->GetDevices(&devices);
-
- if (devices.empty())
- return false;
-
- for (auto* device : devices) {
- if (device->id() == VR_DEVICE_LAST_ID)
- continue;
-
- if (devices_.find(device->id()) == devices_.end())
- devices_[device->id()] = device;
-
- // Create a VRDisplayImpl for this service/device pair and attach
- // the VRDisplayImpl to the device.
- VRDisplayImpl* display_impl = service->GetVRDisplayImpl(device);
- device->AddDisplay(display_impl);
- }
-
- return true;
-}
-
unsigned int VRDeviceManager::GetNumberOfConnectedDevices() {
DCHECK(thread_checker_.CalledOnValidThread());
« no previous file with comments | « device/vr/vr_device_manager.h ('k') | device/vr/vr_device_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698