OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/extension_system_factory.h" | 5 #include "chrome/browser/extensions/extension_system_factory.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_message_service.h" | 7 #include "chrome/browser/extensions/extension_message_service.h" |
8 #include "chrome/browser/extensions/extension_prefs.h" | 8 #include "chrome/browser/extensions/extension_prefs.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/profiles/profile_dependency_manager.h" | 12 #include "chrome/browser/profiles/profile_dependency_manager.h" |
13 #include "chrome/browser/protector/protector_service_factory.h" | 13 #include "chrome/browser/protector/protector_service_factory.h" |
14 #include "chrome/browser/themes/theme_service_factory.h" | 14 #include "chrome/browser/themes/theme_service_factory.h" |
15 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 15 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
16 | 16 |
17 // ExtensionSystemSharedFactory | 17 // ExtensionSystemSharedFactory |
18 | 18 |
19 // static | 19 // static |
20 ExtensionSystemImpl::Shared* ExtensionSystemSharedFactory::GetForProfile( | 20 extensions::ExtensionSystemImpl::Shared* |
21 Profile* profile) { | 21 ExtensionSystemSharedFactory::GetForProfile(Profile* profile) { |
22 return static_cast<ExtensionSystemImpl::Shared*>( | 22 return static_cast<extensions::ExtensionSystemImpl::Shared*>( |
23 GetInstance()->GetServiceForProfile(profile, true)); | 23 GetInstance()->GetServiceForProfile(profile, true)); |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 ExtensionSystemSharedFactory* ExtensionSystemSharedFactory::GetInstance() { | 27 ExtensionSystemSharedFactory* ExtensionSystemSharedFactory::GetInstance() { |
28 return Singleton<ExtensionSystemSharedFactory>::get(); | 28 return Singleton<ExtensionSystemSharedFactory>::get(); |
29 } | 29 } |
30 | 30 |
31 ExtensionSystemSharedFactory::ExtensionSystemSharedFactory() | 31 ExtensionSystemSharedFactory::ExtensionSystemSharedFactory() |
32 : ProfileKeyedServiceFactory( | 32 : ProfileKeyedServiceFactory( |
33 "ExtensionSystemShared", | 33 "ExtensionSystemShared", |
34 ProfileDependencyManager::GetInstance()) { | 34 ProfileDependencyManager::GetInstance()) { |
35 DependsOn(GlobalErrorServiceFactory::GetInstance()); | 35 DependsOn(GlobalErrorServiceFactory::GetInstance()); |
36 DependsOn(ThemeServiceFactory::GetInstance()); | 36 DependsOn(ThemeServiceFactory::GetInstance()); |
37 // ProtectorService should be destroyed after us. | 37 // ProtectorService should be destroyed after us. |
38 DependsOn(protector::ProtectorServiceFactory::GetInstance()); | 38 DependsOn(protector::ProtectorServiceFactory::GetInstance()); |
39 } | 39 } |
40 | 40 |
41 ExtensionSystemSharedFactory::~ExtensionSystemSharedFactory() { | 41 ExtensionSystemSharedFactory::~ExtensionSystemSharedFactory() { |
42 } | 42 } |
43 | 43 |
44 ProfileKeyedService* ExtensionSystemSharedFactory::BuildServiceInstanceFor( | 44 ProfileKeyedService* ExtensionSystemSharedFactory::BuildServiceInstanceFor( |
45 Profile* profile) const { | 45 Profile* profile) const { |
46 return new ExtensionSystemImpl::Shared(profile); | 46 return new extensions::ExtensionSystemImpl::Shared(profile); |
47 } | 47 } |
48 | 48 |
49 bool ExtensionSystemSharedFactory::ServiceRedirectedInIncognito() { | 49 bool ExtensionSystemSharedFactory::ServiceRedirectedInIncognito() { |
50 return true; | 50 return true; |
51 } | 51 } |
52 | 52 |
53 // ExtensionSystemFactory | 53 // ExtensionSystemFactory |
54 | 54 |
55 // static | 55 // static |
56 ExtensionSystem* ExtensionSystemFactory::GetForProfile(Profile* profile) { | 56 extensions::ExtensionSystem* ExtensionSystemFactory::GetForProfile( |
57 return static_cast<ExtensionSystem*>( | 57 Profile* profile) { |
| 58 return static_cast<extensions::ExtensionSystem*>( |
58 GetInstance()->GetServiceForProfile(profile, true)); | 59 GetInstance()->GetServiceForProfile(profile, true)); |
59 } | 60 } |
60 | 61 |
61 // static | 62 // static |
62 ExtensionSystemFactory* ExtensionSystemFactory::GetInstance() { | 63 ExtensionSystemFactory* ExtensionSystemFactory::GetInstance() { |
63 return Singleton<ExtensionSystemFactory>::get(); | 64 return Singleton<ExtensionSystemFactory>::get(); |
64 } | 65 } |
65 | 66 |
66 ExtensionSystemFactory::ExtensionSystemFactory() | 67 ExtensionSystemFactory::ExtensionSystemFactory() |
67 : ProfileKeyedServiceFactory( | 68 : ProfileKeyedServiceFactory( |
68 "ExtensionSystem", | 69 "ExtensionSystem", |
69 ProfileDependencyManager::GetInstance()) { | 70 ProfileDependencyManager::GetInstance()) { |
70 DependsOn(ExtensionSystemSharedFactory::GetInstance()); | 71 DependsOn(ExtensionSystemSharedFactory::GetInstance()); |
71 } | 72 } |
72 | 73 |
73 ExtensionSystemFactory::~ExtensionSystemFactory() { | 74 ExtensionSystemFactory::~ExtensionSystemFactory() { |
74 } | 75 } |
75 | 76 |
76 ProfileKeyedService* ExtensionSystemFactory::BuildServiceInstanceFor( | 77 ProfileKeyedService* ExtensionSystemFactory::BuildServiceInstanceFor( |
77 Profile* profile) const { | 78 Profile* profile) const { |
78 return new ExtensionSystemImpl(profile); | 79 return new extensions::ExtensionSystemImpl(profile); |
79 } | 80 } |
80 | 81 |
81 bool ExtensionSystemFactory::ServiceHasOwnInstanceInIncognito() { | 82 bool ExtensionSystemFactory::ServiceHasOwnInstanceInIncognito() { |
82 return true; | 83 return true; |
83 } | 84 } |
84 | 85 |
85 bool ExtensionSystemFactory::ServiceIsCreatedWithProfile() { | 86 bool ExtensionSystemFactory::ServiceIsCreatedWithProfile() { |
86 return true; | 87 return true; |
87 } | 88 } |
OLD | NEW |