Upstream parts of omnibox.
[chromium-blink-merge.git] / extensions / browser / image_loader_factory.cc
blob60c0b92913786b72f003601015bdcb9a32998ad0
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 "extensions/browser/image_loader_factory.h"
7 #include "components/keyed_service/content/browser_context_dependency_manager.h"
8 #include "extensions/browser/extensions_browser_client.h"
9 #include "extensions/browser/image_loader.h"
11 namespace extensions {
13 // static
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(
26 "ImageLoader",
27 BrowserContextDependencyManager::GetInstance()) {
30 ImageLoaderFactory::~ImageLoaderFactory() {
33 KeyedService* ImageLoaderFactory::BuildServiceInstanceFor(
34 content::BrowserContext* context) const {
35 return new ImageLoader;
38 bool ImageLoaderFactory::ServiceIsCreatedWithBrowserContext() const {
39 return false;
42 content::BrowserContext* ImageLoaderFactory::GetBrowserContextToUse(
43 content::BrowserContext* context) const {
44 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
47 } // namespace extensions