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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabWindowManager.java

Issue 2123863004: ScreenCapture for Android phase1, part II (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 3 months 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
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

Powered by Google App Engine
This is Rietveld 408576698