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

Unified Diff: extensions/browser/mojo/service_registration.cc

Issue 1035263002: Add service registration for Mojo services defined under chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: extensions/browser/mojo/service_registration.cc
diff --git a/extensions/browser/mojo/service_registration.cc b/extensions/browser/mojo/service_registration.cc
index 6b1c3d808de162f1640002e927011875a9416115..7cfe06ab7537e127f25e5ca1abccdc63b74f1e50 100644
--- a/extensions/browser/mojo/service_registration.cc
+++ b/extensions/browser/mojo/service_registration.cc
@@ -19,29 +19,12 @@
#include "extensions/browser/process_map.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_api.h"
+#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/switches.h"
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 +39,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();

Powered by Google App Engine
This is Rietveld 408576698