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

Unified Diff: chrome/browser/android/vr_shell/vr_shell_delegate.cc

Issue 2844833005: Tentatively goes into WebVR presentation mode if page listens to vrdisplayactivate. (Closed)
Patch Set: Fixed device unit tests Created 3 years, 8 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 | « chrome/browser/android/vr_shell/vr_shell_delegate.h ('k') | device/vr/test/fake_vr_display_impl_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell_delegate.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell_delegate.cc b/chrome/browser/android/vr_shell/vr_shell_delegate.cc
index 297168ddc871d13c21ac8d13006880b175f2133c..70daa50b10b366d2c1c2b5ce7fe329be20fb0c4e 100644
--- a/chrome/browser/android/vr_shell/vr_shell_delegate.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_delegate.cc
@@ -19,7 +19,8 @@ using base::android::AttachCurrentThread;
namespace vr_shell {
-VrShellDelegate::VrShellDelegate(JNIEnv* env, jobject obj) {
+VrShellDelegate::VrShellDelegate(JNIEnv* env, jobject obj)
+ : weak_ptr_factory_(this) {
DVLOG(1) << __FUNCTION__ << "=" << this;
j_vr_shell_delegate_.Reset(env, obj);
}
@@ -107,7 +108,9 @@ void VrShellDelegate::DisplayActivate(JNIEnv* env,
const JavaParamRef<jobject>& obj) {
if (device_provider_) {
device_provider_->Device()->OnActivate(
- device::mojom::VRDisplayEventReason::MOUNTED);
+ device::mojom::VRDisplayEventReason::MOUNTED,
+ base::Bind(&VrShellDelegate::OnActivateDisplayHandled,
+ weak_ptr_factory_.GetWeakPtr()));
}
}
@@ -203,6 +206,14 @@ void VrShellDelegate::CreateNonPresentingDelegate() {
interval_seconds_);
}
+void VrShellDelegate::OnActivateDisplayHandled(bool present_requested) {
+ if (!present_requested) {
+ // WebVR page didn't request presentation in the vrdisplayactivate handler.
+ // Tell VrShell that we are in VR Browsing Mode.
+ ExitWebVRPresent();
+ }
+}
+
device::GvrDelegate* VrShellDelegate::GetDelegate() {
if (presenting_delegate_)
return presenting_delegate_;
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_delegate.h ('k') | device/vr/test/fake_vr_display_impl_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698