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 "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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 627 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
628 session_state_observer_list_.RemoveObserver(obs); | 628 session_state_observer_list_.RemoveObserver(obs); |
629 } | 629 } |
630 | 630 |
631 void UserManagerBase::NotifyLocalStateChanged() { | 631 void UserManagerBase::NotifyLocalStateChanged() { |
632 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 632 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
633 FOR_EACH_OBSERVER( | 633 FOR_EACH_OBSERVER( |
634 UserManager::Observer, observer_list_, LocalStateChanged(this)); | 634 UserManager::Observer, observer_list_, LocalStateChanged(this)); |
635 } | 635 } |
636 | 636 |
| 637 void UserManagerBase::ForceUpdateState() { |
| 638 UpdateLoginState(); |
| 639 } |
| 640 |
637 bool UserManagerBase::CanUserBeRemoved(const User* user) const { | 641 bool UserManagerBase::CanUserBeRemoved(const User* user) const { |
638 // Only regular and supervised users are allowed to be manually removed. | 642 // Only regular and supervised users are allowed to be manually removed. |
639 if (!user || (user->GetType() != USER_TYPE_REGULAR && | 643 if (!user || (user->GetType() != USER_TYPE_REGULAR && |
640 user->GetType() != USER_TYPE_SUPERVISED)) { | 644 user->GetType() != USER_TYPE_SUPERVISED)) { |
641 return false; | 645 return false; |
642 } | 646 } |
643 | 647 |
644 // Sanity check: we must not remove single user unless it's an enterprise | 648 // Sanity check: we must not remove single user unless it's an enterprise |
645 // device. This check may seem redundant at a first sight because | 649 // device. This check may seem redundant at a first sight because |
646 // this single user must be an owner and we perform special check later | 650 // this single user must be an owner and we perform special check later |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 } | 1024 } |
1021 | 1025 |
1022 void UserManagerBase::DeleteUser(User* user) { | 1026 void UserManagerBase::DeleteUser(User* user) { |
1023 const bool is_active_user = (user == active_user_); | 1027 const bool is_active_user = (user == active_user_); |
1024 delete user; | 1028 delete user; |
1025 if (is_active_user) | 1029 if (is_active_user) |
1026 active_user_ = NULL; | 1030 active_user_ = NULL; |
1027 } | 1031 } |
1028 | 1032 |
1029 } // namespace user_manager | 1033 } // namespace user_manager |
OLD | NEW |