| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 logged_in_users_.push_back(active_user_); | 185 logged_in_users_.push_back(active_user_); |
| 186 SetLRUUser(active_user_); | 186 SetLRUUser(active_user_); |
| 187 | 187 |
| 188 if (!primary_user_) { | 188 if (!primary_user_) { |
| 189 primary_user_ = active_user_; | 189 primary_user_ = active_user_; |
| 190 if (primary_user_->HasGaiaAccount()) | 190 if (primary_user_->HasGaiaAccount()) |
| 191 SendGaiaUserLoginMetrics(account_id); | 191 SendGaiaUserLoginMetrics(account_id); |
| 192 } else if (primary_user_ != active_user_) { | 192 } else if (primary_user_ != active_user_) { |
| 193 // This is only needed for tests where a new user session is created | 193 // This is only needed for tests where a new user session is created |
| 194 // for non-existent user. | 194 // for non-existent user. The new user is created and automatically set |
| 195 // to active and there will be no pending user switch in such case. |
| 195 SetIsCurrentUserNew(true); | 196 SetIsCurrentUserNew(true); |
| 196 NotifyUserAddedToSession(active_user_, true /* user switch pending */); | 197 NotifyUserAddedToSession(active_user_, false /* user switch pending */); |
| 197 } | 198 } |
| 198 | 199 |
| 199 UMA_HISTOGRAM_ENUMERATION( | 200 UMA_HISTOGRAM_ENUMERATION( |
| 200 "UserManager.LoginUserType", active_user_->GetType(), NUM_USER_TYPES); | 201 "UserManager.LoginUserType", active_user_->GetType(), NUM_USER_TYPES); |
| 201 | 202 |
| 202 GetLocalState()->SetString( | 203 GetLocalState()->SetString( |
| 203 kLastLoggedInGaiaUser, | 204 kLastLoggedInGaiaUser, |
| 204 active_user_->HasGaiaAccount() ? account_id.GetUserEmail() : ""); | 205 active_user_->HasGaiaAccount() ? account_id.GetUserEmail() : ""); |
| 205 | 206 |
| 206 NotifyOnLogin(); | 207 NotifyOnLogin(); |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 } | 1090 } |
| 1090 | 1091 |
| 1091 void UserManagerBase::DeleteUser(User* user) { | 1092 void UserManagerBase::DeleteUser(User* user) { |
| 1092 const bool is_active_user = (user == active_user_); | 1093 const bool is_active_user = (user == active_user_); |
| 1093 delete user; | 1094 delete user; |
| 1094 if (is_active_user) | 1095 if (is_active_user) |
| 1095 active_user_ = nullptr; | 1096 active_user_ = nullptr; |
| 1096 } | 1097 } |
| 1097 | 1098 |
| 1098 } // namespace user_manager | 1099 } // namespace user_manager |
| OLD | NEW |