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/large_icon_service_factory.h"
7 #include "base/memory/singleton.h"
8 #include "chrome/browser/favicon/favicon_service_factory.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/favicon/core/favicon_service.h"
11 #include "components/favicon/core/large_icon_service.h"
12 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 #include "content/public/browser/browser_context.h"
16 favicon::LargeIconService
* LargeIconServiceFactory::GetForBrowserContext(
17 content::BrowserContext
* context
) {
18 return static_cast<favicon::LargeIconService
*>(
19 GetInstance()->GetServiceForBrowserContext(context
, true));
23 LargeIconServiceFactory
* LargeIconServiceFactory::GetInstance() {
24 return Singleton
<LargeIconServiceFactory
>::get();
27 LargeIconServiceFactory::LargeIconServiceFactory()
28 : BrowserContextKeyedServiceFactory(
30 BrowserContextDependencyManager::GetInstance()) {
31 DependsOn(FaviconServiceFactory::GetInstance());
34 LargeIconServiceFactory::~LargeIconServiceFactory() {}
36 KeyedService
* LargeIconServiceFactory::BuildServiceInstanceFor(
37 content::BrowserContext
* context
) const {
38 favicon::FaviconService
* favicon_service
=
39 FaviconServiceFactory::GetForProfile(Profile::FromBrowserContext(context
),
40 ServiceAccessType::EXPLICIT_ACCESS
);
41 return new favicon::LargeIconService(favicon_service
);
44 bool LargeIconServiceFactory::ServiceIsNULLWhileTesting() const {