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

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

Issue 637533002: Added calls for deferred supervised user status change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 650 DCHECK(task_runner_->RunsTasksOnCurrentThread());
651 session_state_observer_list_.RemoveObserver(obs); 651 session_state_observer_list_.RemoveObserver(obs);
652 } 652 }
653 653
654 void UserManagerBase::NotifyLocalStateChanged() { 654 void UserManagerBase::NotifyLocalStateChanged() {
655 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 655 DCHECK(task_runner_->RunsTasksOnCurrentThread());
656 FOR_EACH_OBSERVER( 656 FOR_EACH_OBSERVER(
657 UserManager::Observer, observer_list_, LocalStateChanged(this)); 657 UserManager::Observer, observer_list_, LocalStateChanged(this));
658 } 658 }
659 659
660 void UserManagerBase::ForceUpdateState() {
661 UpdateLoginState();
662 }
663
664 bool UserManagerBase::CanUserBeRemoved(const User* user) const { 660 bool UserManagerBase::CanUserBeRemoved(const User* user) const {
665 // Only regular and supervised users are allowed to be manually removed. 661 // Only regular and supervised users are allowed to be manually removed.
666 if (!user || (user->GetType() != USER_TYPE_REGULAR && 662 if (!user || (user->GetType() != USER_TYPE_REGULAR &&
667 user->GetType() != USER_TYPE_SUPERVISED)) { 663 user->GetType() != USER_TYPE_SUPERVISED)) {
668 return false; 664 return false;
669 } 665 }
670 666
671 // Sanity check: we must not remove single user unless it's an enterprise 667 // Sanity check: we must not remove single user unless it's an enterprise
672 // device. This check may seem redundant at a first sight because 668 // device. This check may seem redundant at a first sight because
673 // this single user must be an owner and we perform special check later 669 // this single user must be an owner and we perform special check later
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 UserAddedToSession(added_user)); 947 UserAddedToSession(added_user));
952 } 948 }
953 949
954 void UserManagerBase::NotifyActiveUserHashChanged(const std::string& hash) { 950 void UserManagerBase::NotifyActiveUserHashChanged(const std::string& hash) {
955 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 951 DCHECK(task_runner_->RunsTasksOnCurrentThread());
956 FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver, 952 FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver,
957 session_state_observer_list_, 953 session_state_observer_list_,
958 ActiveUserHashChanged(hash)); 954 ActiveUserHashChanged(hash));
959 } 955 }
960 956
957 void UserManagerBase::ChangeUserSupervisedStatus(
958 User* user, bool is_supervised) {
Daniel Erat 2014/10/07 16:19:19 nit: one argument per line since they don't all fi
merkulova 2014/10/08 09:47:11 Done.
959 DCHECK(task_runner_->RunsTasksOnCurrentThread());
960 user->SetIsSupervised(is_supervised);
961 FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver,
962 session_state_observer_list_,
963 UserChangedSupervisedStatus(user));
964 }
965
961 void UserManagerBase::UpdateLoginState() { 966 void UserManagerBase::UpdateLoginState() {
962 if (!chromeos::LoginState::IsInitialized()) 967 if (!chromeos::LoginState::IsInitialized())
963 return; // LoginState may not be intialized in tests. 968 return; // LoginState may not be intialized in tests.
964 969
965 chromeos::LoginState::LoggedInState logged_in_state; 970 chromeos::LoginState::LoggedInState logged_in_state;
966 logged_in_state = active_user_ ? chromeos::LoginState::LOGGED_IN_ACTIVE 971 logged_in_state = active_user_ ? chromeos::LoginState::LOGGED_IN_ACTIVE
967 : chromeos::LoginState::LOGGED_IN_NONE; 972 : chromeos::LoginState::LOGGED_IN_NONE;
968 973
969 chromeos::LoginState::LoggedInUserType login_user_type; 974 chromeos::LoginState::LoggedInUserType login_user_type;
970 if (logged_in_state == chromeos::LoginState::LOGGED_IN_NONE) 975 if (logged_in_state == chromeos::LoginState::LOGGED_IN_NONE)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 } 1059 }
1055 1060
1056 void UserManagerBase::DeleteUser(User* user) { 1061 void UserManagerBase::DeleteUser(User* user) {
1057 const bool is_active_user = (user == active_user_); 1062 const bool is_active_user = (user == active_user_);
1058 delete user; 1063 delete user;
1059 if (is_active_user) 1064 if (is_active_user)
1060 active_user_ = NULL; 1065 active_user_ = NULL;
1061 } 1066 }
1062 1067
1063 } // namespace user_manager 1068 } // namespace user_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698