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

Side by Side Diff: components/user_manager/user_manager_base.cc

Issue 2568973002: chromeos: Replace user image notifications with observer (Closed)
Patch Set: rebase Created 4 years 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
« no previous file with comments | « components/user_manager/user_manager_base.h ('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 "components/user_manager/user_manager_base.h" 5 #include "components/user_manager/user_manager_base.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 662 DCHECK(task_runner_->RunsTasksOnCurrentThread());
663 session_state_observer_list_.RemoveObserver(obs); 663 session_state_observer_list_.RemoveObserver(obs);
664 } 664 }
665 665
666 void UserManagerBase::NotifyLocalStateChanged() { 666 void UserManagerBase::NotifyLocalStateChanged() {
667 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 667 DCHECK(task_runner_->RunsTasksOnCurrentThread());
668 for (auto& observer : observer_list_) 668 for (auto& observer : observer_list_)
669 observer.LocalStateChanged(this); 669 observer.LocalStateChanged(this);
670 } 670 }
671 671
672 void UserManagerBase::NotifyUserImageChanged(const User& user) {
673 DCHECK(task_runner_->RunsTasksOnCurrentThread());
674 for (auto& observer : observer_list_)
675 observer.OnUserImageChanged(user);
676 }
677
678 void UserManagerBase::NotifyUserProfileImageUpdateFailed(const User& user) {
679 DCHECK(task_runner_->RunsTasksOnCurrentThread());
680 for (auto& observer : observer_list_)
681 observer.OnUserProfileImageUpdateFailed(user);
682 }
683
684 void UserManagerBase::NotifyUserProfileImageUpdated(
685 const User& user,
686 const gfx::ImageSkia& profile_image) {
687 DCHECK(task_runner_->RunsTasksOnCurrentThread());
688 for (auto& observer : observer_list_)
689 observer.OnUserProfileImageUpdated(user, profile_image);
690 }
691
672 bool UserManagerBase::CanUserBeRemoved(const User* user) const { 692 bool UserManagerBase::CanUserBeRemoved(const User* user) const {
673 // Only regular and supervised users are allowed to be manually removed. 693 // Only regular and supervised users are allowed to be manually removed.
674 if (!user || !(user->HasGaiaAccount() || user->IsSupervised())) 694 if (!user || !(user->HasGaiaAccount() || user->IsSupervised()))
675 return false; 695 return false;
676 696
677 // Sanity check: we must not remove single user unless it's an enterprise 697 // Sanity check: we must not remove single user unless it's an enterprise
678 // device. This check may seem redundant at a first sight because 698 // device. This check may seem redundant at a first sight because
679 // this single user must be an owner and we perform special check later 699 // this single user must be an owner and we perform special check later
680 // in order not to remove an owner. However due to non-instant nature of 700 // in order not to remove an owner. However due to non-instant nature of
681 // ownership assignment this later check may sometimes fail. 701 // ownership assignment this later check may sometimes fail.
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 } 1081 }
1062 1082
1063 void UserManagerBase::DeleteUser(User* user) { 1083 void UserManagerBase::DeleteUser(User* user) {
1064 const bool is_active_user = (user == active_user_); 1084 const bool is_active_user = (user == active_user_);
1065 delete user; 1085 delete user;
1066 if (is_active_user) 1086 if (is_active_user)
1067 active_user_ = nullptr; 1087 active_user_ = nullptr;
1068 } 1088 }
1069 1089
1070 } // namespace user_manager 1090 } // namespace user_manager
OLDNEW
« no previous file with comments | « components/user_manager/user_manager_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698