| OLD | NEW |
| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 import org.chromium.chrome.browser.tabmodel.TabModelSelector; | 124 import org.chromium.chrome.browser.tabmodel.TabModelSelector; |
| 125 import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; | 125 import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; |
| 126 import org.chromium.chrome.browser.tabmodel.TabModelUtils; | 126 import org.chromium.chrome.browser.tabmodel.TabModelUtils; |
| 127 import org.chromium.chrome.browser.tabmodel.TabWindowManager; | 127 import org.chromium.chrome.browser.tabmodel.TabWindowManager; |
| 128 import org.chromium.chrome.browser.toolbar.Toolbar; | 128 import org.chromium.chrome.browser.toolbar.Toolbar; |
| 129 import org.chromium.chrome.browser.toolbar.ToolbarControlContainer; | 129 import org.chromium.chrome.browser.toolbar.ToolbarControlContainer; |
| 130 import org.chromium.chrome.browser.toolbar.ToolbarManager; | 130 import org.chromium.chrome.browser.toolbar.ToolbarManager; |
| 131 import org.chromium.chrome.browser.util.ChromeFileProvider; | 131 import org.chromium.chrome.browser.util.ChromeFileProvider; |
| 132 import org.chromium.chrome.browser.util.ColorUtils; | 132 import org.chromium.chrome.browser.util.ColorUtils; |
| 133 import org.chromium.chrome.browser.util.FeatureUtilities; | 133 import org.chromium.chrome.browser.util.FeatureUtilities; |
| 134 import org.chromium.chrome.browser.vr_shell.VrShellDelegate; |
| 134 import org.chromium.chrome.browser.webapps.AddToHomescreenManager; | 135 import org.chromium.chrome.browser.webapps.AddToHomescreenManager; |
| 135 import org.chromium.chrome.browser.widget.BottomSheet; | 136 import org.chromium.chrome.browser.widget.BottomSheet; |
| 136 import org.chromium.chrome.browser.widget.ControlContainer; | 137 import org.chromium.chrome.browser.widget.ControlContainer; |
| 137 import org.chromium.chrome.browser.widget.EmptyBottomSheetObserver; | 138 import org.chromium.chrome.browser.widget.EmptyBottomSheetObserver; |
| 138 import org.chromium.chrome.browser.widget.FadingBackgroundView; | 139 import org.chromium.chrome.browser.widget.FadingBackgroundView; |
| 139 import org.chromium.components.bookmarks.BookmarkId; | 140 import org.chromium.components.bookmarks.BookmarkId; |
| 140 import org.chromium.content.browser.ContentVideoView; | 141 import org.chromium.content.browser.ContentVideoView; |
| 141 import org.chromium.content.browser.ContentViewCore; | 142 import org.chromium.content.browser.ContentViewCore; |
| 142 import org.chromium.content.common.ContentSwitches; | 143 import org.chromium.content.common.ContentSwitches; |
| 143 import org.chromium.content_public.browser.ContentBitmapCallback; | 144 import org.chromium.content_public.browser.ContentBitmapCallback; |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 MultiWindowUtils.getInstance().isInMultiWindowMode(this)); | 813 MultiWindowUtils.getInstance().isInMultiWindowMode(this)); |
| 813 } | 814 } |
| 814 | 815 |
| 815 @Override | 816 @Override |
| 816 public void onPauseWithNative() { | 817 public void onPauseWithNative() { |
| 817 RecordUserAction.record("MobileGoToBackground"); | 818 RecordUserAction.record("MobileGoToBackground"); |
| 818 Tab tab = getActivityTab(); | 819 Tab tab = getActivityTab(); |
| 819 if (tab != null) { | 820 if (tab != null) { |
| 820 getTabContentManager().cacheTabThumbnail(tab); | 821 getTabContentManager().cacheTabThumbnail(tab); |
| 821 } | 822 } |
| 823 VrShellDelegate.maybePauseVR(this); |
| 822 markSessionEnd(); | 824 markSessionEnd(); |
| 823 super.onPauseWithNative(); | 825 super.onPauseWithNative(); |
| 824 } | 826 } |
| 825 | 827 |
| 826 @Override | 828 @Override |
| 827 public void onStopWithNative() { | 829 public void onStopWithNative() { |
| 828 Tab tab = getActivityTab(); | 830 Tab tab = getActivityTab(); |
| 829 if (tab != null && !hasWindowFocus()) tab.onActivityHidden(); | 831 if (tab != null && !hasWindowFocus()) tab.onActivityHidden(); |
| 830 if (mAppMenuHandler != null) mAppMenuHandler.hideAppMenu(); | 832 if (mAppMenuHandler != null) mAppMenuHandler.hideAppMenu(); |
| 831 | 833 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 mRemoveWindowBackgroundDone = true; | 1144 mRemoveWindowBackgroundDone = true; |
| 1143 } | 1145 } |
| 1144 | 1146 |
| 1145 @Override | 1147 @Override |
| 1146 public void finishNativeInitialization() { | 1148 public void finishNativeInitialization() { |
| 1147 mNativeInitialized = true; | 1149 mNativeInitialized = true; |
| 1148 maybeRemoveWindowBackground(); | 1150 maybeRemoveWindowBackground(); |
| 1149 DownloadManagerService.getDownloadManagerService( | 1151 DownloadManagerService.getDownloadManagerService( |
| 1150 getApplicationContext()).onActivityLaunched(); | 1152 getApplicationContext()).onActivityLaunched(); |
| 1151 | 1153 |
| 1154 VrShellDelegate.onNativeLibraryAvailable(); |
| 1152 super.finishNativeInitialization(); | 1155 super.finishNativeInitialization(); |
| 1153 } | 1156 } |
| 1154 | 1157 |
| 1155 /** | 1158 /** |
| 1156 * Called when the accessibility status of this device changes. This might
be triggered by | 1159 * Called when the accessibility status of this device changes. This might
be triggered by |
| 1157 * touch exploration or general accessibility status updates. It is an aggr
egate of two other | 1160 * touch exploration or general accessibility status updates. It is an aggr
egate of two other |
| 1158 * accessibility update methods. | 1161 * accessibility update methods. |
| 1159 * @see #onAccessibilityModeChanged(boolean) | 1162 * @see #onAccessibilityModeChanged(boolean) |
| 1160 * @see #onTouchExplorationStateChanged(boolean) | 1163 * @see #onTouchExplorationStateChanged(boolean) |
| 1161 * @param enabled Whether or not accessibility and touch exploration are cur
rently enabled. | 1164 * @param enabled Whether or not accessibility and touch exploration are cur
rently enabled. |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 if (isInMultiWindowMode) { | 1674 if (isInMultiWindowMode) { |
| 1672 RecordUserAction.record("Android.MultiWindowMode.Enter"); | 1675 RecordUserAction.record("Android.MultiWindowMode.Enter"); |
| 1673 } else { | 1676 } else { |
| 1674 RecordUserAction.record("Android.MultiWindowMode.Exit"); | 1677 RecordUserAction.record("Android.MultiWindowMode.Exit"); |
| 1675 } | 1678 } |
| 1676 } | 1679 } |
| 1677 | 1680 |
| 1678 @Override | 1681 @Override |
| 1679 public final void onBackPressed() { | 1682 public final void onBackPressed() { |
| 1680 RecordUserAction.record("SystemBack"); | 1683 RecordUserAction.record("SystemBack"); |
| 1684 if (VrShellDelegate.onBackPressed()) return; |
| 1681 if (mCompositorViewHolder != null) { | 1685 if (mCompositorViewHolder != null) { |
| 1682 LayoutManager layoutManager = mCompositorViewHolder.getLayoutManager
(); | 1686 LayoutManager layoutManager = mCompositorViewHolder.getLayoutManager
(); |
| 1683 if (layoutManager != null && layoutManager.onBackPressed()) return; | 1687 if (layoutManager != null && layoutManager.onBackPressed()) return; |
| 1684 } | 1688 } |
| 1685 | 1689 |
| 1686 ContentViewCore contentViewCore = getContentViewCore(); | 1690 ContentViewCore contentViewCore = getContentViewCore(); |
| 1687 if (contentViewCore != null && contentViewCore.isSelectActionBarShowing(
)) { | 1691 if (contentViewCore != null && contentViewCore.isSelectActionBarShowing(
)) { |
| 1688 contentViewCore.clearSelection(); | 1692 contentViewCore.clearSelection(); |
| 1689 return; | 1693 return; |
| 1690 } | 1694 } |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 RecordHistogram.recordBooleanHistogram( | 2085 RecordHistogram.recordBooleanHistogram( |
| 2082 "Android.MultiWindowMode.IsTabletScreenWidthBelow600", | 2086 "Android.MultiWindowMode.IsTabletScreenWidthBelow600", |
| 2083 mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP); | 2087 mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP); |
| 2084 | 2088 |
| 2085 if (mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) { | 2089 if (mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) { |
| 2086 RecordHistogram.recordLinearCountHistogram( | 2090 RecordHistogram.recordLinearCountHistogram( |
| 2087 "Android.MultiWindowMode.TabletScreenWidth", mScreenWidthDp,
1, | 2091 "Android.MultiWindowMode.TabletScreenWidth", mScreenWidthDp,
1, |
| 2088 DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP, 50); | 2092 DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP, 50); |
| 2089 } | 2093 } |
| 2090 } | 2094 } |
| 2095 |
| 2096 /** |
| 2097 * Called when VR mode is entered using this activity. 2D UI components that
steal focus or |
| 2098 * draw over VR contents should be hidden in this call. |
| 2099 */ |
| 2100 public void onEnterVR() {} |
| 2101 |
| 2102 /** |
| 2103 * Called when VR mode using this activity is exited. Any state set for VR s
hould be restored |
| 2104 * in this call, including showing 2D UI that was hidden. |
| 2105 */ |
| 2106 public void onExitVR() {} |
| 2091 } | 2107 } |
| OLD | NEW |