Commit e0c9dcc2 authored by Pedro Amaral's avatar Pedro Amaral Committed by Commit Bot

Remove Back Button Dismisses Chrome

Pressing back button should only handle closing of the sheet and not
dismissing Chrome.

Bug: 814528
Change-Id: Iad2cafce82aa982b0645fb794a86b7a0e9d4ce36
Reviewed-on: https://chromium-review.googlesource.com/965275
Commit-Queue: Pedro Amaral <amaralp@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543843}
parent 2a7abddb
...@@ -38,7 +38,6 @@ import org.chromium.chrome.browser.compositor.layouts.LayoutManagerChrome; ...@@ -38,7 +38,6 @@ import org.chromium.chrome.browser.compositor.layouts.LayoutManagerChrome;
import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager;
import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager.FullscreenListener; import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager.FullscreenListener;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.toolbar.ActionModeController.ActionBarDelegate; import org.chromium.chrome.browser.toolbar.ActionModeController.ActionBarDelegate;
import org.chromium.chrome.browser.toolbar.ViewShiftingActionBarDelegate; import org.chromium.chrome.browser.toolbar.ViewShiftingActionBarDelegate;
...@@ -277,9 +276,6 @@ public class BottomSheet ...@@ -277,9 +276,6 @@ public class BottomSheet
/** A delegate for when the action bar starts showing. */ /** A delegate for when the action bar starts showing. */
private ViewShiftingActionBarDelegate mActionBarDelegate; private ViewShiftingActionBarDelegate mActionBarDelegate;
/** Whether or not the back button was used to enter the tab switcher. */
private boolean mBackButtonDismissesChrome;
/** Whether {@link #destroy()} has been called. **/ /** Whether {@link #destroy()} has been called. **/
private boolean mIsDestroyed; private boolean mIsDestroyed;
...@@ -461,24 +457,12 @@ public class BottomSheet ...@@ -461,24 +457,12 @@ public class BottomSheet
* @return True if the sheet handled the back press. * @return True if the sheet handled the back press.
*/ */
public boolean handleBackPress() { public boolean handleBackPress() {
Tab tab = getActiveTab(); if (isSheetOpen()) {
boolean consumeEvent = false;
if (!isSheetOpen() && tab != null && !tab.canGoBack() && !isInOverviewMode()
&& tab.getLaunchType() == TabLaunchType.FROM_CHROME_UI) {
mBackButtonDismissesChrome = true;
setSheetState(SHEET_STATE_HALF, true);
return true;
} else if (isSheetOpen() && !mBackButtonDismissesChrome) {
consumeEvent = true;
}
if (getSheetState() != SHEET_STATE_PEEK) {
setSheetState(SHEET_STATE_PEEK, true, StateChangeReason.BACK_PRESS); setSheetState(SHEET_STATE_PEEK, true, StateChangeReason.BACK_PRESS);
return true;
} }
return consumeEvent; return false;
} }
/** /**
...@@ -1029,7 +1013,6 @@ public class BottomSheet ...@@ -1029,7 +1013,6 @@ public class BottomSheet
private void onSheetClosed(@StateChangeReason int reason) { private void onSheetClosed(@StateChangeReason int reason) {
if (!mIsSheetOpen) return; if (!mIsSheetOpen) return;
mBottomSheetContentContainer.setVisibility(View.INVISIBLE); mBottomSheetContentContainer.setVisibility(View.INVISIBLE);
mBackButtonDismissesChrome = false;
mIsSheetOpen = false; mIsSheetOpen = false;
// Update the browser controls since they are permanently shown while the sheet is open. // Update the browser controls since they are permanently shown while the sheet is open.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment