OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/file_system_provider/service_factory.h" | 5 #include "chrome/browser/chromeos/file_system_provider/service_factory.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/file_system_provider/service.h" | 7 #include "chrome/browser/chromeos/file_system_provider/service.h" |
8 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 9 #include "extensions/browser/extension_registry.h" |
| 10 #include "extensions/browser/extension_registry_factory.h" |
9 | 11 |
10 namespace chromeos { | 12 namespace chromeos { |
11 namespace file_system_provider { | 13 namespace file_system_provider { |
12 | 14 |
13 // static | 15 // static |
14 Service* ServiceFactory::Get(content::BrowserContext* context) { | 16 Service* ServiceFactory::Get(content::BrowserContext* context) { |
15 return static_cast<Service*>( | 17 return static_cast<Service*>( |
16 GetInstance()->GetServiceForBrowserContext(context, true)); | 18 GetInstance()->GetServiceForBrowserContext(context, true)); |
17 } | 19 } |
18 | 20 |
19 ServiceFactory* ServiceFactory::GetInstance() { | 21 ServiceFactory* ServiceFactory::GetInstance() { |
20 return Singleton<ServiceFactory>::get(); | 22 return Singleton<ServiceFactory>::get(); |
21 } | 23 } |
22 | 24 |
23 ServiceFactory::ServiceFactory() | 25 ServiceFactory::ServiceFactory() |
24 : BrowserContextKeyedServiceFactory( | 26 : BrowserContextKeyedServiceFactory( |
25 "Service", | 27 "Service", |
26 BrowserContextDependencyManager::GetInstance()) {} | 28 BrowserContextDependencyManager::GetInstance()) { |
| 29 DependsOn(extensions::ExtensionRegistryFactory::GetInstance()); |
| 30 } |
27 | 31 |
28 ServiceFactory::~ServiceFactory() {} | 32 ServiceFactory::~ServiceFactory() {} |
29 | 33 |
30 KeyedService* ServiceFactory::BuildServiceInstanceFor( | 34 KeyedService* ServiceFactory::BuildServiceInstanceFor( |
31 content::BrowserContext* profile) const { | 35 content::BrowserContext* profile) const { |
32 return new Service(static_cast<Profile*>(profile)); | 36 return new Service( |
| 37 Profile::FromBrowserContext(profile), |
| 38 extensions::ExtensionRegistry::Get(Profile::FromBrowserContext(profile))); |
33 } | 39 } |
34 | 40 |
35 bool ServiceFactory::ServiceIsCreatedWithBrowserContext() const { return true; } | 41 bool ServiceFactory::ServiceIsCreatedWithBrowserContext() const { return true; } |
36 | 42 |
37 } // namespace file_system_provider | 43 } // namespace file_system_provider |
38 } // namespace chromeos | 44 } // namespace chromeos |
OLD | NEW |