| 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/sys_info.h" | 9 #include "base/sys_info.h" |
| 9 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 10 #include "chrome/browser/chromeos/login/users/chrome_user_manager_util.h" | 11 #include "chrome/browser/chromeos/login/users/chrome_user_manager_util.h" |
| 11 #include "chrome/browser/chromeos/login/users/fake_supervised_user_manager.h" | 12 #include "chrome/browser/chromeos/login/users/fake_supervised_user_manager.h" |
| 12 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 13 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 13 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 14 #include "chrome/browser/chromeos/settings/cros_settings.h" | 15 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 15 #include "chrome/grit/theme_resources.h" | 16 #include "chrome/grit/theme_resources.h" |
| 16 #include "chromeos/chromeos_switches.h" | 17 #include "chromeos/chromeos_switches.h" |
| 17 #include "chromeos/login/login_state.h" | 18 #include "chromeos/login/login_state.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 41 return AddUserWithAffiliation(account_id, false); | 42 return AddUserWithAffiliation(account_id, false); |
| 42 } | 43 } |
| 43 | 44 |
| 44 const user_manager::User* FakeChromeUserManager::AddUserWithAffiliation( | 45 const user_manager::User* FakeChromeUserManager::AddUserWithAffiliation( |
| 45 const AccountId& account_id, | 46 const AccountId& account_id, |
| 46 bool is_affiliated) { | 47 bool is_affiliated) { |
| 47 user_manager::User* user = user_manager::User::CreateRegularUser(account_id); | 48 user_manager::User* user = user_manager::User::CreateRegularUser(account_id); |
| 48 user->SetAffiliation(is_affiliated); | 49 user->SetAffiliation(is_affiliated); |
| 49 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( | 50 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( |
| 50 account_id.GetUserEmail())); | 51 account_id.GetUserEmail())); |
| 51 user->SetStubImage(make_scoped_ptr(new user_manager::UserImage( | 52 user->SetStubImage(base::WrapUnique(new user_manager::UserImage( |
| 52 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 53 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 53 IDR_PROFILE_PICTURE_LOADING))), | 54 IDR_PROFILE_PICTURE_LOADING))), |
| 54 user_manager::User::USER_IMAGE_PROFILE, false); | 55 user_manager::User::USER_IMAGE_PROFILE, false); |
| 55 users_.push_back(user); | 56 users_.push_back(user); |
| 56 chromeos::ProfileHelper::Get()->SetProfileToUserMappingForTesting(user); | 57 chromeos::ProfileHelper::Get()->SetProfileToUserMappingForTesting(user); |
| 57 return user; | 58 return user; |
| 58 } | 59 } |
| 59 | 60 |
| 60 const user_manager::User* FakeChromeUserManager::AddPublicAccountUser( | 61 const user_manager::User* FakeChromeUserManager::AddPublicAccountUser( |
| 61 const AccountId& account_id) { | 62 const AccountId& account_id) { |
| 62 user_manager::User* user = | 63 user_manager::User* user = |
| 63 user_manager::User::CreatePublicAccountUser(account_id); | 64 user_manager::User::CreatePublicAccountUser(account_id); |
| 64 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( | 65 user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( |
| 65 account_id.GetUserEmail())); | 66 account_id.GetUserEmail())); |
| 66 user->SetStubImage(make_scoped_ptr(new user_manager::UserImage( | 67 user->SetStubImage(base::WrapUnique(new user_manager::UserImage( |
| 67 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 68 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 68 IDR_PROFILE_PICTURE_LOADING))), | 69 IDR_PROFILE_PICTURE_LOADING))), |
| 69 user_manager::User::USER_IMAGE_PROFILE, false); | 70 user_manager::User::USER_IMAGE_PROFILE, false); |
| 70 users_.push_back(user); | 71 users_.push_back(user); |
| 71 return user; | 72 return user; |
| 72 } | 73 } |
| 73 | 74 |
| 74 void FakeChromeUserManager::AddKioskAppUser( | 75 void FakeChromeUserManager::AddKioskAppUser( |
| 75 const AccountId& kiosk_app_account_id) { | 76 const AccountId& kiosk_app_account_id) { |
| 76 user_manager::User* user = | 77 user_manager::User* user = |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 NOTIMPLEMENTED(); | 268 NOTIMPLEMENTED(); |
| 268 return; | 269 return; |
| 269 } | 270 } |
| 270 | 271 |
| 271 bool FakeChromeUserManager::IsValidDefaultUserImageId(int image_index) const { | 272 bool FakeChromeUserManager::IsValidDefaultUserImageId(int image_index) const { |
| 272 NOTIMPLEMENTED(); | 273 NOTIMPLEMENTED(); |
| 273 return false; | 274 return false; |
| 274 } | 275 } |
| 275 | 276 |
| 276 } // namespace chromeos | 277 } // namespace chromeos |
| OLD | NEW |