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

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

Issue 969443003: [Document mode] Keep tab ID list in sync with Tab entries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Deprecated Created 5 years, 10 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/document/DocumentTabModelImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/DocumentTabModelImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/DocumentTabModelImpl.java
index 2eda8704683e4a833224a8ae9bf4d822df48d4ff..1d70e461ae703d91f7cad3d9cb14f57883084151 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/DocumentTabModelImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/DocumentTabModelImpl.java
@@ -266,7 +266,7 @@ public class DocumentTabModelImpl extends TabModelJniBridge implements DocumentT
// Try to create a Tab that will hold the Tab's info.
Entry entry = mEntryMap.get(tabId);
- if (entry == null) return null;
+ assert entry != null;
// If a tab has already been initialized, use that.
if (entry.placeholderTab != null && entry.placeholderTab.isInitialized()) {
@@ -351,6 +351,7 @@ public class DocumentTabModelImpl extends TabModelJniBridge implements DocumentT
* @param tabId ID to add.
*/
private void addTabId(int index, int tabId) {
+ assert tabId != Tab.INVALID_TAB_ID;
if (mTabIdList.contains(tabId)) return;
mTabIdList.add(index, tabId);
}
@@ -430,7 +431,7 @@ public class DocumentTabModelImpl extends TabModelJniBridge implements DocumentT
@Override
public void updateEntry(Intent intent, Tab tab) {
- if (!mActivityDelegate.isValidActivity(isIncognito(), intent)) return;
+ assert mActivityDelegate.isValidActivity(isIncognito(), intent);
int id = ActivityDelegate.getTabIdFromIntent(intent);
if (id == Tab.INVALID_TAB_ID) return;
@@ -870,6 +871,14 @@ public class DocumentTabModelImpl extends TabModelJniBridge implements DocumentT
}
@Override
+ public void addTab(Intent intent, Tab tab) {
+ int parentIndex = indexOf(tab.getParentId());
+ int index = parentIndex == -1 ? getCount() : parentIndex + 1;
+ addTab(tab, index, tab.getLaunchType());
+ updateEntry(intent, tab);
+ }
+
+ @Override
public void addTab(Tab tab, int index, TabLaunchType type) {
for (TabModelObserver obs : mObservers) obs.willAddTab(tab, type);

Powered by Google App Engine
This is Rietveld 408576698