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 "base/memory/singleton.h"
8 #include "chrome/browser/favicon/chrome_favicon_client.h"
9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 ChromeFaviconClientFactory::ChromeFaviconClientFactory()
14 : BrowserContextKeyedServiceFactory(
15 "ChromeFaviconClient",
16 BrowserContextDependencyManager::GetInstance()) {
19 ChromeFaviconClientFactory::~ChromeFaviconClientFactory() {
23 favicon::FaviconClient
* ChromeFaviconClientFactory::GetForProfile(
25 return static_cast<favicon::FaviconClient
*>(
26 GetInstance()->GetServiceForBrowserContext(profile
, true));
30 ChromeFaviconClientFactory
* ChromeFaviconClientFactory::GetInstance() {
31 return Singleton
<ChromeFaviconClientFactory
>::get();
34 KeyedService
* ChromeFaviconClientFactory::BuildServiceInstanceFor(
35 content::BrowserContext
* context
) const {
36 return new ChromeFaviconClient(Profile::FromBrowserContext(context
));
39 content::BrowserContext
* ChromeFaviconClientFactory::GetBrowserContextToUse(
40 content::BrowserContext
* context
) const {
41 return chrome::GetBrowserContextRedirectedInIncognito(context
);