Make castv2 performance test work.
[chromium-blink-merge.git] / chrome / browser / favicon / chrome_favicon_client_factory.cc
blobcb1fe813eacaf72a25c2a23fc65360ed531c0f47
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() {
22 // static
23 favicon::FaviconClient* ChromeFaviconClientFactory::GetForProfile(
24 Profile* profile) {
25 return static_cast<favicon::FaviconClient*>(
26 GetInstance()->GetServiceForBrowserContext(profile, true));
29 // static
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);