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

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

Issue 220053002: Remove ExtensionService::GetInstalledExtensionByUrl(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 6 years, 9 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_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/tab_helper.cc
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc
index 16eed180460110d309c2a45380ad0dca1b717e1a..402c89b0af726209df0fa568dcec41ad1efffed9 100644
--- a/chrome/browser/extensions/tab_helper.cc
+++ b/chrome/browser/extensions/tab_helper.cc
@@ -243,34 +243,36 @@ void TabHelper::DidNavigateMainFrame(
}
#endif // defined(ENABLE_EXTENSIONS)
- Profile* profile =
- Profile::FromBrowserContext(web_contents()->GetBrowserContext());
- ExtensionService* service = profile->GetExtensionService();
- if (!service)
- return;
+ content::BrowserContext* context = web_contents()->GetBrowserContext();
+ ExtensionRegistry* registry = ExtensionRegistry::Get(context);
+ const ExtensionSet& enabled_extensions = registry->enabled_extensions();
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableStreamlinedHostedApps)) {
#if !defined(OS_ANDROID)
Browser* browser = chrome::FindBrowserWithWebContents(web_contents());
if (browser && browser->is_app()) {
- SetExtensionApp(service->GetInstalledExtension(
- web_app::GetExtensionIdFromApplicationName(browser->app_name())));
+ SetExtensionApp(registry->GetExtensionById(
+ web_app::GetExtensionIdFromApplicationName(browser->app_name()),
+ ExtensionRegistry::EVERYTHING));
} else {
- UpdateExtensionAppIcon(service->GetInstalledExtensionByUrl(params.url));
+ UpdateExtensionAppIcon(
+ enabled_extensions.GetExtensionOrAppByURL(params.url));
}
#endif
} else {
- UpdateExtensionAppIcon(service->GetInstalledExtensionByUrl(params.url));
+ UpdateExtensionAppIcon(
+ enabled_extensions.GetExtensionOrAppByURL(params.url));
}
if (details.is_in_page)
return;
ExtensionActionManager* extension_action_manager =
- ExtensionActionManager::Get(profile);
- for (ExtensionSet::const_iterator it = service->extensions()->begin();
- it != service->extensions()->end(); ++it) {
+ ExtensionActionManager::Get(Profile::FromBrowserContext(context));
+ for (ExtensionSet::const_iterator it = enabled_extensions.begin();
+ it != enabled_extensions.end();
+ ++it) {
ExtensionAction* browser_action =
extension_action_manager->GetBrowserAction(*it->get());
if (browser_action) {
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698