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

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

Issue 2727873002: Implement lazy initialization for VrShellDelegate (Closed)
Patch Set: Address comments + Fix shutdown crash Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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; 5 package org.chromium.chrome.browser;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.annotation.TargetApi; 8 import android.annotation.TargetApi;
9 import android.app.Activity; 9 import android.app.Activity;
10 import android.app.SearchManager; 10 import android.app.SearchManager;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 import org.chromium.chrome.browser.tabmodel.TabModelSelector; 121 import org.chromium.chrome.browser.tabmodel.TabModelSelector;
122 import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; 122 import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver;
123 import org.chromium.chrome.browser.tabmodel.TabModelUtils; 123 import org.chromium.chrome.browser.tabmodel.TabModelUtils;
124 import org.chromium.chrome.browser.tabmodel.TabWindowManager; 124 import org.chromium.chrome.browser.tabmodel.TabWindowManager;
125 import org.chromium.chrome.browser.toolbar.Toolbar; 125 import org.chromium.chrome.browser.toolbar.Toolbar;
126 import org.chromium.chrome.browser.toolbar.ToolbarControlContainer; 126 import org.chromium.chrome.browser.toolbar.ToolbarControlContainer;
127 import org.chromium.chrome.browser.toolbar.ToolbarManager; 127 import org.chromium.chrome.browser.toolbar.ToolbarManager;
128 import org.chromium.chrome.browser.util.ChromeFileProvider; 128 import org.chromium.chrome.browser.util.ChromeFileProvider;
129 import org.chromium.chrome.browser.util.ColorUtils; 129 import org.chromium.chrome.browser.util.ColorUtils;
130 import org.chromium.chrome.browser.util.FeatureUtilities; 130 import org.chromium.chrome.browser.util.FeatureUtilities;
131 import org.chromium.chrome.browser.vr_shell.VrShellDelegate;
131 import org.chromium.chrome.browser.webapps.AddToHomescreenManager; 132 import org.chromium.chrome.browser.webapps.AddToHomescreenManager;
132 import org.chromium.chrome.browser.widget.BottomSheet; 133 import org.chromium.chrome.browser.widget.BottomSheet;
133 import org.chromium.chrome.browser.widget.ControlContainer; 134 import org.chromium.chrome.browser.widget.ControlContainer;
134 import org.chromium.chrome.browser.widget.FadingBackgroundView; 135 import org.chromium.chrome.browser.widget.FadingBackgroundView;
135 import org.chromium.components.bookmarks.BookmarkId; 136 import org.chromium.components.bookmarks.BookmarkId;
136 import org.chromium.content.browser.ContentVideoView; 137 import org.chromium.content.browser.ContentVideoView;
137 import org.chromium.content.browser.ContentViewCore; 138 import org.chromium.content.browser.ContentViewCore;
138 import org.chromium.content.common.ContentSwitches; 139 import org.chromium.content.common.ContentSwitches;
139 import org.chromium.content_public.browser.ContentBitmapCallback; 140 import org.chromium.content_public.browser.ContentBitmapCallback;
140 import org.chromium.content_public.browser.LoadUrlParams; 141 import org.chromium.content_public.browser.LoadUrlParams;
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 MultiWindowUtils.getInstance().isInMultiWindowMode(this)); 787 MultiWindowUtils.getInstance().isInMultiWindowMode(this));
787 } 788 }
788 789
789 @Override 790 @Override
790 public void onPauseWithNative() { 791 public void onPauseWithNative() {
791 RecordUserAction.record("MobileGoToBackground"); 792 RecordUserAction.record("MobileGoToBackground");
792 Tab tab = getActivityTab(); 793 Tab tab = getActivityTab();
793 if (tab != null) { 794 if (tab != null) {
794 getTabContentManager().cacheTabThumbnail(tab); 795 getTabContentManager().cacheTabThumbnail(tab);
795 } 796 }
797 VrShellDelegate.maybePauseVR(this);
796 markSessionEnd(); 798 markSessionEnd();
797 super.onPauseWithNative(); 799 super.onPauseWithNative();
798 } 800 }
799 801
800 @Override 802 @Override
801 public void onStopWithNative() { 803 public void onStopWithNative() {
802 Tab tab = getActivityTab(); 804 Tab tab = getActivityTab();
803 if (tab != null && !hasWindowFocus()) tab.onActivityHidden(); 805 if (tab != null && !hasWindowFocus()) tab.onActivityHidden();
804 if (mAppMenuHandler != null) mAppMenuHandler.hideAppMenu(); 806 if (mAppMenuHandler != null) mAppMenuHandler.hideAppMenu();
805 807
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 mRemoveWindowBackgroundDone = true; 1111 mRemoveWindowBackgroundDone = true;
1110 } 1112 }
1111 1113
1112 @Override 1114 @Override
1113 public void finishNativeInitialization() { 1115 public void finishNativeInitialization() {
1114 mNativeInitialized = true; 1116 mNativeInitialized = true;
1115 maybeRemoveWindowBackground(); 1117 maybeRemoveWindowBackground();
1116 DownloadManagerService.getDownloadManagerService( 1118 DownloadManagerService.getDownloadManagerService(
1117 getApplicationContext()).onActivityLaunched(); 1119 getApplicationContext()).onActivityLaunched();
1118 1120
1121 VrShellDelegate.onNativeLibraryAvailable();
1119 super.finishNativeInitialization(); 1122 super.finishNativeInitialization();
1120 } 1123 }
1121 1124
1122 /** 1125 /**
1123 * Called when the accessibility status of this device changes. This might be triggered by 1126 * Called when the accessibility status of this device changes. This might be triggered by
1124 * touch exploration or general accessibility status updates. It is an aggr egate of two other 1127 * touch exploration or general accessibility status updates. It is an aggr egate of two other
1125 * accessibility update methods. 1128 * accessibility update methods.
1126 * @see #onAccessibilityModeChanged(boolean) 1129 * @see #onAccessibilityModeChanged(boolean)
1127 * @see #onTouchExplorationStateChanged(boolean) 1130 * @see #onTouchExplorationStateChanged(boolean)
1128 * @param enabled Whether or not accessibility and touch exploration are cur rently enabled. 1131 * @param enabled Whether or not accessibility and touch exploration are cur rently enabled.
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 if (isInMultiWindowMode) { 1634 if (isInMultiWindowMode) {
1632 RecordUserAction.record("Android.MultiWindowMode.Enter"); 1635 RecordUserAction.record("Android.MultiWindowMode.Enter");
1633 } else { 1636 } else {
1634 RecordUserAction.record("Android.MultiWindowMode.Exit"); 1637 RecordUserAction.record("Android.MultiWindowMode.Exit");
1635 } 1638 }
1636 } 1639 }
1637 1640
1638 @Override 1641 @Override
1639 public final void onBackPressed() { 1642 public final void onBackPressed() {
1640 RecordUserAction.record("SystemBack"); 1643 RecordUserAction.record("SystemBack");
1644 if (VrShellDelegate.onBackPressed()) return;
1641 if (mCompositorViewHolder != null) { 1645 if (mCompositorViewHolder != null) {
1642 LayoutManager layoutManager = mCompositorViewHolder.getLayoutManager (); 1646 LayoutManager layoutManager = mCompositorViewHolder.getLayoutManager ();
1643 if (layoutManager != null && layoutManager.onBackPressed()) return; 1647 if (layoutManager != null && layoutManager.onBackPressed()) return;
1644 } 1648 }
1645 1649
1646 ContentViewCore contentViewCore = getContentViewCore(); 1650 ContentViewCore contentViewCore = getContentViewCore();
1647 if (contentViewCore != null && contentViewCore.isSelectActionBarShowing( )) { 1651 if (contentViewCore != null && contentViewCore.isSelectActionBarShowing( )) {
1648 contentViewCore.clearSelection(); 1652 contentViewCore.clearSelection();
1649 return; 1653 return;
1650 } 1654 }
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 RecordHistogram.recordBooleanHistogram( 2023 RecordHistogram.recordBooleanHistogram(
2020 "Android.MultiWindowMode.IsTabletScreenWidthBelow600", 2024 "Android.MultiWindowMode.IsTabletScreenWidthBelow600",
2021 mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP); 2025 mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP);
2022 2026
2023 if (mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) { 2027 if (mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) {
2024 RecordHistogram.recordLinearCountHistogram( 2028 RecordHistogram.recordLinearCountHistogram(
2025 "Android.MultiWindowMode.TabletScreenWidth", mScreenWidthDp, 1, 2029 "Android.MultiWindowMode.TabletScreenWidth", mScreenWidthDp, 1,
2026 DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP, 50); 2030 DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP, 50);
2027 } 2031 }
2028 } 2032 }
2033
2034 public void onEnterVR() {}
Ted C 2017/03/02 21:29:31 we try to javadoc all public methods. some genera
mthiesse 2017/03/02 22:11:47 Done.
2035 public void onExitVR() {}
2029 } 2036 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698