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_shared_settings_service_factory.h" 6 7 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service.h" 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" 9 #include "components/user_prefs/user_prefs.h" 10 #include "content/public/browser/browser_context.h" 11 12 // static 13 SupervisedUserSharedSettingsService* GetForBrowserContext(content::BrowserContext * profile)14SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext( 15 content::BrowserContext* profile) { 16 return static_cast<SupervisedUserSharedSettingsService*>( 17 GetInstance()->GetServiceForBrowserContext(profile, true)); 18 } 19 20 // static 21 SupervisedUserSharedSettingsServiceFactory* GetInstance()22SupervisedUserSharedSettingsServiceFactory::GetInstance() { 23 return Singleton<SupervisedUserSharedSettingsServiceFactory>::get(); 24 } 25 26 SupervisedUserSharedSettingsServiceFactory:: SupervisedUserSharedSettingsServiceFactory()27 SupervisedUserSharedSettingsServiceFactory() 28 : BrowserContextKeyedServiceFactory( 29 "SupervisedUserSharedSettingsService", 30 BrowserContextDependencyManager::GetInstance()) {} 31 32 SupervisedUserSharedSettingsServiceFactory:: ~SupervisedUserSharedSettingsServiceFactory()33 ~SupervisedUserSharedSettingsServiceFactory() {} 34 35 KeyedService* BuildServiceInstanceFor(content::BrowserContext * profile) const36SupervisedUserSharedSettingsServiceFactory::BuildServiceInstanceFor( 37 content::BrowserContext* profile) const { 38 return new SupervisedUserSharedSettingsService( 39 user_prefs::UserPrefs::Get(profile)); 40 } 41