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 "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 } | 537 } |
538 | 538 |
539 void UserImageManagerImpl::Job::UpdateLocalState() { | 539 void UserImageManagerImpl::Job::UpdateLocalState() { |
540 // Ignore if data stored or cached outside the user's cryptohome is to be | 540 // Ignore if data stored or cached outside the user's cryptohome is to be |
541 // treated as ephemeral. | 541 // treated as ephemeral. |
542 if (parent_->user_manager_->IsUserNonCryptohomeDataEphemeral( | 542 if (parent_->user_manager_->IsUserNonCryptohomeDataEphemeral( |
543 AccountId::FromUserEmail(user_id()))) | 543 AccountId::FromUserEmail(user_id()))) |
544 return; | 544 return; |
545 | 545 |
546 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue); | 546 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue); |
547 entry->Set(kImagePathNodeName, new base::Value(image_path_.value())); | 547 entry->Set(kImagePathNodeName, |
548 entry->Set(kImageIndexNodeName, new base::Value(image_index_)); | 548 base::MakeUnique<base::Value>(image_path_.value())); |
| 549 entry->Set(kImageIndexNodeName, base::MakeUnique<base::Value>(image_index_)); |
549 if (!image_url_.is_empty()) | 550 if (!image_url_.is_empty()) |
550 entry->Set(kImageURLNodeName, new base::Value(image_url_.spec())); | 551 entry->Set(kImageURLNodeName, |
| 552 base::MakeUnique<base::Value>(image_url_.spec())); |
551 DictionaryPrefUpdate update(g_browser_process->local_state(), | 553 DictionaryPrefUpdate update(g_browser_process->local_state(), |
552 kUserImageProperties); | 554 kUserImageProperties); |
553 update->SetWithoutPathExpansion(user_id(), entry.release()); | 555 update->SetWithoutPathExpansion(user_id(), entry.release()); |
554 | 556 |
555 parent_->user_manager_->NotifyLocalStateChanged(); | 557 parent_->user_manager_->NotifyLocalStateChanged(); |
556 } | 558 } |
557 | 559 |
558 void UserImageManagerImpl::Job::NotifyJobDone() { | 560 void UserImageManagerImpl::Job::NotifyJobDone() { |
559 parent_->OnJobDone(); | 561 parent_->OnJobDone(); |
560 } | 562 } |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 } | 1022 } |
1021 | 1023 |
1022 bool UserImageManagerImpl::IsUserLoggedInAndHasGaiaAccount() const { | 1024 bool UserImageManagerImpl::IsUserLoggedInAndHasGaiaAccount() const { |
1023 const user_manager::User* user = GetUser(); | 1025 const user_manager::User* user = GetUser(); |
1024 if (!user) | 1026 if (!user) |
1025 return false; | 1027 return false; |
1026 return user->is_logged_in() && user->HasGaiaAccount(); | 1028 return user->is_logged_in() && user->HasGaiaAccount(); |
1027 } | 1029 } |
1028 | 1030 |
1029 } // namespace chromeos | 1031 } // namespace chromeos |
OLD | NEW |