| 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/large_icon_service_factory.h" | 5 #include "chrome/browser/favicon/large_icon_service_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "chrome/browser/favicon/favicon_service_factory.h" | 8 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "components/favicon/core/favicon_service.h" | 10 #include "components/favicon/core/favicon_service.h" |
| 11 #include "components/favicon/core/large_icon_service.h" | 11 #include "components/favicon/core/large_icon_service.h" |
| 12 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 12 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 13 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 favicon::LargeIconService* LargeIconServiceFactory::GetForBrowserContext( | 17 favicon::LargeIconService* LargeIconServiceFactory::GetForBrowserContext( |
| 18 content::BrowserContext* context) { | 18 content::BrowserContext* context) { |
| 19 return static_cast<favicon::LargeIconService*>( | 19 return static_cast<favicon::LargeIconService*>( |
| 20 GetInstance()->GetServiceForBrowserContext(context, true)); | 20 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 21 } | 21 } |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 LargeIconServiceFactory* LargeIconServiceFactory::GetInstance() { | 24 LargeIconServiceFactory* LargeIconServiceFactory::GetInstance() { |
| 25 return Singleton<LargeIconServiceFactory>::get(); | 25 return base::Singleton<LargeIconServiceFactory>::get(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 LargeIconServiceFactory::LargeIconServiceFactory() | 28 LargeIconServiceFactory::LargeIconServiceFactory() |
| 29 : BrowserContextKeyedServiceFactory( | 29 : BrowserContextKeyedServiceFactory( |
| 30 "LargeIconService", | 30 "LargeIconService", |
| 31 BrowserContextDependencyManager::GetInstance()) { | 31 BrowserContextDependencyManager::GetInstance()) { |
| 32 DependsOn(FaviconServiceFactory::GetInstance()); | 32 DependsOn(FaviconServiceFactory::GetInstance()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 LargeIconServiceFactory::~LargeIconServiceFactory() {} | 35 LargeIconServiceFactory::~LargeIconServiceFactory() {} |
| 36 | 36 |
| 37 KeyedService* LargeIconServiceFactory::BuildServiceInstanceFor( | 37 KeyedService* LargeIconServiceFactory::BuildServiceInstanceFor( |
| 38 content::BrowserContext* context) const { | 38 content::BrowserContext* context) const { |
| 39 favicon::FaviconService* favicon_service = | 39 favicon::FaviconService* favicon_service = |
| 40 FaviconServiceFactory::GetForProfile(Profile::FromBrowserContext(context), | 40 FaviconServiceFactory::GetForProfile(Profile::FromBrowserContext(context), |
| 41 ServiceAccessType::EXPLICIT_ACCESS); | 41 ServiceAccessType::EXPLICIT_ACCESS); |
| 42 return new favicon::LargeIconService( | 42 return new favicon::LargeIconService( |
| 43 favicon_service, content::BrowserThread::GetBlockingPool() | 43 favicon_service, content::BrowserThread::GetBlockingPool() |
| 44 ->GetTaskRunnerWithShutdownBehavior( | 44 ->GetTaskRunnerWithShutdownBehavior( |
| 45 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 45 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool LargeIconServiceFactory::ServiceIsNULLWhileTesting() const { | 48 bool LargeIconServiceFactory::ServiceIsNULLWhileTesting() const { |
| 49 return true; | 49 return true; |
| 50 } | 50 } |
| OLD | NEW |