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

Unified Diff: device/vr/vr_device_manager.cc

Issue 2343023002: Switch WebVR to handle GvrApi management through VrShellDelegate (Closed)
Patch Set: Renamed onNativeLibraryReady to initializeNative Created 4 years, 3 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_service.mojom » ('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 99fb1b35116562883a4e8a30ae165638434708c7..b6eee946289a20be3f08f5224b80d763f523306b 100644
--- a/device/vr/vr_device_manager.cc
+++ b/device/vr/vr_device_manager.cc
@@ -134,7 +134,9 @@ mojo::Array<VRDisplayPtr> VRDeviceManager::GetVRDevices() {
if (vr_device_info.is_null())
continue;
- vr_device_info->index = device->id();
+ // GetVRDevice should always set the index of the VRDisplay to its own id.
+ DCHECK(vr_device_info->index == device->id());
+
out_devices.push_back(std::move(vr_device_info));
}
@@ -263,6 +265,22 @@ void VRDeviceManager::OnDeviceConnectionStatusChanged(VRDevice* device,
}
}
+void VRDeviceManager::OnPresentEnded(VRDevice* device) {
+ // Ensure the presenting device is the one that we've been requested to stop.
+ if (!presenting_device_ || presenting_device_ != device)
+ return;
+
+ // Should never have a presenting device without a presenting service.
+ DCHECK(presenting_service_);
+
+ // Notify the presenting service that it's been forced to end presentation.
+ presenting_service_->client()->OnExitPresent(device->id());
+
+ // Clear the presenting service and device.
+ presenting_service_ = nullptr;
+ presenting_device_ = nullptr;
+}
+
void VRDeviceManager::InitializeProviders() {
if (vr_initialized_) {
return;
« no previous file with comments | « device/vr/vr_device_manager.h ('k') | device/vr/vr_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698