1ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// Copyright (c) 2011 The Chromium Authors. All rights reserved. 2ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// Use of this source code is governed by a BSD-style license that can be 3ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// found in the LICENSE file. 4ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 5ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen#include "chrome/browser/background_contents_service_factory.h" 6ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 7ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen#include "base/command_line.h" 8ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen#include "chrome/browser/background_contents_service.h" 9ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen#include "chrome/browser/profiles/profile.h" 10ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen#include "chrome/browser/profiles/profile_dependency_manager.h" 11ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 12ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// static 13ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian MonsenBackgroundContentsService* BackgroundContentsServiceFactory::GetForProfile( 14ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen Profile* profile) { 15ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen return static_cast<BackgroundContentsService*>( 16ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen GetInstance()->GetServiceForProfile(profile)); 17ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen} 18ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 19ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// static 20ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian MonsenBackgroundContentsServiceFactory* BackgroundContentsServiceFactory:: 21ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen GetInstance() { 22ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen return Singleton<BackgroundContentsServiceFactory>::get(); 23ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen} 24ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 25ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian MonsenBackgroundContentsServiceFactory::BackgroundContentsServiceFactory() 26ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen : ProfileKeyedServiceFactory(ProfileDependencyManager::GetInstance()) { 27ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen} 28ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 29ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian MonsenBackgroundContentsServiceFactory::~BackgroundContentsServiceFactory() { 30ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen} 31ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 32ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian MonsenProfileKeyedService* BackgroundContentsServiceFactory::BuildServiceInstanceFor( 33ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen Profile* profile) const { 34ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen return new BackgroundContentsService(profile, 35ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen CommandLine::ForCurrentProcess()); 36ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen} 37ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 38ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsenbool BackgroundContentsServiceFactory::ServiceHasOwnInstanceInIncognito() { 39ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen return true; 40ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen} 41