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

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

Issue 919943002: Remove extensions::ServiceRegistrationManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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 | « extensions/browser/mojo/service_registration_manager.h ('k') | extensions/extensions.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/mojo/service_registration_manager.cc
diff --git a/extensions/browser/mojo/service_registration_manager.cc b/extensions/browser/mojo/service_registration_manager.cc
deleted file mode 100644
index ee3e55a5fd50742bc9e6df52658f400fc6b45bc9..0000000000000000000000000000000000000000
--- a/extensions/browser/mojo/service_registration_manager.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "extensions/browser/mojo/service_registration_manager.h"
-
-#include "base/command_line.h"
-#include "base/lazy_instance.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/render_frame_host.h"
-#include "content/public/browser/render_process_host.h"
-#include "content/public/browser/site_instance.h"
-#include "device/serial/serial_service_impl.h"
-#include "extensions/browser/extension_registry.h"
-#include "extensions/browser/process_map.h"
-#include "extensions/common/constants.h"
-#include "extensions/common/extension_api.h"
-#include "extensions/common/switches.h"
-
-namespace extensions {
-namespace {
-
-base::LazyInstance<ServiceRegistrationManager> g_lazy_instance =
- LAZY_INSTANCE_INITIALIZER;
-
-ServiceRegistrationManager* g_test_instance = nullptr;
-
-} // namespace
-
-ServiceRegistrationManager::ServiceRegistrationManager() {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableMojoSerialService)) {
- AddServiceFactory(
- "serial",
- base::Bind(device::SerialServiceImpl::CreateOnMessageLoop,
- content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::FILE),
- content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::IO),
- content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::UI)));
- }
-}
-
-ServiceRegistrationManager::~ServiceRegistrationManager() {
-}
-
-ServiceRegistrationManager* ServiceRegistrationManager::GetSharedInstance() {
- if (g_test_instance)
- return g_test_instance;
- return g_lazy_instance.Pointer();
-}
-
-void ServiceRegistrationManager::AddServicesToRenderFrame(
- content::RenderFrameHost* render_frame_host) {
- content::BrowserContext* context =
- render_frame_host->GetProcess()->GetBrowserContext();
- content::SiteInstance* site_instance = render_frame_host->GetSiteInstance();
- GURL extension_url = site_instance->GetSiteURL();
- ExtensionRegistry* registry = ExtensionRegistry::Get(context);
-
- // TODO(sammc): Handle content scripts and web pages that have access to some
- // extension APIs.
- if (!extension_url.SchemeIs(kExtensionScheme)) {
- return;
- }
-
- const Extension* extension =
- registry->enabled_extensions().GetByID(extension_url.host());
- if (!extension)
- return;
-
- Feature::Context context_type =
- ProcessMap::Get(context)->GetMostLikelyContextType(
- extension, render_frame_host->GetProcess()->GetID());
- for (const auto& factory : factories_) {
- auto availability = ExtensionAPI::GetSharedInstance()->IsAvailable(
- factory.first, extension, context_type, extension_url);
- if (availability.is_available()) {
- AddServiceToServiceRegistry(render_frame_host->GetServiceRegistry(),
- factory.second.get());
- }
- }
-}
-
-void ServiceRegistrationManager::AddServiceToServiceRegistry(
- content::ServiceRegistry* service_registry,
- internal::ServiceFactoryBase* factory) {
- factory->Register(service_registry);
-}
-
-// static
-void ServiceRegistrationManager::SetServiceRegistrationManagerForTest(
- ServiceRegistrationManager* service_registration_manager) {
- g_test_instance = service_registration_manager;
-}
-
-} // namespace extensions
« no previous file with comments | « extensions/browser/mojo/service_registration_manager.h ('k') | extensions/extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698