Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1539)

Unified Diff: components/user_manager/fake_user_manager.cc

Issue 2450183002: Rename UserInfo method GetEmail to GetDisplayEmail. (Closed)
Patch Set: Fix build Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 73cde6f5bdd4daad7d760c7987de16d6e66006ab..164e319d65c0e36ba60231bdf653ab574481a7b4 100644
--- a/components/user_manager/fake_user_manager.cc
+++ b/components/user_manager/fake_user_manager.cc
@@ -4,6 +4,8 @@
#include "components/user_manager/fake_user_manager.h"
+#include <algorithm>
+
#include "base/callback.h"
#include "base/command_line.h"
#include "base/sys_info.h"
@@ -53,11 +55,11 @@ const user_manager::User* FakeUserManager::AddUserWithAffiliation(
}
void FakeUserManager::RemoveUserFromList(const AccountId& account_id) {
- user_manager::UserList::iterator it = users_.begin();
- // TODO (alemate): Chenge this to GetAccountId(), once a real AccountId is
- // passed. crbug.com/546876
- while (it != users_.end() && (*it)->GetEmail() != account_id.GetUserEmail())
- ++it;
+ const user_manager::UserList::iterator it =
+ std::find_if(users_.begin(), users_.end(),
+ [&account_id](const user_manager::User* user) {
+ return user->GetAccountId() == account_id;
+ });
if (it != users_.end()) {
if (primary_user_ == *it)
primary_user_ = nullptr;
@@ -134,9 +136,7 @@ void FakeUserManager::SaveUserDisplayName(const AccountId& account_id,
const base::string16& display_name) {
for (user_manager::UserList::iterator it = users_.begin(); it != users_.end();
++it) {
- // TODO (alemate): Chenge this to GetAccountId(), once a real AccountId is
- // passed. crbug.com/546876
- if ((*it)->GetEmail() == account_id.GetUserEmail()) {
+ if ((*it)->GetAccountId() == account_id) {
(*it)->set_display_name(display_name);
return;
}

Powered by Google App Engine
This is Rietveld 408576698