Chromium Code Reviews| Index: components/user_manager/fake_user_manager.cc |
| diff --git a/components/user_manager/fake_user_manager.cc b/components/user_manager/fake_user_manager.cc |
| index 39f63f1eae4493c0525b1378d7ec5ffa204caa24..0bcec9070597e750b3bafa296c689f8283a40bbd 100644 |
| --- a/components/user_manager/fake_user_manager.cc |
| +++ b/components/user_manager/fake_user_manager.cc |
| @@ -32,27 +32,30 @@ namespace user_manager { |
| FakeUserManager::FakeUserManager() |
| : UserManagerBase(new FakeTaskRunner(), new FakeTaskRunner()), |
| primary_user_(NULL), |
|
achuithb
2015/10/23 00:08:52
in class member initialization
Alexander Alekseev
2015/10/23 09:11:24
Done.
|
| - owner_email_(std::string()) { |
| -} |
| + active_user_id_(EmptyAccountId()), |
| + owner_id_(EmptyAccountId()) {} |
| FakeUserManager::~FakeUserManager() { |
| } |
| -const user_manager::User* FakeUserManager::AddUser(const std::string& email) { |
| - return AddUserWithAffiliation(email, false); |
| +const user_manager::User* FakeUserManager::AddUser(const AccountId& account) { |
| + return AddUserWithAffiliation(account, false); |
| } |
| const user_manager::User* FakeUserManager::AddUserWithAffiliation( |
| - const std::string& email, bool is_affiliated) { |
| - user_manager::User* user = user_manager::User::CreateRegularUser(email); |
| + const AccountId& account, |
| + bool is_affiliated) { |
| + user_manager::User* user = user_manager::User::CreateRegularUser(account); |
| user->set_affiliation(is_affiliated); |
| users_.push_back(user); |
| return user; |
| } |
| -void FakeUserManager::RemoveUserFromList(const std::string& email) { |
| +void FakeUserManager::RemoveUserFromList(const AccountId& account) { |
| user_manager::UserList::iterator it = users_.begin(); |
| - while (it != users_.end() && (*it)->email() != email) |
| + // TODO (alemate): Chenge this to GetUserID(), once a real AccountId is |
|
achuithb
2015/10/23 00:08:52
s/Chenge/Change
Please reference a bug.
same bel
Alexander Alekseev
2015/10/23 09:11:24
Done.
|
| + // passed. |
| + while (it != users_.end() && (*it)->GetEmail() != account.GetUserEmail()) |
| ++it; |
| if (it != users_.end()) { |
| delete *it; |
| @@ -79,7 +82,7 @@ const user_manager::UserList& FakeUserManager::GetLoggedInUsers() const { |
| return logged_in_users_; |
| } |
| -void FakeUserManager::UserLoggedIn(const std::string& email, |
| +void FakeUserManager::UserLoggedIn(const AccountId& account, |
| const std::string& username_hash, |
| bool browser_restart) { |
| for (user_manager::UserList::const_iterator it = users_.begin(); |
| @@ -101,7 +104,9 @@ user_manager::User* FakeUserManager::GetActiveUserInternal() const { |
| if (!active_user_id_.empty()) { |
| for (user_manager::UserList::const_iterator it = users_.begin(); |
| it != users_.end(); ++it) { |
| - if ((*it)->email() == active_user_id_) |
| + // TODO (alemate): Chenge this to GetUserID(), once a real AccountId is |
| + // passed. |
| + if ((*it)->GetEmail() == active_user_id_.GetUserEmail()) |
| return *it; |
| } |
| } |
| @@ -118,14 +123,15 @@ user_manager::User* FakeUserManager::GetActiveUser() { |
| return GetActiveUserInternal(); |
| } |
| -void FakeUserManager::SwitchActiveUser(const std::string& email) { |
| -} |
| +void FakeUserManager::SwitchActiveUser(const AccountId& account) {} |
| -void FakeUserManager::SaveUserDisplayName(const std::string& username, |
| +void FakeUserManager::SaveUserDisplayName(const AccountId& user_id, |
| const base::string16& display_name) { |
| for (user_manager::UserList::iterator it = users_.begin(); it != users_.end(); |
| ++it) { |
| - if ((*it)->email() == username) { |
| + // TODO (alemate): Chenge this to GetUserID(), once a real AccountId is |
| + // passed. |
| + if ((*it)->GetEmail() == user_id.GetUserEmail()) { |
| (*it)->set_display_name(display_name); |
| return; |
| } |
| @@ -140,27 +146,29 @@ user_manager::UserList FakeUserManager::GetUnlockUsers() const { |
| return users_; |
| } |
| -const std::string& FakeUserManager::GetOwnerEmail() const { |
| - return owner_email_; |
| +const AccountId& FakeUserManager::GetOwnerId() const { |
| + return owner_id_; |
| } |
| -bool FakeUserManager::IsKnownUser(const std::string& email) const { |
| +bool FakeUserManager::IsKnownUser(const AccountId& account) const { |
| return true; |
| } |
| const user_manager::User* FakeUserManager::FindUser( |
| - const std::string& email) const { |
| + const AccountId& account) const { |
| const user_manager::UserList& users = GetUsers(); |
| for (user_manager::UserList::const_iterator it = users.begin(); |
| it != users.end(); ++it) { |
| - if ((*it)->email() == email) |
| + // TODO (alemate): Chenge this to GetUserID(), once a real AccountId is |
| + // passed. |
| + if ((*it)->GetEmail() == account.GetUserEmail()) |
| return *it; |
| } |
| return NULL; |
| } |
| user_manager::User* FakeUserManager::FindUserAndModify( |
| - const std::string& email) { |
| + const AccountId& account) { |
| return NULL; |
| } |
| @@ -177,12 +185,12 @@ const user_manager::User* FakeUserManager::GetPrimaryUser() const { |
| } |
| base::string16 FakeUserManager::GetUserDisplayName( |
| - const std::string& username) const { |
| + const AccountId& user_id) const { |
| return base::string16(); |
| } |
| std::string FakeUserManager::GetUserDisplayEmail( |
| - const std::string& username) const { |
| + const AccountId& user_id) const { |
| return std::string(); |
| } |
| @@ -238,7 +246,7 @@ bool FakeUserManager::IsSessionStarted() const { |
| } |
| bool FakeUserManager::IsUserNonCryptohomeDataEphemeral( |
| - const std::string& email) const { |
| + const AccountId& account) const { |
| return false; |
| } |
| @@ -263,16 +271,16 @@ bool FakeUserManager::IsEnterpriseManaged() const { |
| return false; |
| } |
| -bool FakeUserManager::IsDemoApp(const std::string& user_id) const { |
| +bool FakeUserManager::IsDemoApp(const AccountId& user_id) const { |
| return false; |
| } |
| -bool FakeUserManager::IsKioskApp(const std::string& user_id) const { |
| +bool FakeUserManager::IsKioskApp(const AccountId& user_id) const { |
| return false; |
| } |
| bool FakeUserManager::IsPublicAccountMarkedForRemoval( |
| - const std::string& user_id) const { |
| + const AccountId& user_id) const { |
| return false; |
| } |