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 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1141 SetKnownUserStringPref(user_id, kGAIAIdKey, gaia_id); | 1141 SetKnownUserStringPref(user_id, kGAIAIdKey, gaia_id); |
1142 } | 1142 } |
1143 | 1143 |
1144 bool UserManagerBase::FindGaiaID(const UserID& user_id, | 1144 bool UserManagerBase::FindGaiaID(const UserID& user_id, |
1145 std::string* out_value) { | 1145 std::string* out_value) { |
1146 return GetKnownUserStringPref(user_id, kGAIAIdKey, out_value); | 1146 return GetKnownUserStringPref(user_id, kGAIAIdKey, out_value); |
1147 } | 1147 } |
1148 | 1148 |
1149 void UserManagerBase::SetKnownUserDeviceId(const UserID& user_id, | 1149 void UserManagerBase::SetKnownUserDeviceId(const UserID& user_id, |
1150 const std::string& device_id) { | 1150 const std::string& device_id) { |
1151 std::string known_device_id = GetKnownUserDeviceId(user_id); | |
achuithb
2015/05/12 23:25:01
nit: const
dzhioev (left Google)
2015/05/13 00:25:18
Done.
| |
1152 if (!known_device_id.empty() && device_id != known_device_id) { | |
achuithb
2015/05/12 23:25:01
Should this just be a DCHECK?
dzhioev (left Google)
2015/05/13 00:25:18
Want this to be logged in Release mode.
| |
1153 NOTREACHED() << "Trying to change device ID for known user."; | |
1154 } | |
1151 SetKnownUserStringPref(user_id, kDeviceId, device_id); | 1155 SetKnownUserStringPref(user_id, kDeviceId, device_id); |
1152 } | 1156 } |
1153 | 1157 |
1154 std::string UserManagerBase::GetKnownUserDeviceId(const UserID& user_id) { | 1158 std::string UserManagerBase::GetKnownUserDeviceId(const UserID& user_id) { |
1155 std::string device_id; | 1159 std::string device_id; |
1156 if (GetKnownUserStringPref(user_id, kDeviceId, &device_id)) { | 1160 if (GetKnownUserStringPref(user_id, kDeviceId, &device_id)) { |
1157 return device_id; | 1161 return device_id; |
1158 } | 1162 } |
1159 return std::string(); | 1163 return std::string(); |
1160 } | 1164 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1319 } | 1323 } |
1320 | 1324 |
1321 void UserManagerBase::DeleteUser(User* user) { | 1325 void UserManagerBase::DeleteUser(User* user) { |
1322 const bool is_active_user = (user == active_user_); | 1326 const bool is_active_user = (user == active_user_); |
1323 delete user; | 1327 delete user; |
1324 if (is_active_user) | 1328 if (is_active_user) |
1325 active_user_ = NULL; | 1329 active_user_ = NULL; |
1326 } | 1330 } |
1327 | 1331 |
1328 } // namespace user_manager | 1332 } // namespace user_manager |
OLD | NEW |