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

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

Issue 1880933002: Begin to enable extension APIs in Extension Service Worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @tott Created 4 years, 7 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/browser/extensions/chrome_extension_function.cc
diff --git a/chrome/browser/extensions/chrome_extension_function.cc b/chrome/browser/extensions/chrome_extension_function.cc
index ac164be3ab054865acd4fddfef30d0a99779870b..07c3006d98fb9fc4ef3dbebc71d3783fb0ab1e5a 100644
--- a/chrome/browser/extensions/chrome_extension_function.cc
+++ b/chrome/browser/extensions/chrome_extension_function.cc
@@ -48,13 +48,11 @@ Browser* ChromeUIThreadExtensionFunction::GetCurrentBrowser() {
// preferable to pretend no browser is open then to return a browser on
// another desktop.
content::WebContents* web_contents = GetSenderWebContents();
- if (web_contents) {
- Profile* profile =
- Profile::FromBrowserContext(web_contents->GetBrowserContext());
- Browser* browser = chrome::FindAnyBrowser(profile, include_incognito_);
- if (browser)
- return browser;
- }
+ Profile* profile = Profile::FromBrowserContext(
+ web_contents ? web_contents->GetBrowserContext() : browser_context());
+ Browser* browser = chrome::FindAnyBrowser(profile, include_incognito_);
+ if (browser)
+ return browser;
// NOTE(rafaelw): This can return NULL in some circumstances. In particular,
// a background_page onload chrome.tabs api call can make it into here

Powered by Google App Engine
This is Rietveld 408576698