Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / file_system_provider / service_factory.cc
blob8669ff9e06d6fcbe7b2d4b601974ea90ab97b981
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/file_system_provider/service_factory.h"
7 #include "chrome/browser/chromeos/file_system_provider/service.h"
8 #include "chrome/browser/extensions/extension_system_factory.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "extensions/browser/extension_registry.h"
11 #include "extensions/browser/extension_registry_factory.h"
13 namespace chromeos {
14 namespace file_system_provider {
16 // static
17 Service* ServiceFactory::Get(content::BrowserContext* context) {
18 return static_cast<Service*>(
19 GetInstance()->GetServiceForBrowserContext(context, true));
22 // static
23 Service* ServiceFactory::FindExisting(content::BrowserContext* context) {
24 return static_cast<Service*>(
25 GetInstance()->GetServiceForBrowserContext(context, false));
28 ServiceFactory* ServiceFactory::GetInstance() {
29 return Singleton<ServiceFactory>::get();
32 ServiceFactory::ServiceFactory()
33 : BrowserContextKeyedServiceFactory(
34 "Service",
35 BrowserContextDependencyManager::GetInstance()) {
36 DependsOn(extensions::ExtensionRegistryFactory::GetInstance());
37 DependsOn(extensions::ExtensionSystemFactory::GetInstance());
40 ServiceFactory::~ServiceFactory() {}
42 KeyedService* ServiceFactory::BuildServiceInstanceFor(
43 content::BrowserContext* profile) const {
44 return new Service(
45 Profile::FromBrowserContext(profile),
46 extensions::ExtensionRegistry::Get(Profile::FromBrowserContext(profile)));
49 bool ServiceFactory::ServiceIsCreatedWithBrowserContext() const { return true; }
51 } // namespace file_system_provider
52 } // namespace chromeos