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 | |
641 bool UserManagerBase::CanUserBeRemoved(const User* user) const { | 637 bool UserManagerBase::CanUserBeRemoved(const User* user) const { |
642 // Only regular and supervised users are allowed to be manually removed. | 638 // Only regular and supervised users are allowed to be manually removed. |
643 if (!user || (user->GetType() != USER_TYPE_REGULAR && | 639 if (!user || (user->GetType() != USER_TYPE_REGULAR && |
644 user->GetType() != USER_TYPE_SUPERVISED)) { | 640 user->GetType() != USER_TYPE_SUPERVISED)) { |
645 return false; | 641 return false; |
646 } | 642 } |
647 | 643 |
648 // Sanity check: we must not remove single user unless it's an enterprise | 644 // Sanity check: we must not remove single user unless it's an enterprise |
649 // device. This check may seem redundant at a first sight because | 645 // device. This check may seem redundant at a first sight because |
650 // this single user must be an owner and we perform special check later | 646 // 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... |
1024 } | 1020 } |
1025 | 1021 |
1026 void UserManagerBase::DeleteUser(User* user) { | 1022 void UserManagerBase::DeleteUser(User* user) { |
1027 const bool is_active_user = (user == active_user_); | 1023 const bool is_active_user = (user == active_user_); |
1028 delete user; | 1024 delete user; |
1029 if (is_active_user) | 1025 if (is_active_user) |
1030 active_user_ = NULL; | 1026 active_user_ = NULL; |
1031 } | 1027 } |
1032 | 1028 |
1033 } // namespace user_manager | 1029 } // namespace user_manager |
OLD | NEW |