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. 4 5 #include "extensions/browser/image_loader_factory.h" 6 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" 10 11 namespace extensions { 12 13 // static GetForBrowserContext(content::BrowserContext * context)14ImageLoader* ImageLoaderFactory::GetForBrowserContext( 15 content::BrowserContext* context) { 16 return static_cast<ImageLoader*>( 17 GetInstance()->GetServiceForBrowserContext(context, true)); 18 } 19 GetInstance()20ImageLoaderFactory* ImageLoaderFactory::GetInstance() { 21 return Singleton<ImageLoaderFactory>::get(); 22 } 23 ImageLoaderFactory()24ImageLoaderFactory::ImageLoaderFactory() 25 : BrowserContextKeyedServiceFactory( 26 "ImageLoader", 27 BrowserContextDependencyManager::GetInstance()) { 28 } 29 ~ImageLoaderFactory()30ImageLoaderFactory::~ImageLoaderFactory() { 31 } 32 BuildServiceInstanceFor(content::BrowserContext * context) const33KeyedService* ImageLoaderFactory::BuildServiceInstanceFor( 34 content::BrowserContext* context) const { 35 return new ImageLoader; 36 } 37 ServiceIsCreatedWithBrowserContext() const38bool ImageLoaderFactory::ServiceIsCreatedWithBrowserContext() const { 39 return false; 40 } 41 GetBrowserContextToUse(content::BrowserContext * context) const42content::BrowserContext* ImageLoaderFactory::GetBrowserContextToUse( 43 content::BrowserContext* context) const { 44 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); 45 } 46 47 } // namespace extensions 48