Index: chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabWindowManager.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabWindowManager.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabWindowManager.java |
index 7ee032e0908ed2d9faf1f9eae37f4cdc5f183e4b..131f71c3ed9db47150f4d5e1f010dbc57fae7f62 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabWindowManager.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabWindowManager.java |
@@ -158,19 +158,27 @@ public class TabWindowManager implements ActivityStateListener { |
* @return Whether the given tab exists in any currently loaded selector. |
*/ |
public boolean tabExistsInAnySelector(int tabId) { |
+ return getTabById(tabId) != null; |
+ } |
+ |
+ /** |
+ * @param tabId The ID of the tab in question. |
+ * @return Specified {@link Tab} or {@code null} if the {@link Tab} is not found. |
+ */ |
+ public Tab getTabById(int tabId) { |
for (int i = 0; i < mSelectors.size(); i++) { |
TabModelSelector selector = mSelectors.get(i); |
if (selector != null) { |
- if (TabModelUtils.getTabById(selector.getModel(false), tabId) != null |
- || TabModelUtils.getTabById(selector.getModel(true), tabId) != null) { |
- return true; |
- } |
+ final Tab tab = selector.getTabById(tabId); |
+ if (tab != null) return tab; |
} |
} |
- // Account for tabs that were recently reparented and haven't been attached to new |
- // activities yet. |
- return AsyncTabParamsManager.hasParamsForTabId(tabId); |
+ if (AsyncTabParamsManager.hasParamsForTabId(tabId)) { |
+ return AsyncTabParamsManager.getAsyncTabParams().get(tabId).getTabToReparent(); |
+ } |
+ |
+ return null; |
} |
@Override |