| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chromeos/login/users/fake_chrome_user_manager.h" | 5 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 10 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 return AddUserWithAffiliation(account_id, false); | 42 return AddUserWithAffiliation(account_id, false); |
| 43 } | 43 } |
| 44 | 44 |
| 45 const user_manager::User* FakeChromeUserManager::AddUserWithAffiliation( | 45 const user_manager::User* FakeChromeUserManager::AddUserWithAffiliation( |
| 46 const AccountId& account_id, | 46 const AccountId& account_id, |
| 47 bool is_affiliated) { | 47 bool is_affiliated) { |
| 48 user_manager::User* user = user_manager::User::CreateRegularUser(account_id); | 48 user_manager::User* user = user_manager::User::CreateRegularUser(account_id); |
| 49 user->SetAffiliation(is_affiliated); | 49 user->SetAffiliation(is_affiliated); |
| 50 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( | 50 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( |
| 51 account_id.GetUserEmail())); | 51 account_id.GetUserEmail())); |
| 52 user->SetStubImage(base::WrapUnique(new user_manager::UserImage( | 52 user->SetStubImage(base::MakeUnique<user_manager::UserImage>( |
| 53 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 53 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 54 IDR_PROFILE_PICTURE_LOADING))), | 54 IDR_PROFILE_PICTURE_LOADING)), |
| 55 user_manager::User::USER_IMAGE_PROFILE, false); | 55 user_manager::User::USER_IMAGE_PROFILE, false); |
| 56 users_.push_back(user); | 56 users_.push_back(user); |
| 57 chromeos::ProfileHelper::Get()->SetProfileToUserMappingForTesting(user); | 57 chromeos::ProfileHelper::Get()->SetProfileToUserMappingForTesting(user); |
| 58 return user; | 58 return user; |
| 59 } | 59 } |
| 60 | 60 |
| 61 user_manager::User* FakeChromeUserManager::AddKioskAppUser( | 61 user_manager::User* FakeChromeUserManager::AddKioskAppUser( |
| 62 const AccountId& account_id) { | 62 const AccountId& account_id) { |
| 63 user_manager::User* user = user_manager::User::CreateKioskAppUser(account_id); | 63 user_manager::User* user = user_manager::User::CreateKioskAppUser(account_id); |
| 64 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( | 64 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( |
| 65 account_id.GetUserEmail())); | 65 account_id.GetUserEmail())); |
| 66 users_.push_back(user); | 66 users_.push_back(user); |
| 67 return user; | 67 return user; |
| 68 } | 68 } |
| 69 | 69 |
| 70 const user_manager::User* FakeChromeUserManager::AddPublicAccountUser( | 70 const user_manager::User* FakeChromeUserManager::AddPublicAccountUser( |
| 71 const AccountId& account_id) { | 71 const AccountId& account_id) { |
| 72 user_manager::User* user = | 72 user_manager::User* user = |
| 73 user_manager::User::CreatePublicAccountUser(account_id); | 73 user_manager::User::CreatePublicAccountUser(account_id); |
| 74 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( | 74 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( |
| 75 account_id.GetUserEmail())); | 75 account_id.GetUserEmail())); |
| 76 user->SetStubImage(base::WrapUnique(new user_manager::UserImage( | 76 user->SetStubImage(base::MakeUnique<user_manager::UserImage>( |
| 77 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 77 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 78 IDR_PROFILE_PICTURE_LOADING))), | 78 IDR_PROFILE_PICTURE_LOADING)), |
| 79 user_manager::User::USER_IMAGE_PROFILE, false); | 79 user_manager::User::USER_IMAGE_PROFILE, false); |
| 80 users_.push_back(user); | 80 users_.push_back(user); |
| 81 chromeos::ProfileHelper::Get()->SetProfileToUserMappingForTesting(user); | 81 chromeos::ProfileHelper::Get()->SetProfileToUserMappingForTesting(user); |
| 82 return user; | 82 return user; |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool FakeChromeUserManager::AreEphemeralUsersEnabled() const { | 85 bool FakeChromeUserManager::AreEphemeralUsersEnabled() const { |
| 86 return fake_ephemeral_users_enabled_; | 86 return fake_ephemeral_users_enabled_; |
| 87 } | 87 } |
| 88 | 88 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 NOTIMPLEMENTED(); | 281 NOTIMPLEMENTED(); |
| 282 return; | 282 return; |
| 283 } | 283 } |
| 284 | 284 |
| 285 bool FakeChromeUserManager::IsValidDefaultUserImageId(int image_index) const { | 285 bool FakeChromeUserManager::IsValidDefaultUserImageId(int image_index) const { |
| 286 NOTIMPLEMENTED(); | 286 NOTIMPLEMENTED(); |
| 287 return false; | 287 return false; |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace chromeos | 290 } // namespace chromeos |
| OLD | NEW |