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); |