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.
5 #include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h"
7 #include "chrome/browser/profiles/incognito_helpers.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/supervised_user/supervised_user_settings_service.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 SupervisedUserSettingsService
*
14 SupervisedUserSettingsServiceFactory::GetForProfile(Profile
* profile
) {
15 return static_cast<SupervisedUserSettingsService
*>(
16 GetInstance()->GetServiceForBrowserContext(profile
, true));
20 SupervisedUserSettingsServiceFactory
*
21 SupervisedUserSettingsServiceFactory::GetInstance() {
22 return Singleton
<SupervisedUserSettingsServiceFactory
>::get();
25 SupervisedUserSettingsServiceFactory::SupervisedUserSettingsServiceFactory()
26 : BrowserContextKeyedServiceFactory(
27 "SupervisedUserSettingsService",
28 BrowserContextDependencyManager::GetInstance()) {
31 SupervisedUserSettingsServiceFactory::
32 ~SupervisedUserSettingsServiceFactory() {}
34 KeyedService
* SupervisedUserSettingsServiceFactory::BuildServiceInstanceFor(
35 content::BrowserContext
* profile
) const {
36 return new SupervisedUserSettingsService(
37 Profile::FromBrowserContext(profile
));
40 content::BrowserContext
*
41 SupervisedUserSettingsServiceFactory::GetBrowserContextToUse(
42 content::BrowserContext
* context
) const {
43 return chrome::GetBrowserContextRedirectedInIncognito(context
);