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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java

Issue 2727873002: Implement lazy initialization for VrShellDelegate (Closed)
Patch Set: Fix support for DON flow from headset insertion. Created 3 years, 10 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
Index: chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
index 72953632b6831547c65aa076d4d81870469ed646..ebfcd0a5e49ee71ab32c58a49c5f834feb1b2e73 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -264,13 +264,13 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
@Override
public boolean isShowingBrowserControlsEnabled() {
- if (mVrShellDelegate.isInVR()) return false;
+ if (VrShellDelegate.isInVR()) return false;
return super.isShowingBrowserControlsEnabled();
}
@Override
public boolean isHidingBrowserControlsEnabled() {
- if (mVrShellDelegate.isInVR()) return true;
+ if (VrShellDelegate.isInVR()) return true;
return super.isHidingBrowserControlsEnabled();
}
}
@@ -312,7 +312,6 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
super.initializeCompositor();
mTabModelSelectorImpl.onNativeLibraryReady(getTabContentManager());
- mVrShellDelegate.onNativeLibraryReady();
mTabModelObserver = new TabModelSelectorTabModelObserver(mTabModelSelectorImpl) {
@Override
@@ -486,6 +485,7 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
} else {
CookiesFetcher.restoreCookies(this);
}
+
StartupMetrics.getInstance().recordHistogram(false);
if (FeatureUtilities.isTabModelMergingEnabled()) {
@@ -499,7 +499,8 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
}
VideoPersister.getInstance().stopPersist(this);
- mVrShellDelegate.maybeResumeVR();
+ // TODO(mthiesse): Move this call into ChromeActivity. crbug.com/697694
+ VrShellDelegate.maybeResumeVR(this);
mLocaleManager.setSnackbarManager(getSnackbarManager());
mLocaleManager.startObservingPhoneChanges();
@@ -521,7 +522,6 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
public void onPauseWithNative() {
mTabModelSelectorImpl.commitAllTabClosures();
CookiesFetcher.persistCookies(this);
- mVrShellDelegate.maybePauseVR();
mLocaleManager.setSnackbarManager(null);
mLocaleManager.stopObservingPhoneChanges();
@@ -564,8 +564,8 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
if (CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)) {
handleDebugIntent(intent);
}
- if (mVrShellDelegate.isDaydreamVrIntent(intent)) {
- mVrShellDelegate.enterVRFromIntent(intent);
+ if (VrShellDelegate.isDaydreamVrIntent(intent)) {
+ VrShellDelegate.enterVRFromIntent(intent);
} else if (ShortcutHelper.isShowToastIntent(intent)) {
ShortcutHelper.showAddedToHomescreenToastFromIntent(intent);
}
@@ -735,10 +735,10 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
mIntentWithEffect = false;
if ((mIsOnFirstRun || getSavedInstanceState() == null) && intent != null) {
- if (mVrShellDelegate.isDaydreamVrIntent(intent)) {
+ if (VrShellDelegate.isDaydreamVrIntent(intent)) {
// TODO(mthiesse): Improve startup when started from a VR intent. Right now
// we launch out of VR, partially load out of VR, then switch into VR.
- mVrShellDelegate.enterVRIfNecessary();
+ VrShellDelegate.enterVRIfNecessary();
} else if (!mIntentHandler.shouldIgnoreIntent(intent)) {
mIntentWithEffect = mIntentHandler.onNewIntent(intent);
}
@@ -808,7 +808,7 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
}
return true;
} else if (requestCode == VrShellDelegate.EXIT_VR_RESULT) {
- mVrShellDelegate.onExitVRResult(resultCode);
+ VrShellDelegate.onExitVRResult(resultCode);
return true;
}
return false;
@@ -1090,8 +1090,6 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
mUndoBarPopupController = new UndoBarController(this, mTabModelSelectorImpl,
getSnackbarManager());
-
- mVrShellDelegate = new VrShellDelegate(this);
}
@Override
@@ -1326,7 +1324,7 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
if (!currentModel.isIncognito()) currentModel.openMostRecentlyClosedTab();
RecordUserAction.record("MobileTabClosedUndoShortCut");
} else if (id == R.id.enter_vr_id) {
- mVrShellDelegate.enterVRIfNecessary();
+ VrShellDelegate.enterVRIfNecessary();
} else if (id == R.id.content_suggestions_standalone_ui) {
ContentSuggestionsActivity.launch(this);
} else {
@@ -1367,8 +1365,6 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
if (!mUIInitialized) return false;
final Tab currentTab = getActivityTab();
- if (mVrShellDelegate.onBackPressed()) return true;
-
if (currentTab == null) {
recordBackPressedUma("currentTab is null", BACK_PRESSED_TAB_IS_NULL);
moveTaskToBack(true);
@@ -1580,10 +1576,6 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
mUndoBarPopupController = null;
}
- if (mVrShellDelegate != null) {
- mVrShellDelegate.destroyVrShell();
- }
-
super.onDestroyInternal();
}
@@ -1788,11 +1780,16 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
setMergedInstanceTaskId(getTaskId());
}
- // TODO(mthiesse): Toggle toolbar overlay, popups, etc.
- public void setUIVisibilityForVR(int visibility) {
- mControlContainer.setVisibility(visibility);
- getCompositorViewHolder().getSurfaceView().setVisibility(visibility);
- getCompositorViewHolder().setVisibility(visibility);
+ @Override
+ public void onEnterVR() {
+ super.onEnterVR();
+ mControlContainer.setVisibility(View.INVISIBLE);
+ }
+
+ @Override
+ public void onExitVR() {
+ super.onExitVR();
+ mControlContainer.setVisibility(View.VISIBLE);
}
/**

Powered by Google App Engine
This is Rietveld 408576698