| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 // Key of obfuscated GAIA id value. | 82 // Key of obfuscated GAIA id value. |
| 83 const char kGAIAIdKey[] = "gaia_id"; | 83 const char kGAIAIdKey[] = "gaia_id"; |
| 84 | 84 |
| 85 // Key of whether this user ID refers to a SAML user. | 85 // Key of whether this user ID refers to a SAML user. |
| 86 const char kUsingSAMLKey[] = "using_saml"; | 86 const char kUsingSAMLKey[] = "using_saml"; |
| 87 | 87 |
| 88 // Key of Device Id. | 88 // Key of Device Id. |
| 89 const char kDeviceId[] = "device_id"; | 89 const char kDeviceId[] = "device_id"; |
| 90 | 90 |
| 91 // Key of GAPS cookie. |
| 92 const char kGAPSCookie[] = "gaps_cookie"; |
| 93 |
| 91 // Key of the reason for re-auth. | 94 // Key of the reason for re-auth. |
| 92 const char kReauthReasonKey[] = "reauth_reason"; | 95 const char kReauthReasonKey[] = "reauth_reason"; |
| 93 | 96 |
| 94 // Upper bound for a histogram metric reporting the amount of time between | 97 // Upper bound for a histogram metric reporting the amount of time between |
| 95 // one regular user logging out and a different regular user logging in. | 98 // one regular user logging out and a different regular user logging in. |
| 96 const int kLogoutToLoginDelayMaxSec = 1800; | 99 const int kLogoutToLoginDelayMaxSec = 1800; |
| 97 | 100 |
| 98 // Callback that is called after user removal is complete. | 101 // Callback that is called after user removal is complete. |
| 99 void OnRemoveUserComplete(const std::string& user_email, | 102 void OnRemoveUserComplete(const std::string& user_email, |
| 100 bool success, | 103 bool success, |
| (...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 } | 1159 } |
| 1157 | 1160 |
| 1158 std::string UserManagerBase::GetKnownUserDeviceId(const UserID& user_id) { | 1161 std::string UserManagerBase::GetKnownUserDeviceId(const UserID& user_id) { |
| 1159 std::string device_id; | 1162 std::string device_id; |
| 1160 if (GetKnownUserStringPref(user_id, kDeviceId, &device_id)) { | 1163 if (GetKnownUserStringPref(user_id, kDeviceId, &device_id)) { |
| 1161 return device_id; | 1164 return device_id; |
| 1162 } | 1165 } |
| 1163 return std::string(); | 1166 return std::string(); |
| 1164 } | 1167 } |
| 1165 | 1168 |
| 1169 void UserManagerBase::SetKnownUserGAPSCookie(const UserID& user_id, |
| 1170 const std::string& gaps_cookie) { |
| 1171 SetKnownUserStringPref(user_id, kGAPSCookie, gaps_cookie); |
| 1172 } |
| 1173 |
| 1174 std::string UserManagerBase::GetKnownUserGAPSCookie(const UserID& user_id) { |
| 1175 std::string gaps_cookie; |
| 1176 if (GetKnownUserStringPref(user_id, kGAPSCookie, &gaps_cookie)) { |
| 1177 return gaps_cookie; |
| 1178 } |
| 1179 return std::string(); |
| 1180 } |
| 1181 |
| 1166 User* UserManagerBase::RemoveRegularOrSupervisedUserFromList( | 1182 User* UserManagerBase::RemoveRegularOrSupervisedUserFromList( |
| 1167 const std::string& user_id) { | 1183 const std::string& user_id) { |
| 1168 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers); | 1184 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers); |
| 1169 prefs_users_update->Clear(); | 1185 prefs_users_update->Clear(); |
| 1170 User* user = NULL; | 1186 User* user = NULL; |
| 1171 for (UserList::iterator it = users_.begin(); it != users_.end();) { | 1187 for (UserList::iterator it = users_.begin(); it != users_.end();) { |
| 1172 const std::string user_email = (*it)->email(); | 1188 const std::string user_email = (*it)->email(); |
| 1173 if (user_email == user_id) { | 1189 if (user_email == user_id) { |
| 1174 user = *it; | 1190 user = *it; |
| 1175 it = users_.erase(it); | 1191 it = users_.erase(it); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 } | 1339 } |
| 1324 | 1340 |
| 1325 void UserManagerBase::DeleteUser(User* user) { | 1341 void UserManagerBase::DeleteUser(User* user) { |
| 1326 const bool is_active_user = (user == active_user_); | 1342 const bool is_active_user = (user == active_user_); |
| 1327 delete user; | 1343 delete user; |
| 1328 if (is_active_user) | 1344 if (is_active_user) |
| 1329 active_user_ = NULL; | 1345 active_user_ = NULL; |
| 1330 } | 1346 } |
| 1331 | 1347 |
| 1332 } // namespace user_manager | 1348 } // namespace user_manager |
| OLD | NEW |