OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ui/bookmarks/enhanced_bookmark_key_service_factory.h" | 5 #include "chrome/browser/favicon/chrome_fallback_icon_client_factory.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "chrome/browser/favicon/chrome_fallback_icon_client.h" | |
8 #include "chrome/browser/profiles/incognito_helpers.h" | 9 #include "chrome/browser/profiles/incognito_helpers.h" |
9 #include "chrome/browser/ui/bookmarks/enhanced_bookmark_key_service.h" | |
10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
11 #include "content/public/browser/browser_context.h" | |
11 | 12 |
12 // static | 13 ChromeFallbackIconClientFactory::ChromeFallbackIconClientFactory() |
13 EnhancedBookmarkKeyServiceFactory* | |
14 EnhancedBookmarkKeyServiceFactory::GetInstance() { | |
15 return Singleton<EnhancedBookmarkKeyServiceFactory>::get(); | |
16 } | |
17 | |
18 EnhancedBookmarkKeyServiceFactory::EnhancedBookmarkKeyServiceFactory() | |
19 : BrowserContextKeyedServiceFactory( | 14 : BrowserContextKeyedServiceFactory( |
20 "EnhancedBookmarkKeyService", | 15 "ChromeFallbackIconClient", |
21 BrowserContextDependencyManager::GetInstance()) { | 16 BrowserContextDependencyManager::GetInstance()) { |
22 } | 17 } |
23 | 18 |
24 EnhancedBookmarkKeyServiceFactory::~EnhancedBookmarkKeyServiceFactory() { | 19 ChromeFallbackIconClientFactory::~ChromeFallbackIconClientFactory() { |
25 } | 20 } |
26 | 21 |
27 KeyedService* EnhancedBookmarkKeyServiceFactory::BuildServiceInstanceFor( | 22 // static |
28 content::BrowserContext* context) const { | 23 FallbackIconClient* ChromeFallbackIconClientFactory::GetForBrowserContext( |
29 return new EnhancedBookmarkKeyService(context); | 24 content::BrowserContext* context) { |
25 return static_cast<FallbackIconClient*>( | |
26 GetInstance()->GetServiceForBrowserContext(context, true)); | |
27 } | |
28 | |
29 // static | |
30 ChromeFallbackIconClientFactory* | |
31 ChromeFallbackIconClientFactory::GetInstance() { | |
32 return Singleton<ChromeFallbackIconClientFactory>::get(); | |
33 } | |
34 | |
35 KeyedService* ChromeFallbackIconClientFactory::BuildServiceInstanceFor( | |
36 content::BrowserContext* /* context */) const { | |
37 return new ChromeFallbackIconClient(); | |
30 } | 38 } |
31 | 39 |
32 content::BrowserContext* | 40 content::BrowserContext* |
33 EnhancedBookmarkKeyServiceFactory::GetBrowserContextToUse( | 41 ChromeFallbackIconClientFactory::GetBrowserContextToUse( |
34 content::BrowserContext* context) const { | 42 content::BrowserContext* context) const { |
35 return chrome::GetBrowserContextRedirectedInIncognito(context); | 43 return chrome::GetBrowserContextRedirectedInIncognito(context); |
pkotwicz
2015/03/27 18:52:31
Nit: Remove this method. The factories for Fallbac
huangs
2015/03/27 19:01:51
Done.
| |
36 } | 44 } |
37 | |
38 bool EnhancedBookmarkKeyServiceFactory::ServiceIsCreatedWithBrowserContext() | |
39 const { | |
40 return true; | |
41 } | |
42 | |
43 bool EnhancedBookmarkKeyServiceFactory::ServiceIsNULLWhileTesting() const { | |
44 return true; | |
45 } | |
OLD | NEW |