| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } else { | 175 } else { |
| 176 RegularUserLoggedIn(account_id); | 176 RegularUserLoggedIn(account_id); |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 DCHECK(active_user_); | 180 DCHECK(active_user_); |
| 181 active_user_->set_is_logged_in(true); | 181 active_user_->set_is_logged_in(true); |
| 182 active_user_->set_is_active(true); | 182 active_user_->set_is_active(true); |
| 183 active_user_->set_username_hash(username_hash); | 183 active_user_->set_username_hash(username_hash); |
| 184 | 184 |
| 185 // Place user who just signed in to the top of the logged in users. | 185 logged_in_users_.push_back(active_user_); |
| 186 logged_in_users_.insert(logged_in_users_.begin(), active_user_); | |
| 187 SetLRUUser(active_user_); | 186 SetLRUUser(active_user_); |
| 188 | 187 |
| 189 if (!primary_user_) { | 188 if (!primary_user_) { |
| 190 primary_user_ = active_user_; | 189 primary_user_ = active_user_; |
| 191 if (primary_user_->HasGaiaAccount()) | 190 if (primary_user_->HasGaiaAccount()) |
| 192 SendGaiaUserLoginMetrics(account_id); | 191 SendGaiaUserLoginMetrics(account_id); |
| 192 } else if (primary_user_ != active_user_) { |
| 193 // This is only needed for tests where a new user session is created |
| 194 // for non-existent user. |
| 195 SetIsCurrentUserNew(true); |
| 196 NotifyUserAddedToSession(active_user_, true /* user switch pending */); |
| 193 } | 197 } |
| 194 | 198 |
| 195 UMA_HISTOGRAM_ENUMERATION( | 199 UMA_HISTOGRAM_ENUMERATION( |
| 196 "UserManager.LoginUserType", active_user_->GetType(), NUM_USER_TYPES); | 200 "UserManager.LoginUserType", active_user_->GetType(), NUM_USER_TYPES); |
| 197 | 201 |
| 198 GetLocalState()->SetString( | 202 GetLocalState()->SetString( |
| 199 kLastLoggedInGaiaUser, | 203 kLastLoggedInGaiaUser, |
| 200 active_user_->HasGaiaAccount() ? account_id.GetUserEmail() : ""); | 204 active_user_->HasGaiaAccount() ? account_id.GetUserEmail() : ""); |
| 201 | 205 |
| 202 NotifyOnLogin(); | 206 NotifyOnLogin(); |
| (...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 } | 1065 } |
| 1062 | 1066 |
| 1063 void UserManagerBase::DeleteUser(User* user) { | 1067 void UserManagerBase::DeleteUser(User* user) { |
| 1064 const bool is_active_user = (user == active_user_); | 1068 const bool is_active_user = (user == active_user_); |
| 1065 delete user; | 1069 delete user; |
| 1066 if (is_active_user) | 1070 if (is_active_user) |
| 1067 active_user_ = nullptr; | 1071 active_user_ = nullptr; |
| 1068 } | 1072 } |
| 1069 | 1073 |
| 1070 } // namespace user_manager | 1074 } // namespace user_manager |
| OLD | NEW |