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

Unified Diff: chrome/browser/extensions/extension_tab_util.cc

Issue 1239643004: extensions: tabs: set tab id to -1 for app/devtools windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 5 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
« no previous file with comments | « chrome/browser/extensions/extension_tab_util.h ('k') | chrome/common/extensions/api/tabs.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_tab_util.cc
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index 5d4b89b667faac9facefd526cd0de2a974db0499..08064d3e1fda51d7351addaab6278e1d06e8810e 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -315,6 +315,9 @@ int ExtensionTabUtil::GetWindowIdOfTabStripModel(
}
int ExtensionTabUtil::GetTabId(const WebContents* web_contents) {
+ Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
+ if (browser && !ExtensionTabUtil::BrowserSupportsTabs(browser))
+ return -1;
return SessionTabHelper::IdForTab(web_contents);
}
@@ -489,6 +492,8 @@ bool ExtensionTabUtil::GetTabById(int tab_id,
TabStripModel** tab_strip,
WebContents** contents,
int* tab_index) {
+ if (tab_id == api::tabs::TAB_ID_NONE)
+ return false;
Profile* profile = Profile::FromBrowserContext(browser_context);
Profile* incognito_profile =
include_incognito && profile->HasOffTheRecordProfile() ?
@@ -638,4 +643,9 @@ bool ExtensionTabUtil::OpenOptionsPage(const Extension* extension,
return true;
}
+// static
+bool ExtensionTabUtil::BrowserSupportsTabs(Browser* browser) {
+ return browser && browser->tab_strip_model() && !browser->is_devtools();
+}
+
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/extension_tab_util.h ('k') | chrome/common/extensions/api/tabs.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698