1 // Copyright 2015 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/fallback_icon_service_factory.h"
7 #include "base/memory/singleton.h"
8 #include "chrome/browser/favicon/chrome_fallback_icon_client_factory.h"
9 #include "components/favicon/core/fallback_icon_service.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 #include "content/public/browser/browser_context.h"
14 favicon::FallbackIconService
* FallbackIconServiceFactory::GetForBrowserContext(
15 content::BrowserContext
* context
) {
16 return static_cast<favicon::FallbackIconService
*>(
17 GetInstance()->GetServiceForBrowserContext(context
, true));
21 FallbackIconServiceFactory
* FallbackIconServiceFactory::GetInstance() {
22 return Singleton
<FallbackIconServiceFactory
>::get();
25 FallbackIconServiceFactory::FallbackIconServiceFactory()
26 : BrowserContextKeyedServiceFactory(
27 "FallbackIconService",
28 BrowserContextDependencyManager::GetInstance()) {
29 DependsOn(ChromeFallbackIconClientFactory::GetInstance());
32 FallbackIconServiceFactory::~FallbackIconServiceFactory() {}
34 KeyedService
* FallbackIconServiceFactory::BuildServiceInstanceFor(
35 content::BrowserContext
* context
) const {
36 favicon::FallbackIconClient
* fallback_icon_client
=
37 ChromeFallbackIconClientFactory::GetForBrowserContext(context
);
38 return new favicon::FallbackIconService(fallback_icon_client
);
41 bool FallbackIconServiceFactory::ServiceIsNULLWhileTesting() const {