| 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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 UserList::iterator it = | 1031 UserList::iterator it = |
| 1032 std::find(lru_logged_in_users_.begin(), lru_logged_in_users_.end(), user); | 1032 std::find(lru_logged_in_users_.begin(), lru_logged_in_users_.end(), user); |
| 1033 if (it != lru_logged_in_users_.end()) | 1033 if (it != lru_logged_in_users_.end()) |
| 1034 lru_logged_in_users_.erase(it); | 1034 lru_logged_in_users_.erase(it); |
| 1035 lru_logged_in_users_.insert(lru_logged_in_users_.begin(), user); | 1035 lru_logged_in_users_.insert(lru_logged_in_users_.begin(), user); |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 void UserManagerBase::SendGaiaUserLoginMetrics(const std::string& user_id) { | 1038 void UserManagerBase::SendGaiaUserLoginMetrics(const std::string& user_id) { |
| 1039 // If this isn't the first time Chrome was run after the system booted, | 1039 // If this isn't the first time Chrome was run after the system booted, |
| 1040 // assume that Chrome was restarted because a previous session ended. | 1040 // assume that Chrome was restarted because a previous session ended. |
| 1041 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 1041 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1042 chromeos::switches::kFirstExecAfterBoot)) { | 1042 chromeos::switches::kFirstExecAfterBoot)) { |
| 1043 const std::string last_email = | 1043 const std::string last_email = |
| 1044 GetLocalState()->GetString(kLastLoggedInGaiaUser); | 1044 GetLocalState()->GetString(kLastLoggedInGaiaUser); |
| 1045 const base::TimeDelta time_to_login = | 1045 const base::TimeDelta time_to_login = |
| 1046 base::TimeTicks::Now() - manager_creation_time_; | 1046 base::TimeTicks::Now() - manager_creation_time_; |
| 1047 if (!last_email.empty() && user_id != last_email && | 1047 if (!last_email.empty() && user_id != last_email && |
| 1048 time_to_login.InSeconds() <= kLogoutToLoginDelayMaxSec) { | 1048 time_to_login.InSeconds() <= kLogoutToLoginDelayMaxSec) { |
| 1049 UMA_HISTOGRAM_CUSTOM_COUNTS("UserManager.LogoutToLoginDelay", | 1049 UMA_HISTOGRAM_CUSTOM_COUNTS("UserManager.LogoutToLoginDelay", |
| 1050 time_to_login.InSeconds(), | 1050 time_to_login.InSeconds(), |
| 1051 0, | 1051 0, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 void UserManagerBase::DeleteUser(User* user) { | 1087 void UserManagerBase::DeleteUser(User* user) { |
| 1088 const bool is_active_user = (user == active_user_); | 1088 const bool is_active_user = (user == active_user_); |
| 1089 delete user; | 1089 delete user; |
| 1090 if (is_active_user) | 1090 if (is_active_user) |
| 1091 active_user_ = NULL; | 1091 active_user_ = NULL; |
| 1092 } | 1092 } |
| 1093 | 1093 |
| 1094 } // namespace user_manager | 1094 } // namespace user_manager |
| OLD | NEW |