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/favicon/fallback_icon_service_factory.h" | 5 #include "chrome/browser/favicon/fallback_icon_service_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_factory.h" | 8 #include "chrome/browser/favicon/chrome_fallback_icon_client_factory.h" |
9 #include "components/favicon/core/fallback_icon_service.h" | 9 #include "components/favicon/core/fallback_icon_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 #include "content/public/browser/browser_context.h" |
12 | 12 |
13 // static | 13 // static |
14 favicon::FallbackIconService* FallbackIconServiceFactory::GetForBrowserContext( | 14 favicon::FallbackIconService* FallbackIconServiceFactory::GetForBrowserContext( |
15 content::BrowserContext* context) { | 15 content::BrowserContext* context) { |
16 return static_cast<favicon::FallbackIconService*>( | 16 return static_cast<favicon::FallbackIconService*>( |
17 GetInstance()->GetServiceForBrowserContext(context, true)); | 17 GetInstance()->GetServiceForBrowserContext(context, true)); |
18 } | 18 } |
19 | 19 |
20 // static | 20 // static |
21 FallbackIconServiceFactory* FallbackIconServiceFactory::GetInstance() { | 21 FallbackIconServiceFactory* FallbackIconServiceFactory::GetInstance() { |
22 return Singleton<FallbackIconServiceFactory>::get(); | 22 return base::Singleton<FallbackIconServiceFactory>::get(); |
23 } | 23 } |
24 | 24 |
25 FallbackIconServiceFactory::FallbackIconServiceFactory() | 25 FallbackIconServiceFactory::FallbackIconServiceFactory() |
26 : BrowserContextKeyedServiceFactory( | 26 : BrowserContextKeyedServiceFactory( |
27 "FallbackIconService", | 27 "FallbackIconService", |
28 BrowserContextDependencyManager::GetInstance()) { | 28 BrowserContextDependencyManager::GetInstance()) { |
29 DependsOn(ChromeFallbackIconClientFactory::GetInstance()); | 29 DependsOn(ChromeFallbackIconClientFactory::GetInstance()); |
30 } | 30 } |
31 | 31 |
32 FallbackIconServiceFactory::~FallbackIconServiceFactory() {} | 32 FallbackIconServiceFactory::~FallbackIconServiceFactory() {} |
33 | 33 |
34 KeyedService* FallbackIconServiceFactory::BuildServiceInstanceFor( | 34 KeyedService* FallbackIconServiceFactory::BuildServiceInstanceFor( |
35 content::BrowserContext* context) const { | 35 content::BrowserContext* context) const { |
36 favicon::FallbackIconClient* fallback_icon_client = | 36 favicon::FallbackIconClient* fallback_icon_client = |
37 ChromeFallbackIconClientFactory::GetForBrowserContext(context); | 37 ChromeFallbackIconClientFactory::GetForBrowserContext(context); |
38 return new favicon::FallbackIconService(fallback_icon_client); | 38 return new favicon::FallbackIconService(fallback_icon_client); |
39 } | 39 } |
40 | 40 |
41 bool FallbackIconServiceFactory::ServiceIsNULLWhileTesting() const { | 41 bool FallbackIconServiceFactory::ServiceIsNULLWhileTesting() const { |
42 return true; | 42 return true; |
43 } | 43 } |
OLD | NEW |