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#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" 5 6#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" 7#include "chrome/browser/profiles/profile.h" 8#include "components/keyed_service/content/browser_context_dependency_manager.h" 9 10/// Factory 11BitmapFetcherService* BitmapFetcherServiceFactory::GetForBrowserContext( 12 content::BrowserContext* profile) { 13 return static_cast<BitmapFetcherService*>( 14 GetInstance()->GetServiceForBrowserContext(profile, true)); 15} 16 17// static 18BitmapFetcherServiceFactory* BitmapFetcherServiceFactory::GetInstance() { 19 return Singleton<BitmapFetcherServiceFactory>::get(); 20} 21 22BitmapFetcherServiceFactory::BitmapFetcherServiceFactory() 23 : BrowserContextKeyedServiceFactory( 24 "BitmapFetcherService", 25 BrowserContextDependencyManager::GetInstance()) { 26} 27 28BitmapFetcherServiceFactory::~BitmapFetcherServiceFactory() { 29} 30 31KeyedService* BitmapFetcherServiceFactory::BuildServiceInstanceFor( 32 content::BrowserContext* context) const { 33 Profile* profile = static_cast<Profile*>(context); 34 DCHECK(!profile->IsOffTheRecord()); 35 return new BitmapFetcherService(profile); 36} 37