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