| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/favicon/fallback_icon_service_factory.h" | |
| 6 | |
| 7 #include "base/memory/singleton.h" | |
| 8 #include "chrome/browser/favicon/chrome_fallback_icon_client_factory.h" | |
| 9 #include "chrome/browser/profiles/incognito_helpers.h" | |
| 10 #include "components/favicon/core/fallback_icon_service.h" | |
| 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
| 12 #include "content/public/browser/browser_context.h" | |
| 13 | |
| 14 // static | |
| 15 favicon::FallbackIconService* FallbackIconServiceFactory::GetForBrowserContext( | |
| 16 content::BrowserContext* context) { | |
| 17 return static_cast<favicon::FallbackIconService*>( | |
| 18 GetInstance()->GetServiceForBrowserContext(context, true)); | |
| 19 } | |
| 20 | |
| 21 // static | |
| 22 FallbackIconServiceFactory* FallbackIconServiceFactory::GetInstance() { | |
| 23 return base::Singleton<FallbackIconServiceFactory>::get(); | |
| 24 } | |
| 25 | |
| 26 FallbackIconServiceFactory::FallbackIconServiceFactory() | |
| 27 : BrowserContextKeyedServiceFactory( | |
| 28 "FallbackIconService", | |
| 29 BrowserContextDependencyManager::GetInstance()) { | |
| 30 DependsOn(ChromeFallbackIconClientFactory::GetInstance()); | |
| 31 } | |
| 32 | |
| 33 FallbackIconServiceFactory::~FallbackIconServiceFactory() {} | |
| 34 | |
| 35 content::BrowserContext* FallbackIconServiceFactory::GetBrowserContextToUse( | |
| 36 content::BrowserContext* context) const { | |
| 37 return chrome::GetBrowserContextRedirectedInIncognito(context); | |
| 38 } | |
| 39 | |
| 40 KeyedService* FallbackIconServiceFactory::BuildServiceInstanceFor( | |
| 41 content::BrowserContext* context) const { | |
| 42 favicon::FallbackIconClient* fallback_icon_client = | |
| 43 ChromeFallbackIconClientFactory::GetForBrowserContext(context); | |
| 44 return new favicon::FallbackIconService(fallback_icon_client); | |
| 45 } | |
| 46 | |
| 47 bool FallbackIconServiceFactory::ServiceIsNULLWhileTesting() const { | |
| 48 return true; | |
| 49 } | |
| OLD | NEW |