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/api/discovery/suggested_links_registry_facto
ry.h" | 5 #include "chrome/browser/extensions/api/discovery/suggested_links_registry_facto
ry.h" |
6 | 6 |
7 #include "chrome/browser/extensions/api/discovery/suggested_links_registry.h" | 7 #include "chrome/browser/extensions/api/discovery/suggested_links_registry.h" |
8 #include "chrome/browser/extensions/extension_system_factory.h" | 8 #include "chrome/browser/extensions/extension_system_factory.h" |
9 #include "chrome/browser/profiles/incognito_helpers.h" | 9 #include "chrome/browser/profiles/incognito_helpers.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 11 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 | 14 |
15 // static | 15 // static |
16 SuggestedLinksRegistry* SuggestedLinksRegistryFactory::GetForProfile( | 16 SuggestedLinksRegistry* SuggestedLinksRegistryFactory::GetForProfile( |
17 Profile* profile) { | 17 Profile* profile) { |
18 return static_cast<SuggestedLinksRegistry*>( | 18 return static_cast<SuggestedLinksRegistry*>( |
19 GetInstance()->GetServiceForProfile(profile, true)); | 19 GetInstance()->GetServiceForBrowserContext(profile, true)); |
20 } | 20 } |
21 | 21 |
22 // static | 22 // static |
23 SuggestedLinksRegistryFactory* SuggestedLinksRegistryFactory::GetInstance() { | 23 SuggestedLinksRegistryFactory* SuggestedLinksRegistryFactory::GetInstance() { |
24 return Singleton<SuggestedLinksRegistryFactory>::get(); | 24 return Singleton<SuggestedLinksRegistryFactory>::get(); |
25 } | 25 } |
26 | 26 |
27 bool SuggestedLinksRegistryFactory::ServiceIsCreatedWithProfile() const { | 27 bool SuggestedLinksRegistryFactory::ServiceIsCreatedWithBrowserContext() const { |
28 return true; | 28 return true; |
29 } | 29 } |
30 | 30 |
31 SuggestedLinksRegistryFactory::SuggestedLinksRegistryFactory() | 31 SuggestedLinksRegistryFactory::SuggestedLinksRegistryFactory() |
32 : ProfileKeyedServiceFactory("SuggestedLinksRegistry", | 32 : BrowserContextKeyedServiceFactory( |
33 ProfileDependencyManager::GetInstance()) { | 33 "SuggestedLinksRegistry", |
| 34 BrowserContextDependencyManager::GetInstance()) { |
34 DependsOn(ExtensionSystemFactory::GetInstance()); | 35 DependsOn(ExtensionSystemFactory::GetInstance()); |
35 } | 36 } |
36 | 37 |
37 SuggestedLinksRegistryFactory::~SuggestedLinksRegistryFactory() { | 38 SuggestedLinksRegistryFactory::~SuggestedLinksRegistryFactory() { |
38 } | 39 } |
39 | 40 |
40 ProfileKeyedService* SuggestedLinksRegistryFactory::BuildServiceInstanceFor( | 41 BrowserContextKeyedService* |
| 42 SuggestedLinksRegistryFactory::BuildServiceInstanceFor( |
41 content::BrowserContext* profile) const { | 43 content::BrowserContext* profile) const { |
42 return new SuggestedLinksRegistry(); | 44 return new SuggestedLinksRegistry(); |
43 } | 45 } |
44 | 46 |
45 content::BrowserContext* SuggestedLinksRegistryFactory::GetBrowserContextToUse( | 47 content::BrowserContext* SuggestedLinksRegistryFactory::GetBrowserContextToUse( |
46 content::BrowserContext* context) const { | 48 content::BrowserContext* context) const { |
47 return chrome::GetBrowserContextRedirectedInIncognito(context); | 49 return chrome::GetBrowserContextRedirectedInIncognito(context); |
48 } | 50 } |
49 | 51 |
50 } // namespace extensions | 52 } // namespace extensions |
OLD | NEW |