Fast user switcher: Distinguish supervised users from child accounts
[chromium-blink-merge.git] / chrome / browser / favicon / chrome_favicon_client_factory.cc
blob294149978d13da47f911a706dffe3b779edf3bea
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/bookmarks/bookmark_model_factory.h"
8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 ChromeFaviconClientFactory::ChromeFaviconClientFactory()
13 : BrowserContextKeyedServiceFactory(
14 "ChromeFaviconClient",
15 BrowserContextDependencyManager::GetInstance()) {
16 DependsOn(BookmarkModelFactory::GetInstance());
19 ChromeFaviconClientFactory::~ChromeFaviconClientFactory() {
22 // static
23 FaviconClient* ChromeFaviconClientFactory::GetForProfile(Profile* profile) {
24 return static_cast<FaviconClient*>(
25 GetInstance()->GetServiceForBrowserContext(profile, true));
28 // static
29 ChromeFaviconClientFactory* ChromeFaviconClientFactory::GetInstance() {
30 return Singleton<ChromeFaviconClientFactory>::get();
33 KeyedService* ChromeFaviconClientFactory::BuildServiceInstanceFor(
34 content::BrowserContext* context) const {
35 Profile* profile = Profile::FromBrowserContext(context);
36 return new ChromeFaviconClient(profile,
37 BookmarkModelFactory::GetForProfile(profile));
40 content::BrowserContext* ChromeFaviconClientFactory::GetBrowserContextToUse(
41 content::BrowserContext* context) const {
42 return chrome::GetBrowserContextRedirectedInIncognito(context);