| 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/chrome_user_manager.h" |
| 8 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 8 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 9 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 9 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 10 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 ManagerPasswordServiceFactory:: | 41 ManagerPasswordServiceFactory:: |
| 42 ~ManagerPasswordServiceFactory() {} | 42 ~ManagerPasswordServiceFactory() {} |
| 43 | 43 |
| 44 KeyedService* ManagerPasswordServiceFactory::BuildServiceInstanceFor( | 44 KeyedService* ManagerPasswordServiceFactory::BuildServiceInstanceFor( |
| 45 content::BrowserContext* context) const { | 45 content::BrowserContext* context) const { |
| 46 Profile* profile = static_cast<Profile*>(context); | 46 Profile* profile = static_cast<Profile*>(context); |
| 47 const user_manager::User* user = | 47 const user_manager::User* user = |
| 48 ProfileHelper::Get()->GetUserByProfile(profile); | 48 ProfileHelper::Get()->GetUserByProfile(profile); |
| 49 if (ChromeUserManager::Get()->GetSupervisedUserManager()->HasSupervisedUsers( | 49 if (ChromeUserManager::Get()->GetSupervisedUserManager()->HasSupervisedUsers( |
| 50 user->email())) { | 50 user->GetUserID())) { |
| 51 ManagerPasswordService* result = new ManagerPasswordService(); | 51 ManagerPasswordService* result = new ManagerPasswordService(); |
| 52 result->Init( | 52 result->Init( |
| 53 user->email(), | 53 user->GetUserID(), |
| 54 SupervisedUserSyncServiceFactory::GetForProfile(profile), | 54 SupervisedUserSyncServiceFactory::GetForProfile(profile), |
| 55 SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext( | 55 SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext( |
| 56 profile)); | 56 profile)); |
| 57 return result; | 57 return result; |
| 58 } | 58 } |
| 59 return NULL; | 59 return NULL; |
| 60 } | 60 } |
| 61 | 61 |
| 62 content::BrowserContext* | 62 content::BrowserContext* |
| 63 ManagerPasswordServiceFactory::GetBrowserContextToUse( | 63 ManagerPasswordServiceFactory::GetBrowserContextToUse( |
| 64 content::BrowserContext* context) const { | 64 content::BrowserContext* context) const { |
| 65 return chrome::GetBrowserContextRedirectedInIncognito(context); | 65 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace chromeos | 68 } // namespace chromeos |
| OLD | NEW |