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; |