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

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

Issue 2584343002: WIP: working copy-no-compositor path
Patch Set: StatTracker destructor, delete old magic numbers, mojo export Created 3 years, 11 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 unified diff | Download patch
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 Log.e(TAG, "Unable to instantiate VrClassesBuilder", e); 165 Log.e(TAG, "Unable to instantiate VrClassesBuilder", e);
166 } 166 }
167 return null; 167 return null;
168 } 168 }
169 } 169 }
170 170
171 /** 171 /**
172 * Handle a VR intent, entering VR in the process unless we're unable to. 172 * Handle a VR intent, entering VR in the process unless we're unable to.
173 */ 173 */
174 public void enterVRFromIntent(Intent intent) { 174 public void enterVRFromIntent(Intent intent) {
175 Log.i(TAG, "enterVrFromIntent mListeningForWebVrActivateBeforePause=" + mListeningForWebVrActivateBeforePause + " mRequestedWebVR=" + mRequestedWebVR);
175 // Vr Intent is only used on Daydream devices. 176 // Vr Intent is only used on Daydream devices.
176 if (mVrSupportLevel != VR_DAYDREAM) return; 177 if (mVrSupportLevel != VR_DAYDREAM) return;
177 assert isDaydreamVrIntent(intent); 178 assert isDaydreamVrIntent(intent);
178 if (mListeningForWebVrActivateBeforePause && !mRequestedWebVR) { 179 if (mListeningForWebVrActivateBeforePause && !mRequestedWebVR) {
179 nativeDisplayActivate(mNativeVrShellDelegate); 180 nativeDisplayActivate(mNativeVrShellDelegate);
180 return; 181 return;
181 } 182 }
182 // Normally, if the active page doesn't have a vrdisplayactivate listene r, and WebVR was not 183 // Normally, if the active page doesn't have a vrdisplayactivate listene r, and WebVR was not
183 // presenting and VrShell was not enabled, we shouldn't enter VR and Day dream Homescreen 184 // presenting and VrShell was not enabled, we shouldn't enter VR and Day dream Homescreen
184 // should show after DON flow. But due to a failure in unregisterDaydrea mIntent, we still 185 // should show after DON flow. But due to a failure in unregisterDaydrea mIntent, we still
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 if (mVrSupportLevel == VR_DAYDREAM) { 381 if (mVrSupportLevel == VR_DAYDREAM) {
381 unregisterDaydreamIntent(); 382 unregisterDaydreamIntent();
382 383
383 // When the active web page has a vrdisplayactivate event handler, 384 // When the active web page has a vrdisplayactivate event handler,
384 // mListeningForWebVrActivate should be set to true, which means a v rdisplayactive event 385 // mListeningForWebVrActivate should be set to true, which means a v rdisplayactive event
385 // should be fired once DON flow finished. However, DON flow will pa use our activity, 386 // should be fired once DON flow finished. However, DON flow will pa use our activity,
386 // which makes the active page becomes invisible. And the event fire s before the active 387 // which makes the active page becomes invisible. And the event fire s before the active
387 // page becomes visible again after DON finished. So here we remembe r the value of 388 // page becomes visible again after DON finished. So here we remembe r the value of
388 // mListeningForWebVrActivity before pause and use this value to dec ide if 389 // mListeningForWebVrActivity before pause and use this value to dec ide if
389 // vrdisplayactivate event should be dispatched in enterVRFromIntent . 390 // vrdisplayactivate event should be dispatched in enterVRFromIntent .
391 Log.i(TAG, "maybePauseVR: set mListeningForWebVrActivateBeforePause to " + mListeningForWebVrActivate);
390 mListeningForWebVrActivateBeforePause = mListeningForWebVrActivate; 392 mListeningForWebVrActivateBeforePause = mListeningForWebVrActivate;
391 } 393 }
392 if (mNonPresentingGvrContext != null) { 394 if (mNonPresentingGvrContext != null) {
393 mNonPresentingGvrContext.pause(); 395 mNonPresentingGvrContext.pause();
394 } 396 }
395 397
396 // TODO(mthiesse): When VR Shell lives in its own activity, and integrat es with Daydream 398 // TODO(mthiesse): When VR Shell lives in its own activity, and integrat es with Daydream
397 // home, pause instead of exiting VR here. For now, because VR Apps shou ldn't show up in the 399 // home, pause instead of exiting VR here. For now, because VR Apps shou ldn't show up in the
398 // non-VR recents, and we don't want ChromeTabbedActivity disappearing, exit VR. 400 // non-VR recents, and we don't want ChromeTabbedActivity disappearing, exit VR.
399 exitVRIfNecessary(true); 401 exitVRIfNecessary(true);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 private void shutdownNonPresentingNativeContext() { 454 private void shutdownNonPresentingNativeContext() {
453 mNonPresentingGvrContext.shutdown(); 455 mNonPresentingGvrContext.shutdown();
454 mNonPresentingGvrContext = null; 456 mNonPresentingGvrContext = null;
455 } 457 }
456 458
457 @CalledByNative 459 @CalledByNative
458 private void setListeningForWebVrActivate(boolean listening) { 460 private void setListeningForWebVrActivate(boolean listening) {
459 // Non-Daydream devices may not have the concept of display activate. So disable 461 // Non-Daydream devices may not have the concept of display activate. So disable
460 // mListeningForWebVrActivate for them. 462 // mListeningForWebVrActivate for them.
461 if (mVrSupportLevel != VR_DAYDREAM) return; 463 if (mVrSupportLevel != VR_DAYDREAM) return;
464 Log.i(TAG, "setListeningForWebVrActivate(" + listening + ")");
462 mListeningForWebVrActivate = listening; 465 mListeningForWebVrActivate = listening;
463 if (listening) { 466 if (listening) {
464 registerDaydreamIntent(); 467 registerDaydreamIntent();
465 } else { 468 } else {
466 unregisterDaydreamIntent(); 469 unregisterDaydreamIntent();
467 } 470 }
468 } 471 }
469 472
470 /** 473 /**
471 * Exits VR Shell, performing all necessary cleanup. 474 * Exits VR Shell, performing all necessary cleanup.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 */ 587 */
585 @CalledByNative 588 @CalledByNative
586 private long getNativePointer() { 589 private long getNativePointer() {
587 return mNativeVrShellDelegate; 590 return mNativeVrShellDelegate;
588 } 591 }
589 592
590 private native long nativeInit(); 593 private native long nativeInit();
591 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole an result); 594 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole an result);
592 private native void nativeDisplayActivate(long nativeVrShellDelegate); 595 private native void nativeDisplayActivate(long nativeVrShellDelegate);
593 } 596 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698