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 "chrome/browser/supervised_user/supervised_user_sync_service_factory.h" 6 7#include "chrome/browser/profiles/profile.h" 8#include "chrome/browser/supervised_user/supervised_user_sync_service.h" 9#include "components/keyed_service/content/browser_context_dependency_manager.h" 10 11// static 12SupervisedUserSyncService* SupervisedUserSyncServiceFactory::GetForProfile( 13 Profile* profile) { 14 return static_cast<SupervisedUserSyncService*>( 15 GetInstance()->GetServiceForBrowserContext(profile, true)); 16} 17 18// static 19SupervisedUserSyncServiceFactory* 20SupervisedUserSyncServiceFactory::GetInstance() { 21 return Singleton<SupervisedUserSyncServiceFactory>::get(); 22} 23 24SupervisedUserSyncServiceFactory::SupervisedUserSyncServiceFactory() 25 : BrowserContextKeyedServiceFactory( 26 "SupervisedUserSyncService", 27 BrowserContextDependencyManager::GetInstance()) { 28} 29 30SupervisedUserSyncServiceFactory::~SupervisedUserSyncServiceFactory() {} 31 32KeyedService* SupervisedUserSyncServiceFactory::BuildServiceInstanceFor( 33 content::BrowserContext* profile) const { 34 return new SupervisedUserSyncService( 35 static_cast<Profile*>(profile)->GetPrefs()); 36} 37