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

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

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: MakeUnique 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 unified diff | Download patch
« no previous file with comments | « components/user_manager/known_user.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/user_manager_base.h" 5 #include "components/user_manager/user_manager_base.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers); 959 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers);
960 prefs_users_update->Clear(); 960 prefs_users_update->Clear();
961 User* user = nullptr; 961 User* user = nullptr;
962 for (UserList::iterator it = users_.begin(); it != users_.end();) { 962 for (UserList::iterator it = users_.begin(); it != users_.end();) {
963 if ((*it)->GetAccountId() == account_id) { 963 if ((*it)->GetAccountId() == account_id) {
964 user = *it; 964 user = *it;
965 it = users_.erase(it); 965 it = users_.erase(it);
966 } else { 966 } else {
967 if ((*it)->HasGaiaAccount() || (*it)->IsSupervised()) { 967 if ((*it)->HasGaiaAccount() || (*it)->IsSupervised()) {
968 const std::string user_email = (*it)->email(); 968 const std::string user_email = (*it)->email();
969 prefs_users_update->Append(new base::StringValue(user_email)); 969 prefs_users_update->AppendString(user_email);
970 } 970 }
971 ++it; 971 ++it;
972 } 972 }
973 } 973 }
974 OnUserRemoved(account_id); 974 OnUserRemoved(account_id);
975 return user; 975 return user;
976 } 976 }
977 977
978 void UserManagerBase::NotifyActiveUserChanged(const User* active_user) { 978 void UserManagerBase::NotifyActiveUserChanged(const User* active_user) {
979 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 979 DCHECK(task_runner_->RunsTasksOnCurrentThread());
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 } 1076 }
1077 1077
1078 void UserManagerBase::DeleteUser(User* user) { 1078 void UserManagerBase::DeleteUser(User* user) {
1079 const bool is_active_user = (user == active_user_); 1079 const bool is_active_user = (user == active_user_);
1080 delete user; 1080 delete user;
1081 if (is_active_user) 1081 if (is_active_user)
1082 active_user_ = nullptr; 1082 active_user_ = nullptr;
1083 } 1083 }
1084 1084
1085 } // namespace user_manager 1085 } // namespace user_manager
OLDNEW
« no previous file with comments | « components/user_manager/known_user.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698