summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-03 14:53:42 +0000
committerrdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-03 14:53:42 +0000
commite836d0ba4cffa196994a63a03e881e9d1518732a (patch)
tree188e3233360d2c0fa8cd2addba7317161b9831f5
parent9cd72d075be92d354ee1f801a22fbae06dcb22bf (diff)
downloadchromium_src-e836d0ba4cffa196994a63a03e881e9d1518732a.zip
chromium_src-e836d0ba4cffa196994a63a03e881e9d1518732a.tar.gz
chromium_src-e836d0ba4cffa196994a63a03e881e9d1518732a.tar.bz2
Remove ExtensionService::GetInstalledExtensionByUrl().
Replace with ExtensionRegistry::enabled_extensions().GetExtensionOrAppByUrl(). BUG=351891 Review URL: https://codereview.chromium.org/220053002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261389 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extension_service.cc8
-rw-r--r--chrome/browser/extensions/extension_service.h6
-rw-r--r--chrome/browser/extensions/tab_helper.cc26
3 files changed, 16 insertions, 24 deletions
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index adae9a5..e897e26 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -268,13 +268,9 @@ bool ExtensionService::OnExternalExtensionUpdateUrlFound(
return true;
}
-const Extension* ExtensionService::GetInstalledExtensionByUrl(
- const GURL& url) const {
- return registry_->enabled_extensions().GetExtensionOrAppByURL(url);
-}
-
const Extension* ExtensionService::GetInstalledApp(const GURL& url) const {
- const Extension* extension = GetInstalledExtensionByUrl(url);
+ const Extension* extension =
+ registry_->enabled_extensions().GetExtensionOrAppByURL(url);
return (extension && extension->is_app()) ? extension : NULL;
}
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index f968583..8dd4e29 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -131,12 +131,6 @@ class ExtensionService
public content::NotificationObserver,
public extensions::Blacklist::Observer {
public:
- // Returns the Extension for a given url or NULL if the url doesn't belong to
- // an installed extension. This may be a hosted app extent or a
- // chrome-extension:// url.
- const extensions::Extension* GetInstalledExtensionByUrl(
- const GURL& url) const;
-
// Returns the Extension of hosted or packaged apps, NULL otherwise.
const extensions::Extension* GetInstalledApp(const GURL& url) const;
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc
index 16eed18..402c89b 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) {