Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / extensions / image_loader_factory.cc
blobbc9c299fc599fc001b1a4568b8fa048fb68ccaf4
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 "chrome/browser/profiles/incognito_helpers.h"
9 #include "components/browser_context_keyed_service/browser_context_dependency_manager.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 BrowserContextKeyedService* 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 // TODO(jamescook): Find a more generic way to do this in the extensions
45 // system without being tied to Chrome code.
46 return chrome::GetBrowserContextRedirectedInIncognito(context);
49 } // namespace extensions