diff options
author | kmarshall <kmarshall@chromium.org> | 2015-04-03 15:29:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-03 22:30:28 +0000 |
commit | 166e5b457da60fa11992b2e7efe3444f3875a465 (patch) | |
tree | 3ab1a5101b8d4ceaf2554c888c4a6fa3e1768eea /extensions/browser/mojo | |
parent | d9c7f49d8d037e4a5df1793897b6274bb2cbfc90 (diff) | |
download | chromium_src-166e5b457da60fa11992b2e7efe3444f3875a465.zip chromium_src-166e5b457da60fa11992b2e7efe3444f3875a465.tar.gz chromium_src-166e5b457da60fa11992b2e7efe3444f3875a465.tar.bz2 |
Add service registration for Mojo services defined under chrome/
to chrome_web_contents_observer.
Add RegisterMojoServices virtual method to
extension_web_contents_observer.
BUG=
Review URL: https://codereview.chromium.org/1035263002
Cr-Commit-Position: refs/heads/master@{#323836}
Diffstat (limited to 'extensions/browser/mojo')
-rw-r--r-- | extensions/browser/mojo/service_registration.cc | 26 | ||||
-rw-r--r-- | extensions/browser/mojo/service_registration.h | 5 |
2 files changed, 7 insertions, 24 deletions
diff --git a/extensions/browser/mojo/service_registration.cc b/extensions/browser/mojo/service_registration.cc index 6b1c3d8..c3884ac 100644 --- a/extensions/browser/mojo/service_registration.cc +++ b/extensions/browser/mojo/service_registration.cc @@ -24,24 +24,6 @@ namespace extensions { namespace { -const Extension* GetExtension(content::RenderFrameHost* render_frame_host) { - content::SiteInstance* site_instance = render_frame_host->GetSiteInstance(); - GURL url = render_frame_host->GetLastCommittedURL(); - if (!url.is_empty()) { - if (site_instance->GetSiteURL().GetOrigin() != url.GetOrigin()) - return nullptr; - } else { - url = site_instance->GetSiteURL(); - } - content::BrowserContext* browser_context = site_instance->GetBrowserContext(); - if (!url.SchemeIs(kExtensionScheme)) - return nullptr; - - return ExtensionRegistry::Get(browser_context) - ->enabled_extensions() - .GetExtensionOrAppByURL(url); -} - bool ExtensionHasPermission(const Extension* extension, content::RenderProcessHost* render_process_host, const std::string& permission_name) { @@ -56,11 +38,9 @@ bool ExtensionHasPermission(const Extension* extension, } // namespace -void RegisterCoreExtensionServices( - content::RenderFrameHost* render_frame_host) { - const Extension* extension = GetExtension(render_frame_host); - if (!extension) - return; +void RegisterServicesForFrame(content::RenderFrameHost* render_frame_host, + const Extension* extension) { + DCHECK(extension); content::ServiceRegistry* service_registry = render_frame_host->GetServiceRegistry(); diff --git a/extensions/browser/mojo/service_registration.h b/extensions/browser/mojo/service_registration.h index 39cfe0a..a371392 100644 --- a/extensions/browser/mojo/service_registration.h +++ b/extensions/browser/mojo/service_registration.h @@ -11,7 +11,10 @@ class RenderFrameHost; namespace extensions { -void RegisterCoreExtensionServices(content::RenderFrameHost* render_frame_host); +class Extension; + +void RegisterServicesForFrame(content::RenderFrameHost* render_frame_host, + const Extension* extension); } // namespace extensions |