| OLD | NEW |
| 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 <cstddef> | 7 #include <cstddef> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 | 788 |
| 789 const User* UserManagerBase::FindUserInList(const std::string& user_id) const { | 789 const User* UserManagerBase::FindUserInList(const std::string& user_id) const { |
| 790 const UserList& users = GetUsers(); | 790 const UserList& users = GetUsers(); |
| 791 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { | 791 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
| 792 if ((*it)->email() == user_id) | 792 if ((*it)->email() == user_id) |
| 793 return *it; | 793 return *it; |
| 794 } | 794 } |
| 795 return NULL; | 795 return NULL; |
| 796 } | 796 } |
| 797 | 797 |
| 798 const bool UserManagerBase::UserExistsInList(const std::string& user_id) const { | 798 bool UserManagerBase::UserExistsInList(const std::string& user_id) const { |
| 799 const base::ListValue* user_list = GetLocalState()->GetList(kRegularUsers); | 799 const base::ListValue* user_list = GetLocalState()->GetList(kRegularUsers); |
| 800 for (size_t i = 0; i < user_list->GetSize(); ++i) { | 800 for (size_t i = 0; i < user_list->GetSize(); ++i) { |
| 801 std::string email; | 801 std::string email; |
| 802 if (user_list->GetString(i, &email) && (user_id == email)) | 802 if (user_list->GetString(i, &email) && (user_id == email)) |
| 803 return true; | 803 return true; |
| 804 } | 804 } |
| 805 return false; | 805 return false; |
| 806 } | 806 } |
| 807 | 807 |
| 808 User* UserManagerBase::FindUserInListAndModify(const std::string& user_id) { | 808 User* UserManagerBase::FindUserInListAndModify(const std::string& user_id) { |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 void UserManagerBase::DeleteUser(User* user) { | 1056 void UserManagerBase::DeleteUser(User* user) { |
| 1057 const bool is_active_user = (user == active_user_); | 1057 const bool is_active_user = (user == active_user_); |
| 1058 delete user; | 1058 delete user; |
| 1059 if (is_active_user) | 1059 if (is_active_user) |
| 1060 active_user_ = NULL; | 1060 active_user_ = NULL; |
| 1061 } | 1061 } |
| 1062 | 1062 |
| 1063 } // namespace user_manager | 1063 } // namespace user_manager |
| OLD | NEW |