OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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_favicon_client_factory.h" |
| 6 |
| 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 9 |
| 10 ChromeFaviconClientFactory::ChromeFaviconClientFactory() |
| 11 : BrowserContextKeyedServiceFactory( |
| 12 "ChromeFaviconClient", |
| 13 BrowserContextDependencyManager::GetInstance()) { |
| 14 } |
| 15 |
| 16 ChromeFaviconClientFactory::~ChromeFaviconClientFactory() { |
| 17 } |
| 18 |
| 19 // static |
| 20 FaviconClient* ChromeFaviconClientFactory::GetForProfile(Profile* profile) { |
| 21 if (!profile->IsOffTheRecord()) { |
| 22 return static_cast<FaviconClient*>( |
| 23 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 24 } |
| 25 // Profile must be OffTheRecord in this case. |
| 26 return static_cast<FaviconClient*>(GetInstance()->GetServiceForBrowserContext( |
| 27 profile->GetOriginalProfile(), true)); |
| 28 } |
| 29 |
| 30 // static |
| 31 ChromeFaviconClientFactory* ChromeFaviconClientFactory::GetInstance() { |
| 32 return Singleton<ChromeFaviconClientFactory>::get(); |
| 33 } |
| 34 |
| 35 KeyedService* ChromeFaviconClientFactory::BuildServiceInstanceFor( |
| 36 content::BrowserContext* context) const { |
| 37 ChromeFaviconClient* client = |
| 38 new ChromeFaviconClient(Profile::FromBrowserContext(context)); |
| 39 return client; |
| 40 } |
| 41 |
| 42 bool ChromeFaviconClientFactory::ServiceIsNULLWhileTesting() const { |
| 43 return true; |
| 44 } |
OLD | NEW |