• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
GetForProfile(Profile * profile)12 SupervisedUserSyncService* SupervisedUserSyncServiceFactory::GetForProfile(
13     Profile* profile) {
14   return static_cast<SupervisedUserSyncService*>(
15       GetInstance()->GetServiceForBrowserContext(profile, true));
16 }
17 
18 // static
19 SupervisedUserSyncServiceFactory*
GetInstance()20 SupervisedUserSyncServiceFactory::GetInstance() {
21   return Singleton<SupervisedUserSyncServiceFactory>::get();
22 }
23 
SupervisedUserSyncServiceFactory()24 SupervisedUserSyncServiceFactory::SupervisedUserSyncServiceFactory()
25     : BrowserContextKeyedServiceFactory(
26           "SupervisedUserSyncService",
27           BrowserContextDependencyManager::GetInstance()) {
28 }
29 
~SupervisedUserSyncServiceFactory()30 SupervisedUserSyncServiceFactory::~SupervisedUserSyncServiceFactory() {}
31 
BuildServiceInstanceFor(content::BrowserContext * profile) const32 KeyedService* SupervisedUserSyncServiceFactory::BuildServiceInstanceFor(
33     content::BrowserContext* profile) const {
34   return new SupervisedUserSyncService(
35       static_cast<Profile*>(profile)->GetPrefs());
36 }
37