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

Side by Side Diff: components/user_manager/fake_user_manager.cc

Issue 2450183002: Rename UserInfo method GetEmail to GetDisplayEmail. (Closed)
Patch Set: Fixed build in a dependent CL. Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/user_manager/fake_user_manager.h" 5 #include "components/user_manager/fake_user_manager.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "base/task_runner.h" 10 #include "base/task_runner.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 const AccountId& account_id, 47 const AccountId& account_id,
48 bool is_affiliated) { 48 bool is_affiliated) {
49 user_manager::User* user = user_manager::User::CreateRegularUser(account_id); 49 user_manager::User* user = user_manager::User::CreateRegularUser(account_id);
50 user->SetAffiliation(is_affiliated); 50 user->SetAffiliation(is_affiliated);
51 users_.push_back(user); 51 users_.push_back(user);
52 return user; 52 return user;
53 } 53 }
54 54
55 void FakeUserManager::RemoveUserFromList(const AccountId& account_id) { 55 void FakeUserManager::RemoveUserFromList(const AccountId& account_id) {
56 user_manager::UserList::iterator it = users_.begin(); 56 user_manager::UserList::iterator it = users_.begin();
57 // TODO (alemate): Chenge this to GetAccountId(), once a real AccountId is 57 while (it != users_.end() && (*it)->GetAccountId() != account_id)
oshima 2016/10/26 15:14:44 optional: or use std::find_if
Alexander Alekseev 2016/10/27 18:11:37 Done.
58 // passed. crbug.com/546876
59 while (it != users_.end() && (*it)->GetEmail() != account_id.GetUserEmail())
60 ++it; 58 ++it;
61 if (it != users_.end()) { 59 if (it != users_.end()) {
62 if (primary_user_ == *it) 60 if (primary_user_ == *it)
63 primary_user_ = nullptr; 61 primary_user_ = nullptr;
64 if (active_user_ != *it) 62 if (active_user_ != *it)
65 delete *it; 63 delete *it;
66 users_.erase(it); 64 users_.erase(it);
67 } 65 }
68 } 66 }
69 67
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 user_manager::User* FakeUserManager::GetActiveUser() { 125 user_manager::User* FakeUserManager::GetActiveUser() {
128 return GetActiveUserInternal(); 126 return GetActiveUserInternal();
129 } 127 }
130 128
131 void FakeUserManager::SwitchActiveUser(const AccountId& account_id) {} 129 void FakeUserManager::SwitchActiveUser(const AccountId& account_id) {}
132 130
133 void FakeUserManager::SaveUserDisplayName(const AccountId& account_id, 131 void FakeUserManager::SaveUserDisplayName(const AccountId& account_id,
134 const base::string16& display_name) { 132 const base::string16& display_name) {
135 for (user_manager::UserList::iterator it = users_.begin(); it != users_.end(); 133 for (user_manager::UserList::iterator it = users_.begin(); it != users_.end();
136 ++it) { 134 ++it) {
137 // TODO (alemate): Chenge this to GetAccountId(), once a real AccountId is 135 if ((*it)->GetAccountId() == account_id) {
138 // passed. crbug.com/546876
139 if ((*it)->GetEmail() == account_id.GetUserEmail()) {
140 (*it)->set_display_name(display_name); 136 (*it)->set_display_name(display_name);
141 return; 137 return;
142 } 138 }
143 } 139 }
144 } 140 }
145 141
146 const user_manager::UserList& FakeUserManager::GetLRULoggedInUsers() const { 142 const user_manager::UserList& FakeUserManager::GetLRULoggedInUsers() const {
147 return users_; 143 return users_;
148 } 144 }
149 145
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 NOTIMPLEMENTED(); 356 NOTIMPLEMENTED();
361 return; 357 return;
362 } 358 }
363 359
364 bool FakeUserManager::IsValidDefaultUserImageId(int image_index) const { 360 bool FakeUserManager::IsValidDefaultUserImageId(int image_index) const {
365 NOTIMPLEMENTED(); 361 NOTIMPLEMENTED();
366 return false; 362 return false;
367 } 363 }
368 364
369 } // namespace user_manager 365 } // namespace user_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698