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

Unified Diff: chrome/android/shell/java/src/org/chromium/chrome/shell/TabManager.java

Issue 738693002: Opening new "about:blank" tab if all tabs are closed in tab switcher mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/shell/java/src/org/chromium/chrome/shell/TabManager.java
diff --git a/chrome/android/shell/java/src/org/chromium/chrome/shell/TabManager.java b/chrome/android/shell/java/src/org/chromium/chrome/shell/TabManager.java
index 36261cc03b48cde3361d813bbba1723c9ce3fe37..964304be00d3e93c77f0dcc68a77de4569304cc9 100644
--- a/chrome/android/shell/java/src/org/chromium/chrome/shell/TabManager.java
+++ b/chrome/android/shell/java/src/org/chromium/chrome/shell/TabManager.java
@@ -14,6 +14,7 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
+import org.chromium.base.VisibleForTesting;
import org.chromium.chrome.browser.EmptyTabObserver;
import org.chromium.chrome.browser.Tab;
import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver;
@@ -57,6 +58,9 @@ public class TabManager extends LinearLayout {
@Override
public void willCloseTab(Tab tab, boolean animate) {
if (tab == mCurrentTab) setCurrentTab(null);
+ if (mTabModelSelector.getCurrentModel().getCount() == 1) {
+ createNewTab();
+ }
}
};
@@ -144,6 +148,11 @@ public class TabManager extends LinearLayout {
mTabModelSelector.getCurrentModel().closeAllTabs();
}
+ @VisibleForTesting
+ public void closeTab() {
+ mTabModelSelector.getCurrentModel().closeTab(mCurrentTab);
+ }
+
/**
* Creates a {@link ChromeShellTab} with a URL specified by {@code url}.
* @param url The URL the new {@link ChromeShellTab} should start with.
« no previous file with comments | « chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698