| 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.ActivityManager; | 10 import android.app.ActivityManager; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 import org.chromium.chrome.browser.tabmodel.TabModelSelectorImpl; | 107 import org.chromium.chrome.browser.tabmodel.TabModelSelectorImpl; |
| 108 import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabModelObserver; | 108 import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabModelObserver; |
| 109 import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; | 109 import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; |
| 110 import org.chromium.chrome.browser.tabmodel.TabModelUtils; | 110 import org.chromium.chrome.browser.tabmodel.TabModelUtils; |
| 111 import org.chromium.chrome.browser.tabmodel.TabWindowManager; | 111 import org.chromium.chrome.browser.tabmodel.TabWindowManager; |
| 112 import org.chromium.chrome.browser.toolbar.ToolbarControlContainer; | 112 import org.chromium.chrome.browser.toolbar.ToolbarControlContainer; |
| 113 import org.chromium.chrome.browser.util.FeatureUtilities; | 113 import org.chromium.chrome.browser.util.FeatureUtilities; |
| 114 import org.chromium.chrome.browser.util.IntentUtils; | 114 import org.chromium.chrome.browser.util.IntentUtils; |
| 115 import org.chromium.chrome.browser.vr_shell.VrShellDelegate; | 115 import org.chromium.chrome.browser.vr_shell.VrShellDelegate; |
| 116 import org.chromium.chrome.browser.webapps.ChromeWebApkHost; | 116 import org.chromium.chrome.browser.webapps.ChromeWebApkHost; |
| 117 import org.chromium.chrome.browser.widget.BottomSheet; |
| 117 import org.chromium.chrome.browser.widget.emptybackground.EmptyBackgroundViewWra
pper; | 118 import org.chromium.chrome.browser.widget.emptybackground.EmptyBackgroundViewWra
pper; |
| 118 import org.chromium.chrome.browser.widget.findinpage.FindToolbarManager; | 119 import org.chromium.chrome.browser.widget.findinpage.FindToolbarManager; |
| 119 import org.chromium.content.browser.ContentVideoView; | 120 import org.chromium.content.browser.ContentVideoView; |
| 120 import org.chromium.content.browser.ContentViewCore; | 121 import org.chromium.content.browser.ContentViewCore; |
| 121 import org.chromium.content.browser.crypto.CipherFactory; | 122 import org.chromium.content.browser.crypto.CipherFactory; |
| 122 import org.chromium.content.common.ContentSwitches; | 123 import org.chromium.content.common.ContentSwitches; |
| 123 import org.chromium.content_public.browser.LoadUrlParams; | 124 import org.chromium.content_public.browser.LoadUrlParams; |
| 124 import org.chromium.content_public.common.Referrer; | 125 import org.chromium.content_public.common.Referrer; |
| 125 import org.chromium.ui.base.DeviceFormFactor; | 126 import org.chromium.ui.base.DeviceFormFactor; |
| 126 import org.chromium.ui.base.PageTransition; | 127 import org.chromium.ui.base.PageTransition; |
| (...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 recordBackPressedUma("Hid overview", BACK_PRESSED_EXITED_TAB_SWITCHE
R); | 1364 recordBackPressedUma("Hid overview", BACK_PRESSED_EXITED_TAB_SWITCHE
R); |
| 1364 mLayoutManager.hideOverview(true); | 1365 mLayoutManager.hideOverview(true); |
| 1365 return true; | 1366 return true; |
| 1366 } | 1367 } |
| 1367 | 1368 |
| 1368 if (exitFullscreenIfShowing()) { | 1369 if (exitFullscreenIfShowing()) { |
| 1369 recordBackPressedUma("Exited fullscreen", BACK_PRESSED_EXITED_FULLSC
REEN); | 1370 recordBackPressedUma("Exited fullscreen", BACK_PRESSED_EXITED_FULLSC
REEN); |
| 1370 return true; | 1371 return true; |
| 1371 } | 1372 } |
| 1372 | 1373 |
| 1374 // Close the bottom sheet before trying to navigate back. |
| 1375 if (getBottomSheet() != null |
| 1376 && getBottomSheet().getSheetState() != BottomSheet.SHEET_STATE_P
EEK) { |
| 1377 getBottomSheet().setSheetState(BottomSheet.SHEET_STATE_PEEK, true); |
| 1378 return true; |
| 1379 } |
| 1380 |
| 1373 if (getToolbarManager().back()) { | 1381 if (getToolbarManager().back()) { |
| 1374 recordBackPressedUma("Navigating backward", BACK_PRESSED_NAVIGATED_B
ACK); | 1382 recordBackPressedUma("Navigating backward", BACK_PRESSED_NAVIGATED_B
ACK); |
| 1375 RecordUserAction.record("MobileTabClobbered"); | 1383 RecordUserAction.record("MobileTabClobbered"); |
| 1376 return true; | 1384 return true; |
| 1377 } | 1385 } |
| 1378 | 1386 |
| 1379 // If the current tab url is HELP_URL, then the back button should close
the tab to | 1387 // If the current tab url is HELP_URL, then the back button should close
the tab to |
| 1380 // get back to the previous state. The reason for startsWith check is th
at the | 1388 // get back to the previous state. The reason for startsWith check is th
at the |
| 1381 // actual redirected URL is a different system language based help url. | 1389 // actual redirected URL is a different system language based help url. |
| 1382 final TabLaunchType type = currentTab.getLaunchType(); | 1390 final TabLaunchType type = currentTab.getLaunchType(); |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1819 | 1827 |
| 1820 ActivityManager manager = (ActivityManager) getSystemService(Context.ACT
IVITY_SERVICE); | 1828 ActivityManager manager = (ActivityManager) getSystemService(Context.ACT
IVITY_SERVICE); |
| 1821 for (AppTask task : manager.getAppTasks()) { | 1829 for (AppTask task : manager.getAppTasks()) { |
| 1822 RecentTaskInfo info = DocumentUtils.getTaskInfoFromTask(task); | 1830 RecentTaskInfo info = DocumentUtils.getTaskInfoFromTask(task); |
| 1823 if (info == null) continue; | 1831 if (info == null) continue; |
| 1824 if (info.id == sMergedInstanceTaskId) return true; | 1832 if (info.id == sMergedInstanceTaskId) return true; |
| 1825 } | 1833 } |
| 1826 return false; | 1834 return false; |
| 1827 } | 1835 } |
| 1828 } | 1836 } |
| OLD | NEW |