Chromium Code Reviews| Index: chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc |
| diff --git a/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc b/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc |
| index 7191f0c10b7bc0106f7e5bdc304d78bdae1ae85f..88fec2c907a98679e422d4c8bb8baeae5f1f02e7 100644 |
| --- a/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc |
| +++ b/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc |
| @@ -20,24 +20,23 @@ class FakeSupervisedUserManager; |
| FakeChromeUserManager::FakeChromeUserManager() |
| : supervised_user_manager_(new FakeSupervisedUserManager), |
| bootstrap_manager_(NULL), |
| - multi_profile_user_controller_(NULL) { |
| -} |
| + multi_profile_user_controller_(NULL) {} |
| FakeChromeUserManager::~FakeChromeUserManager() { |
| } |
| const user_manager::User* FakeChromeUserManager::AddUser( |
| - const std::string& email) { |
| - return AddUserWithAffiliation(email, false); |
| + const AccountId& account_id) { |
| + return AddUserWithAffiliation(account_id, false); |
| } |
| const user_manager::User* FakeChromeUserManager::AddUserWithAffiliation( |
| - const std::string& email, |
| + const AccountId& account_id, |
| bool is_affiliated) { |
| - user_manager::User* user = user_manager::User::CreateRegularUser(email); |
| + user_manager::User* user = user_manager::User::CreateRegularUser(account_id); |
| user->set_affiliation(is_affiliated); |
| - user->set_username_hash( |
| - ProfileHelper::GetUserIdHashByUserIdForTesting(email)); |
| + user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( |
| + account_id.GetUserEmail())); |
| user->SetStubImage(user_manager::UserImage( |
| *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| IDR_PROFILE_PICTURE_LOADING)), |
| @@ -47,10 +46,11 @@ const user_manager::User* FakeChromeUserManager::AddUserWithAffiliation( |
| } |
| const user_manager::User* FakeChromeUserManager::AddPublicAccountUser( |
| - const std::string& email) { |
| - user_manager::User* user = user_manager::User::CreatePublicAccountUser(email); |
| - user->set_username_hash( |
| - ProfileHelper::GetUserIdHashByUserIdForTesting(email)); |
| + const AccountId& account_id) { |
| + user_manager::User* user = |
| + user_manager::User::CreatePublicAccountUser(account_id); |
| + user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( |
|
achuithb
2015/10/28 23:11:45
This will eventually take AccountId, right?
Alexander Alekseev
2015/10/29 02:00:41
Yes.
|
| + account_id.GetUserEmail())); |
| user->SetStubImage(user_manager::UserImage( |
| *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| IDR_PROFILE_PICTURE_LOADING)), |
| @@ -60,16 +60,17 @@ const user_manager::User* FakeChromeUserManager::AddPublicAccountUser( |
| } |
| void FakeChromeUserManager::AddKioskAppUser( |
| - const std::string& kiosk_app_username) { |
| + const AccountId& kiosk_app_account_id) { |
| user_manager::User* user = |
| - user_manager::User::CreateKioskAppUser(kiosk_app_username); |
| - user->set_username_hash( |
| - ProfileHelper::GetUserIdHashByUserIdForTesting(kiosk_app_username)); |
| + user_manager::User::CreateKioskAppUser(kiosk_app_account_id); |
| + user->set_username_hash(ProfileHelper::GetUserIdHashByUserIdForTesting( |
| + kiosk_app_account_id.GetUserEmail())); |
| users_.push_back(user); |
| } |
| -void FakeChromeUserManager::LoginUser(const std::string& email) { |
| - UserLoggedIn(email, ProfileHelper::GetUserIdHashByUserIdForTesting(email), |
| +void FakeChromeUserManager::LoginUser(const AccountId& account_id) { |
| + UserLoggedIn(account_id, ProfileHelper::GetUserIdHashByUserIdForTesting( |
| + account_id.GetUserEmail()), |
| false /* browser_restart */); |
| } |
| @@ -87,58 +88,59 @@ SupervisedUserManager* FakeChromeUserManager::GetSupervisedUserManager() { |
| } |
| UserImageManager* FakeChromeUserManager::GetUserImageManager( |
| - const std::string& /* user_id */) { |
| + const AccountId& /* account_id */) { |
| return nullptr; |
| } |
| -void FakeChromeUserManager::SetUserFlow(const std::string& email, |
| +void FakeChromeUserManager::SetUserFlow(const AccountId& account_id, |
| UserFlow* flow) { |
| - ResetUserFlow(email); |
| - specific_flows_[email] = flow; |
| + ResetUserFlow(account_id); |
| + specific_flows_[account_id] = flow; |
| } |
| UserFlow* FakeChromeUserManager::GetCurrentUserFlow() const { |
| if (!IsUserLoggedIn()) |
| return GetDefaultUserFlow(); |
| - return GetUserFlow(GetLoggedInUser()->email()); |
| + return GetUserFlow(GetLoggedInUser()->GetAccountId()); |
| } |
| -UserFlow* FakeChromeUserManager::GetUserFlow(const std::string& email) const { |
| - FlowMap::const_iterator it = specific_flows_.find(email); |
| +UserFlow* FakeChromeUserManager::GetUserFlow( |
| + const AccountId& account_id) const { |
| + FlowMap::const_iterator it = specific_flows_.find(account_id); |
| if (it != specific_flows_.end()) |
| return it->second; |
| return GetDefaultUserFlow(); |
| } |
| -void FakeChromeUserManager::ResetUserFlow(const std::string& email) { |
| - FlowMap::iterator it = specific_flows_.find(email); |
| +void FakeChromeUserManager::ResetUserFlow(const AccountId& account_id) { |
| + FlowMap::iterator it = specific_flows_.find(account_id); |
| if (it != specific_flows_.end()) { |
| delete it->second; |
| specific_flows_.erase(it); |
| } |
| } |
| -void FakeChromeUserManager::SwitchActiveUser(const std::string& email) { |
| - active_user_id_ = email; |
| +void FakeChromeUserManager::SwitchActiveUser(const AccountId& account_id) { |
| + active_account_id_ = account_id; |
| ProfileHelper::Get()->ActiveUserHashChanged( |
| - ProfileHelper::GetUserIdHashByUserIdForTesting(email)); |
| - if (!users_.empty() && !active_user_id_.empty()) { |
| + ProfileHelper::GetUserIdHashByUserIdForTesting( |
| + account_id.GetUserEmail())); |
| + if (!users_.empty() && active_account_id_.is_valid()) { |
| for (user_manager::User* user : users_) |
| - user->set_is_active(user->email() == active_user_id_); |
| + user->set_is_active(user->GetAccountId() == active_account_id_); |
| } |
| } |
| -const std::string& FakeChromeUserManager::GetOwnerEmail() const { |
| - return owner_email_; |
| +const AccountId& FakeChromeUserManager::GetOwnerAccountId() const { |
| + return owner_account_id_; |
| } |
| void FakeChromeUserManager::SessionStarted() { |
| } |
| void FakeChromeUserManager::RemoveUser( |
| - const std::string& email, |
| - user_manager::RemoveUserDelegate* delegate) { |
| -} |
| + const AccountId& account_id, |
| + user_manager::RemoveUserDelegate* delegate) {} |
| user_manager::UserList |
| FakeChromeUserManager::GetUsersAllowedForSupervisedUsersCreation() const { |
| @@ -181,15 +183,14 @@ UserFlow* FakeChromeUserManager::GetDefaultUserFlow() const { |
| } |
| bool FakeChromeUserManager::FindKnownUserPrefs( |
| - const user_manager::UserID& user_id, |
| + const AccountId& account_id, |
| const base::DictionaryValue** out_value) { |
| return false; |
| } |
| void FakeChromeUserManager::UpdateKnownUserPrefs( |
| - const user_manager::UserID& user_id, |
| + const AccountId& account_id, |
| const base::DictionaryValue& values, |
| - bool clear) { |
| -} |
| + bool clear) {} |
| } // namespace chromeos |