| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/supervised_user/chromeos/manager_password_service_facto
ry.h" | 5 #include "chrome/browser/supervised_user/chromeos/manager_password_service_facto
ry.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 7 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 8 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 8 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 9 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 9 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/supervised_user/chromeos/manager_password_service.h" | 12 #include "chrome/browser/supervised_user/chromeos/manager_password_service.h" |
| 12 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
_factory.h" | 13 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
_factory.h" |
| 13 #include "chrome/browser/supervised_user/supervised_user_sync_service_factory.h" | 14 #include "chrome/browser/supervised_user/supervised_user_sync_service_factory.h" |
| 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 15 #include "components/user_manager/user.h" | 16 #include "components/user_manager/user.h" |
| 16 | 17 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 36 DependsOn(SupervisedUserSharedSettingsServiceFactory::GetInstance()); | 37 DependsOn(SupervisedUserSharedSettingsServiceFactory::GetInstance()); |
| 37 DependsOn(SupervisedUserSyncServiceFactory::GetInstance()); | 38 DependsOn(SupervisedUserSyncServiceFactory::GetInstance()); |
| 38 } | 39 } |
| 39 | 40 |
| 40 ManagerPasswordServiceFactory:: | 41 ManagerPasswordServiceFactory:: |
| 41 ~ManagerPasswordServiceFactory() {} | 42 ~ManagerPasswordServiceFactory() {} |
| 42 | 43 |
| 43 KeyedService* ManagerPasswordServiceFactory::BuildServiceInstanceFor( | 44 KeyedService* ManagerPasswordServiceFactory::BuildServiceInstanceFor( |
| 44 content::BrowserContext* context) const { | 45 content::BrowserContext* context) const { |
| 45 Profile* profile= static_cast<Profile*>(context); | 46 Profile* profile= static_cast<Profile*>(context); |
| 46 user_manager::User* user = | 47 user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile); |
| 47 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 48 if (ChromeUserManager::Get()->GetSupervisedUserManager()->HasSupervisedUsers( |
| 48 if (chromeos::UserManager::Get()->GetSupervisedUserManager()-> | 49 user->email())) { |
| 49 HasSupervisedUsers(user->email())) { | |
| 50 ManagerPasswordService* result = new ManagerPasswordService(); | 50 ManagerPasswordService* result = new ManagerPasswordService(); |
| 51 result->Init( | 51 result->Init( |
| 52 user->email(), | 52 user->email(), |
| 53 SupervisedUserSyncServiceFactory::GetForProfile(profile), | 53 SupervisedUserSyncServiceFactory::GetForProfile(profile), |
| 54 SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext( | 54 SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext( |
| 55 profile)); | 55 profile)); |
| 56 return result; | 56 return result; |
| 57 } | 57 } |
| 58 return NULL; | 58 return NULL; |
| 59 } | 59 } |
| 60 | 60 |
| 61 content::BrowserContext* | 61 content::BrowserContext* |
| 62 ManagerPasswordServiceFactory::GetBrowserContextToUse( | 62 ManagerPasswordServiceFactory::GetBrowserContextToUse( |
| 63 content::BrowserContext* context) const { | 63 content::BrowserContext* context) const { |
| 64 return chrome::GetBrowserContextRedirectedInIncognito(context); | 64 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace chromeos | 67 } // namespace chromeos |
| OLD | NEW |