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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java

Issue 2506853002: Fix double-deletion of VR Shell when exiting webVR in onPause. (Closed)
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/vr_shell_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.vr_shell; 5 package org.chromium.chrome.browser.vr_shell;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.app.PendingIntent; 8 import android.app.PendingIntent;
9 import android.content.ComponentName; 9 import android.content.ComponentName;
10 import android.content.Intent; 10 import android.content.Intent;
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // non-VR recents, and we don't want ChromeTabbedActivity disappearing, exit VR. 293 // non-VR recents, and we don't want ChromeTabbedActivity disappearing, exit VR.
294 exitVRIfNecessary(false); 294 exitVRIfNecessary(false);
295 } 295 }
296 296
297 /** 297 /**
298 * Exits the current VR mode (WebVR or VRShell) 298 * Exits the current VR mode (WebVR or VRShell)
299 * @return Whether or not we exited VR. 299 * @return Whether or not we exited VR.
300 */ 300 */
301 public boolean exitVRIfNecessary(boolean returnTo2D) { 301 public boolean exitVRIfNecessary(boolean returnTo2D) {
302 if (!mInVr) return false; 302 if (!mInVr) return false;
303 // If WebVR is presenting instruct it to exit.
304 nativeExitWebVRIfNecessary(mNativeVrShellDelegate);
305 shutdownVR(returnTo2D); 303 shutdownVR(returnTo2D);
306 return true; 304 return true;
307 } 305 }
308 306
309 public void onExitVRResult(int resultCode) { 307 public void onExitVRResult(int resultCode) {
310 if (resultCode == Activity.RESULT_OK) { 308 if (resultCode == Activity.RESULT_OK) {
311 mVrDaydreamApi.setVrModeEnabled(false); 309 mVrDaydreamApi.setVrModeEnabled(false);
312 } else { 310 } else {
313 // For now, we don't handle re-entering VR when exit fails, so keep trying to exit. 311 // For now, we don't handle re-entering VR when exit fails, so keep trying to exit.
314 mVrDaydreamApi.exitFromVr(EXIT_VR_RESULT, new Intent()); 312 mVrDaydreamApi.exitFromVr(EXIT_VR_RESULT, new Intent());
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 529
532 /** 530 /**
533 * @return Pointer to the native VrShellDelegate object. 531 * @return Pointer to the native VrShellDelegate object.
534 */ 532 */
535 @CalledByNative 533 @CalledByNative
536 private long getNativePointer() { 534 private long getNativePointer() {
537 return mNativeVrShellDelegate; 535 return mNativeVrShellDelegate;
538 } 536 }
539 537
540 private native long nativeInit(); 538 private native long nativeInit();
541 private native void nativeExitWebVRIfNecessary(long nativeVrShellDelegate);
542 } 539 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/vr_shell_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698