/** Close a blank tab just opened for the download purpose. */ private void closeBlankTab() { WebContents contents = mTab.getWebContents(); boolean isInitialNavigation = contents == null || contents.getNavigationController().isInitialNavigation(); if (isInitialNavigation) { // Tab is created just for download, close it. mTabModelSelector.closeTab(mTab); } }
/** * Close a blank tab just opened for the download purpose. * * @return true iff the tab was (already) closed. */ private boolean closeBlankTab() { if (mTab == null) { // We do not want caller to dismiss infobar. return true; } WebContents contents = mTab.getWebContents(); boolean isInitialNavigation = contents == null || contents.getNavigationController().isInitialNavigation(); if (isInitialNavigation) { // Tab is created just for download, close it. return mTabModelSelector.closeTab(mTab); } return false; }