/** * Creates a new tab and posts to UI. * * @param loadUrlParams parameters of the url load. * @param type Information about how the tab was launched. * @param parent the parent tab, if present. * @param intent the source of the url if it isn't null. * @return The new tab. */ public ChromeTab createNewTab( LoadUrlParams loadUrlParams, TabModel.TabLaunchType type, Tab parent, Intent intent) { // If parent is in the same tab model, place the new tab next to it. int index = mTabModel.indexOf(parent); if (index != TabModel.INVALID_TAB_INDEX) { return createNewTab(loadUrlParams, type, parent, index + 1, intent); } return createNewTab(loadUrlParams, type, parent, TabModel.INVALID_TAB_INDEX, intent); }
@Override public boolean closeTab(Tab tab) { for (int i = 0; i < getModels().size(); i++) { TabModel model = getModelAt(i); if (model.indexOf(tab) >= 0) { return model.closeTab(tab); } } assert false : "Tried to close a tab that is not in any model!"; return false; }