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.
5 #include "chrome/browser/favicon/chrome_favicon_client_factory.h"
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"
11 ChromeFaviconClientFactory::ChromeFaviconClientFactory()
12 : BrowserContextKeyedServiceFactory(
13 "ChromeFaviconClient",
14 BrowserContextDependencyManager::GetInstance()) {
17 ChromeFaviconClientFactory::~ChromeFaviconClientFactory() {
21 FaviconClient
* ChromeFaviconClientFactory::GetForProfile(Profile
* profile
) {
22 return static_cast<FaviconClient
*>(
23 GetInstance()->GetServiceForBrowserContext(profile
, true));
27 ChromeFaviconClientFactory
* ChromeFaviconClientFactory::GetInstance() {
28 return Singleton
<ChromeFaviconClientFactory
>::get();
31 KeyedService
* ChromeFaviconClientFactory::BuildServiceInstanceFor(
32 content::BrowserContext
* context
) const {
33 ChromeFaviconClient
* client
=
34 new ChromeFaviconClient(Profile::FromBrowserContext(context
));
38 content::BrowserContext
* ChromeFaviconClientFactory::GetBrowserContextToUse(
39 content::BrowserContext
* context
) const {
40 return chrome::GetBrowserContextRedirectedInIncognito(context
);