| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 5 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/managed_mode/managed_user_service.h" | |
| 8 #include "chrome/browser/profiles/incognito_helpers.h" | 7 #include "chrome/browser/profiles/incognito_helpers.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 10 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 12 #include "extensions/browser/extension_system_provider.h" | 12 #include "extensions/browser/extension_system_provider.h" |
| 13 #include "extensions/browser/extensions_browser_client.h" | 13 #include "extensions/browser/extensions_browser_client.h" |
| 14 | 14 |
| 15 // static | 15 // static |
| 16 ManagedUserService* ManagedUserServiceFactory::GetForProfile(Profile* profile) { | 16 SupervisedUserService* SupervisedUserServiceFactory::GetForProfile( |
| 17 return static_cast<ManagedUserService*>( | 17 Profile* profile) { |
| 18 return static_cast<SupervisedUserService*>( |
| 18 GetInstance()->GetServiceForBrowserContext(profile, true)); | 19 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 19 } | 20 } |
| 20 | 21 |
| 21 // static | 22 // static |
| 22 ManagedUserServiceFactory* ManagedUserServiceFactory::GetInstance() { | 23 SupervisedUserServiceFactory* SupervisedUserServiceFactory::GetInstance() { |
| 23 return Singleton<ManagedUserServiceFactory>::get(); | 24 return Singleton<SupervisedUserServiceFactory>::get(); |
| 24 } | 25 } |
| 25 | 26 |
| 26 // static | 27 // static |
| 27 KeyedService* ManagedUserServiceFactory::BuildInstanceFor(Profile* profile) { | 28 KeyedService* SupervisedUserServiceFactory::BuildInstanceFor(Profile* profile) { |
| 28 return new ManagedUserService(profile); | 29 return new SupervisedUserService(profile); |
| 29 } | 30 } |
| 30 | 31 |
| 31 ManagedUserServiceFactory::ManagedUserServiceFactory() | 32 SupervisedUserServiceFactory::SupervisedUserServiceFactory() |
| 32 : BrowserContextKeyedServiceFactory( | 33 : BrowserContextKeyedServiceFactory( |
| 33 "ManagedUserService", | 34 "SupervisedUserService", |
| 34 BrowserContextDependencyManager::GetInstance()) { | 35 BrowserContextDependencyManager::GetInstance()) { |
| 35 DependsOn( | 36 DependsOn( |
| 36 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 37 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
| 37 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | 38 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
| 38 } | 39 } |
| 39 | 40 |
| 40 ManagedUserServiceFactory::~ManagedUserServiceFactory() {} | 41 SupervisedUserServiceFactory::~SupervisedUserServiceFactory() {} |
| 41 | 42 |
| 42 content::BrowserContext* ManagedUserServiceFactory::GetBrowserContextToUse( | 43 content::BrowserContext* SupervisedUserServiceFactory::GetBrowserContextToUse( |
| 43 content::BrowserContext* context) const { | 44 content::BrowserContext* context) const { |
| 44 return chrome::GetBrowserContextRedirectedInIncognito(context); | 45 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 45 } | 46 } |
| 46 | 47 |
| 47 KeyedService* ManagedUserServiceFactory::BuildServiceInstanceFor( | 48 KeyedService* SupervisedUserServiceFactory::BuildServiceInstanceFor( |
| 48 content::BrowserContext* profile) const { | 49 content::BrowserContext* profile) const { |
| 49 return BuildInstanceFor(static_cast<Profile*>(profile)); | 50 return BuildInstanceFor(static_cast<Profile*>(profile)); |
| 50 } | 51 } |
| OLD | NEW |