Home | History | Annotate | Download | only in favicon
      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/incognito_helpers.h"
      8 #include "chrome/browser/profiles/profile.h"
      9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
     10 
     11 ChromeFaviconClientFactory::ChromeFaviconClientFactory()
     12     : BrowserContextKeyedServiceFactory(
     13           "ChromeFaviconClient",
     14           BrowserContextDependencyManager::GetInstance()) {
     15 }
     16 
     17 ChromeFaviconClientFactory::~ChromeFaviconClientFactory() {
     18 }
     19 
     20 // static
     21 FaviconClient* ChromeFaviconClientFactory::GetForProfile(Profile* profile) {
     22   return static_cast<FaviconClient*>(
     23       GetInstance()->GetServiceForBrowserContext(profile, true));
     24 }
     25 
     26 // static
     27 ChromeFaviconClientFactory* ChromeFaviconClientFactory::GetInstance() {
     28   return Singleton<ChromeFaviconClientFactory>::get();
     29 }
     30 
     31 KeyedService* ChromeFaviconClientFactory::BuildServiceInstanceFor(
     32     content::BrowserContext* context) const {
     33   ChromeFaviconClient* client =
     34       new ChromeFaviconClient(Profile::FromBrowserContext(context));
     35   return client;
     36 }
     37 
     38 content::BrowserContext* ChromeFaviconClientFactory::GetBrowserContextToUse(
     39     content::BrowserContext* context) const {
     40   return chrome::GetBrowserContextRedirectedInIncognito(context);
     41 }
     42