| 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/managed_mode/managed_user_service_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_system_factory.h" | 7 #include "chrome/browser/extensions/extension_system_factory.h" |
| 8 #include "chrome/browser/managed_mode/managed_user_service.h" | 8 #include "chrome/browser/managed_mode/managed_user_service.h" |
| 9 #include "chrome/browser/profiles/incognito_helpers.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/profiles/profile_dependency_manager.h" | 11 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 11 | 12 |
| 12 // static | 13 // static |
| 13 ManagedUserService* ManagedUserServiceFactory::GetForProfile(Profile* profile) { | 14 ManagedUserService* ManagedUserServiceFactory::GetForProfile(Profile* profile) { |
| 14 return static_cast<ManagedUserService*>( | 15 return static_cast<ManagedUserService*>( |
| 15 GetInstance()->GetServiceForProfile(profile, true)); | 16 GetInstance()->GetServiceForProfile(profile, true)); |
| 16 } | 17 } |
| 17 | 18 |
| 18 // static | 19 // static |
| 19 ManagedUserServiceFactory* ManagedUserServiceFactory::GetInstance() { | 20 ManagedUserServiceFactory* ManagedUserServiceFactory::GetInstance() { |
| 20 return Singleton<ManagedUserServiceFactory>::get(); | 21 return Singleton<ManagedUserServiceFactory>::get(); |
| 21 } | 22 } |
| 22 | 23 |
| 23 // static | 24 // static |
| 24 ProfileKeyedService* ManagedUserServiceFactory::BuildInstanceFor( | 25 ProfileKeyedService* ManagedUserServiceFactory::BuildInstanceFor( |
| 25 Profile* profile) { | 26 Profile* profile) { |
| 26 return new ManagedUserService(profile); | 27 return new ManagedUserService(profile); |
| 27 } | 28 } |
| 28 | 29 |
| 29 ManagedUserServiceFactory::ManagedUserServiceFactory() | 30 ManagedUserServiceFactory::ManagedUserServiceFactory() |
| 30 : ProfileKeyedServiceFactory("ManagedUserService", | 31 : ProfileKeyedServiceFactory("ManagedUserService", |
| 31 ProfileDependencyManager::GetInstance()) { | 32 ProfileDependencyManager::GetInstance()) { |
| 32 DependsOn(extensions::ExtensionSystemFactory::GetInstance()); | 33 DependsOn(extensions::ExtensionSystemFactory::GetInstance()); |
| 33 } | 34 } |
| 34 | 35 |
| 35 ManagedUserServiceFactory::~ManagedUserServiceFactory() {} | 36 ManagedUserServiceFactory::~ManagedUserServiceFactory() {} |
| 36 | 37 |
| 37 bool ManagedUserServiceFactory::ServiceRedirectedInIncognito() const { | 38 content::BrowserContext* ManagedUserServiceFactory::GetBrowserContextToUse( |
| 38 return true; | 39 content::BrowserContext* context) const { |
| 40 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 39 } | 41 } |
| 40 | 42 |
| 41 ProfileKeyedService* ManagedUserServiceFactory::BuildServiceInstanceFor( | 43 ProfileKeyedService* ManagedUserServiceFactory::BuildServiceInstanceFor( |
| 42 content::BrowserContext* profile) const { | 44 content::BrowserContext* profile) const { |
| 43 return BuildInstanceFor(static_cast<Profile*>(profile)); | 45 return BuildInstanceFor(static_cast<Profile*>(profile)); |
| 44 } | 46 } |
| OLD | NEW |