app_restore_service_factory.cc revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
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. 4 5#include "apps/app_restore_service_factory.h" 6 7#include "apps/app_restore_service.h" 8#include "chrome/browser/profiles/profile.h" 9#include "chrome/browser/profiles/profile_dependency_manager.h" 10 11namespace apps { 12 13// static 14AppRestoreService* AppRestoreServiceFactory::GetForProfile(Profile* profile) { 15 return static_cast<AppRestoreService*>( 16 GetInstance()->GetServiceForProfile(profile, true)); 17} 18 19// static 20void AppRestoreServiceFactory::ResetForProfile(Profile* profile) { 21 AppRestoreServiceFactory* factory = GetInstance(); 22 factory->ProfileShutdown(profile); 23 factory->ProfileDestroyed(profile); 24} 25 26AppRestoreServiceFactory* AppRestoreServiceFactory::GetInstance() { 27 return Singleton<AppRestoreServiceFactory>::get(); 28} 29 30AppRestoreServiceFactory::AppRestoreServiceFactory() 31 : ProfileKeyedServiceFactory("AppRestoreService", 32 ProfileDependencyManager::GetInstance()) { 33} 34 35AppRestoreServiceFactory::~AppRestoreServiceFactory() { 36} 37 38ProfileKeyedService* AppRestoreServiceFactory::BuildServiceInstanceFor( 39 content::BrowserContext* profile) const { 40 return new AppRestoreService(static_cast<Profile*>(profile)); 41} 42 43bool AppRestoreServiceFactory::ServiceIsCreatedWithProfile() const { 44 return true; 45} 46 47} // namespace apps 48