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