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/chrome_fallback_icon_client_factory.h" |
| 6 |
| 7 #include "chrome/browser/profiles/incognito_helpers.h" |
| 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 10 |
| 11 ChromeFallbackIconClientFactory::ChromeFallbackIconClientFactory() |
| 12 : BrowserContextKeyedServiceFactory( |
| 13 "ChromeFallbackIconClient", |
| 14 BrowserContextDependencyManager::GetInstance()) { |
| 15 } |
| 16 |
| 17 ChromeFallbackIconClientFactory::~ChromeFallbackIconClientFactory() { |
| 18 } |
| 19 |
| 20 // static |
| 21 FallbackIconClient* ChromeFallbackIconClientFactory::GetForProfile( |
| 22 Profile* profile) { |
| 23 return static_cast<FallbackIconClient*>( |
| 24 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 25 } |
| 26 |
| 27 // static |
| 28 ChromeFallbackIconClientFactory* |
| 29 ChromeFallbackIconClientFactory::GetInstance() { |
| 30 return Singleton<ChromeFallbackIconClientFactory>::get(); |
| 31 } |
| 32 |
| 33 KeyedService* ChromeFallbackIconClientFactory::BuildServiceInstanceFor( |
| 34 content::BrowserContext* context) const { |
| 35 ChromeFallbackIconClient* client = |
| 36 new ChromeFallbackIconClient(Profile::FromBrowserContext(context)); |
| 37 return client; |
| 38 } |
| 39 |
| 40 content::BrowserContext* |
| 41 ChromeFallbackIconClientFactory::GetBrowserContextToUse( |
| 42 content::BrowserContext* context) const { |
| 43 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 44 } |
OLD | NEW |