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_settings_service_factory.h"
6
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"
11
12// static
13SupervisedUserSettingsService*
14SupervisedUserSettingsServiceFactory::GetForProfile(Profile* profile) {
15  return static_cast<SupervisedUserSettingsService*>(
16      GetInstance()->GetServiceForBrowserContext(profile, true));
17}
18
19// static
20SupervisedUserSettingsServiceFactory*
21SupervisedUserSettingsServiceFactory::GetInstance() {
22  return Singleton<SupervisedUserSettingsServiceFactory>::get();
23}
24
25SupervisedUserSettingsServiceFactory::SupervisedUserSettingsServiceFactory()
26    : BrowserContextKeyedServiceFactory(
27          "SupervisedUserSettingsService",
28          BrowserContextDependencyManager::GetInstance()) {
29}
30
31SupervisedUserSettingsServiceFactory::
32    ~SupervisedUserSettingsServiceFactory() {}
33
34KeyedService* SupervisedUserSettingsServiceFactory::BuildServiceInstanceFor(
35    content::BrowserContext* profile) const {
36  return new SupervisedUserSettingsService();
37}
38
39content::BrowserContext*
40SupervisedUserSettingsServiceFactory::GetBrowserContextToUse(
41    content::BrowserContext* context) const {
42  return chrome::GetBrowserContextRedirectedInIncognito(context);
43}
44