Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Side by Side Diff: chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc

Issue 315213002: Reset avatar image when the avatar policy becomes unset (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698