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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 const std::string& user_id) const { | 420 const std::string& user_id) const { |
421 const User* user = FindUser(user_id); | 421 const User* user = FindUser(user_id); |
422 return user ? user->display_name() : base::string16(); | 422 return user ? user->display_name() : base::string16(); |
423 } | 423 } |
424 | 424 |
425 void UserManagerBase::SaveUserDisplayEmail(const std::string& user_id, | 425 void UserManagerBase::SaveUserDisplayEmail(const std::string& user_id, |
426 const std::string& display_email) { | 426 const std::string& display_email) { |
427 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 427 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
428 | 428 |
429 User* user = FindUserAndModify(user_id); | 429 User* user = FindUserAndModify(user_id); |
430 if (!user) | 430 if (!user) { |
431 LOG(ERROR) << "User not found"; | |
Nikita (slow)
2014/09/08 11:57:05
nit: makes sense to log user_id as well
| |
431 return; // Ignore if there is no such user. | 432 return; // Ignore if there is no such user. |
433 } | |
432 | 434 |
433 user->set_display_email(display_email); | 435 user->set_display_email(display_email); |
434 | 436 |
435 // Do not update local state if data stored or cached outside the user's | 437 // Do not update local state if data stored or cached outside the user's |
436 // cryptohome is to be treated as ephemeral. | 438 // cryptohome is to be treated as ephemeral. |
437 if (IsUserNonCryptohomeDataEphemeral(user_id)) | 439 if (IsUserNonCryptohomeDataEphemeral(user_id)) |
438 return; | 440 return; |
439 | 441 |
440 DictionaryPrefUpdate display_email_update(GetLocalState(), kUserDisplayEmail); | 442 DictionaryPrefUpdate display_email_update(GetLocalState(), kUserDisplayEmail); |
441 display_email_update->SetWithoutPathExpansion( | 443 display_email_update->SetWithoutPathExpansion( |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1018 } | 1020 } |
1019 | 1021 |
1020 void UserManagerBase::DeleteUser(User* user) { | 1022 void UserManagerBase::DeleteUser(User* user) { |
1021 const bool is_active_user = (user == active_user_); | 1023 const bool is_active_user = (user == active_user_); |
1022 delete user; | 1024 delete user; |
1023 if (is_active_user) | 1025 if (is_active_user) |
1024 active_user_ = NULL; | 1026 active_user_ = NULL; |
1025 } | 1027 } |
1026 | 1028 |
1027 } // namespace user_manager | 1029 } // namespace user_manager |
OLD | NEW |