1 // Copyright 2013 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/managed_mode/managed_user_settings_service_factory.h"
7 #include "chrome/browser/managed_mode/managed_user_settings_service.h"
8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
13 ManagedUserSettingsService
*
14 ManagedUserSettingsServiceFactory::GetForProfile(Profile
* profile
) {
15 return static_cast<ManagedUserSettingsService
*>(
16 GetInstance()->GetServiceForBrowserContext(profile
, true));
20 ManagedUserSettingsServiceFactory
*
21 ManagedUserSettingsServiceFactory::GetInstance() {
22 return Singleton
<ManagedUserSettingsServiceFactory
>::get();
25 ManagedUserSettingsServiceFactory::ManagedUserSettingsServiceFactory()
26 : BrowserContextKeyedServiceFactory(
27 "ManagedUserSettingsService",
28 BrowserContextDependencyManager::GetInstance()) {
31 ManagedUserSettingsServiceFactory::
32 ~ManagedUserSettingsServiceFactory() {}
34 BrowserContextKeyedService
*
35 ManagedUserSettingsServiceFactory::BuildServiceInstanceFor(
36 content::BrowserContext
* profile
) const {
37 return new ManagedUserSettingsService();
40 content::BrowserContext
*
41 ManagedUserSettingsServiceFactory::GetBrowserContextToUse(
42 content::BrowserContext
* context
) const {
43 return chrome::GetBrowserContextRedirectedInIncognito(context
);