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

Unified Diff: device/vr/android/gvr/gvr_device_provider.cc

Issue 2493063004: Fix exiting WebVR via Android UI not fully exiting fullscreen. (Closed)
Patch Set: Rebase pt. 2 Created 4 years, 1 month 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/android/gvr/gvr_device_provider.h ('k') | device/vr/test/fake_vr_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/android/gvr/gvr_device_provider.cc
diff --git a/device/vr/android/gvr/gvr_device_provider.cc b/device/vr/android/gvr/gvr_device_provider.cc
index d29ae9ddfc21199f89f05fa427c5ccfdea617c72..2581f7b6ef55de14c79ae82b9b16a31f453a9c24 100644
--- a/device/vr/android/gvr/gvr_device_provider.cc
+++ b/device/vr/android/gvr/gvr_device_provider.cc
@@ -63,21 +63,9 @@ bool GvrDeviceProvider::RequestPresent() {
return delegate_provider->RequestWebVRPresent(weak_ptr_factory_.GetWeakPtr());
}
+// VR presentation exit requested by the API.
void GvrDeviceProvider::ExitPresent() {
- if (!vr_device_)
- return;
-
- device::GvrDelegateProvider* delegate_provider =
- device::GvrDelegateProvider::GetInstance();
- if (!delegate_provider)
- return;
-
- vr_device_->SetDelegate(delegate_provider->GetNonPresentingDelegate());
-
- GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory(
- GAMEPAD_SOURCE_GVR);
-
- delegate_provider->ExitWebVRPresent();
+ SwitchToNonPresentingDelegate();
}
void GvrDeviceProvider::OnGvrDelegateReady(
@@ -89,8 +77,13 @@ void GvrDeviceProvider::OnGvrDelegateReady(
new GvrGamepadDataFetcher::Factory(delegate, vr_device_->id()));
}
+// VR presentation exit requested by the delegate (probably via UI).
void GvrDeviceProvider::OnGvrDelegateRemoved() {
- ExitPresent();
+ if (!vr_device_)
+ return;
+
+ SwitchToNonPresentingDelegate();
+ vr_device_->OnExitPresent();
}
void GvrDeviceProvider::OnDisplayBlur() {
@@ -105,4 +98,19 @@ void GvrDeviceProvider::OnDisplayFocus() {
vr_device_->OnDisplayFocus();
}
+void GvrDeviceProvider::SwitchToNonPresentingDelegate() {
+ GvrDelegateProvider* delegate_provider = GvrDelegateProvider::GetInstance();
+ if (!vr_device_ || !delegate_provider)
+ return;
+
+ vr_device_->SetDelegate(delegate_provider->GetNonPresentingDelegate());
+
+ // Remove GVR gamepad polling.
+ GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory(
+ GAMEPAD_SOURCE_GVR);
+
+ // If we're presenting currently stop.
+ delegate_provider->ExitWebVRPresent();
+}
+
} // namespace device
« no previous file with comments | « device/vr/android/gvr/gvr_device_provider.h ('k') | device/vr/test/fake_vr_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698