1 // Copyright (c) 2012 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/extensions/image_loader_factory.h"
7 #include "chrome/browser/extensions/image_loader.h"
8 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
9 #include "extensions/browser/extensions_browser_client.h"
11 namespace extensions
{
14 ImageLoader
* ImageLoaderFactory::GetForBrowserContext(
15 content::BrowserContext
* context
) {
16 return static_cast<ImageLoader
*>(
17 GetInstance()->GetServiceForBrowserContext(context
, true));
20 ImageLoaderFactory
* ImageLoaderFactory::GetInstance() {
21 return Singleton
<ImageLoaderFactory
>::get();
24 ImageLoaderFactory::ImageLoaderFactory()
25 : BrowserContextKeyedServiceFactory(
27 BrowserContextDependencyManager::GetInstance()) {
30 ImageLoaderFactory::~ImageLoaderFactory() {
33 BrowserContextKeyedService
* ImageLoaderFactory::BuildServiceInstanceFor(
34 content::BrowserContext
* context
) const {
35 return new ImageLoader
;
38 bool ImageLoaderFactory::ServiceIsCreatedWithBrowserContext() const {
42 content::BrowserContext
* ImageLoaderFactory::GetBrowserContextToUse(
43 content::BrowserContext
* context
) const {
44 return ExtensionsBrowserClient::Get()->GetOriginalContext(context
);
47 } // namespace extensions