| 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 "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
| 9 #include "chrome/browser/favicon/favicon_service_factory.h" | 9 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 10 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/search/suggestions/image_decoder_impl.h" |
| 12 #include "components/favicon/core/favicon_service.h" | 13 #include "components/favicon/core/favicon_service.h" |
| 13 #include "components/favicon/core/large_icon_service.h" | 14 #include "components/favicon/core/large_icon_service.h" |
| 15 #include "components/image_fetcher/core/image_decoder.h" |
| 16 #include "components/image_fetcher/core/image_fetcher_impl.h" |
| 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 17 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 15 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
| 16 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 17 | 20 |
| 18 // static | 21 // static |
| 19 favicon::LargeIconService* LargeIconServiceFactory::GetForBrowserContext( | 22 favicon::LargeIconService* LargeIconServiceFactory::GetForBrowserContext( |
| 20 content::BrowserContext* context) { | 23 content::BrowserContext* context) { |
| 21 return static_cast<favicon::LargeIconService*>( | 24 return static_cast<favicon::LargeIconService*>( |
| 22 GetInstance()->GetServiceForBrowserContext(context, true)); | 25 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 23 } | 26 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 36 | 39 |
| 37 LargeIconServiceFactory::~LargeIconServiceFactory() {} | 40 LargeIconServiceFactory::~LargeIconServiceFactory() {} |
| 38 | 41 |
| 39 content::BrowserContext* LargeIconServiceFactory::GetBrowserContextToUse( | 42 content::BrowserContext* LargeIconServiceFactory::GetBrowserContextToUse( |
| 40 content::BrowserContext* context) const { | 43 content::BrowserContext* context) const { |
| 41 return chrome::GetBrowserContextRedirectedInIncognito(context); | 44 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 42 } | 45 } |
| 43 | 46 |
| 44 KeyedService* LargeIconServiceFactory::BuildServiceInstanceFor( | 47 KeyedService* LargeIconServiceFactory::BuildServiceInstanceFor( |
| 45 content::BrowserContext* context) const { | 48 content::BrowserContext* context) const { |
| 49 Profile* profile = Profile::FromBrowserContext(context); |
| 46 favicon::FaviconService* favicon_service = | 50 favicon::FaviconService* favicon_service = |
| 47 FaviconServiceFactory::GetForProfile(Profile::FromBrowserContext(context), | 51 FaviconServiceFactory::GetForProfile(profile, |
| 48 ServiceAccessType::EXPLICIT_ACCESS); | 52 ServiceAccessType::EXPLICIT_ACCESS); |
| 49 return new favicon::LargeIconService( | 53 return new favicon::LargeIconService( |
| 50 favicon_service, content::BrowserThread::GetBlockingPool() | 54 favicon_service, |
| 51 ->GetTaskRunnerWithShutdownBehavior( | 55 content::BrowserThread::GetBlockingPool() |
| 52 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 56 ->GetTaskRunnerWithShutdownBehavior( |
| 57 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN), |
| 58 base::MakeUnique<image_fetcher::ImageFetcherImpl>( |
| 59 base::MakeUnique<suggestions::ImageDecoderImpl>(), |
| 60 profile->GetRequestContext())); |
| 53 } | 61 } |
| 54 | 62 |
| 55 bool LargeIconServiceFactory::ServiceIsNULLWhileTesting() const { | 63 bool LargeIconServiceFactory::ServiceIsNULLWhileTesting() const { |
| 56 return true; | 64 return true; |
| 57 } | 65 } |
| OLD | NEW |