Commit 85552242 authored by ankit2.kumar's avatar ankit2.kumar Committed by Commit bot

Tab manager view should hide on press of back key

Currently when tab manager is shown and user presses back key
then instead of hiding tab manager page is navigated to previous
entry. If there is nothing to navigate then application is exited.
Added code to hide tab manager view if back key is pressed and tab
manager view is on.

BUG=

Review URL: https://codereview.chromium.org/689583002

Cr-Commit-Position: refs/heads/master@{#302222}
parent 1c9e1d8a
......@@ -204,13 +204,16 @@ public class ChromeShellActivity extends Activity implements AppMenuPropertiesDe
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mTabManager.isTabSwitcherVisible()) {
mTabManager.hideTabSwitcher();
return true;
}
ChromeShellTab tab = getActiveTab();
if (tab != null && tab.canGoBack()) {
tab.goBack();
return true;
}
}
return super.onKeyUp(keyCode, event);
}
......
......@@ -137,7 +137,7 @@ class ChromeShellTabModelSelector extends TabModelSelectorBase {
}
}
private boolean isTabSwitcherVisible() {
public boolean isTabSwitcherVisible() {
return mTabModelWrapper != null && mTabModelWrapper.getParent() == mParent;
}
}
......@@ -190,6 +190,14 @@ public class TabManager extends LinearLayout {
mTabModelSelector.toggleTabSwitcher();
}
public boolean isTabSwitcherVisible() {
return mTabModelSelector.isTabSwitcherVisible();
}
public void hideTabSwitcher() {
mTabModelSelector.hideTabSwitcher();
}
/**
* Opens a URL in the current tab if one exists, or in a new tab otherwise.
* @param url The URL to 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