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. |