| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 const User* user = GetUser(); | 689 const User* user = GetUser(); |
| 690 // If the user image for the currently logged-in user became managed, stop the | 690 // If the user image for the currently logged-in user became managed, stop the |
| 691 // sync observer so that the policy-set image does not get synced out. | 691 // sync observer so that the policy-set image does not get synced out. |
| 692 if (user && user->is_logged_in()) | 692 if (user && user->is_logged_in()) |
| 693 user_image_sync_observer_.reset(); | 693 user_image_sync_observer_.reset(); |
| 694 } | 694 } |
| 695 | 695 |
| 696 void UserImageManagerImpl::OnExternalDataCleared(const std::string& policy) { | 696 void UserImageManagerImpl::OnExternalDataCleared(const std::string& policy) { |
| 697 DCHECK_EQ(policy::key::kUserAvatarImage, policy); | 697 DCHECK_EQ(policy::key::kUserAvatarImage, policy); |
| 698 has_managed_image_ = false; | 698 has_managed_image_ = false; |
| 699 SetInitialUserImage(); |
| 699 TryToCreateImageSyncObserver(); | 700 TryToCreateImageSyncObserver(); |
| 700 } | 701 } |
| 701 | 702 |
| 702 void UserImageManagerImpl::OnExternalDataFetched(const std::string& policy, | 703 void UserImageManagerImpl::OnExternalDataFetched(const std::string& policy, |
| 703 scoped_ptr<std::string> data) { | 704 scoped_ptr<std::string> data) { |
| 704 DCHECK_EQ(policy::key::kUserAvatarImage, policy); | 705 DCHECK_EQ(policy::key::kUserAvatarImage, policy); |
| 705 DCHECK(IsUserImageManaged()); | 706 DCHECK(IsUserImageManaged()); |
| 706 if (data) { | 707 if (data) { |
| 707 job_.reset(new Job(this)); | 708 job_.reset(new Job(this)); |
| 708 job_->SetToImageData(data.Pass()); | 709 job_->SetToImageData(data.Pass()); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 } | 995 } |
| 995 | 996 |
| 996 bool UserImageManagerImpl::IsUserLoggedInAndRegular() const { | 997 bool UserImageManagerImpl::IsUserLoggedInAndRegular() const { |
| 997 const User* user = GetUser(); | 998 const User* user = GetUser(); |
| 998 if (!user) | 999 if (!user) |
| 999 return false; | 1000 return false; |
| 1000 return user->is_logged_in() && user->GetType() == User::USER_TYPE_REGULAR; | 1001 return user->is_logged_in() && user->GetType() == User::USER_TYPE_REGULAR; |
| 1001 } | 1002 } |
| 1002 | 1003 |
| 1003 } // namespace chromeos | 1004 } // namespace chromeos |
| OLD | NEW |