| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 // Data belonging to the guest and demo users is always ephemeral. | 636 // Data belonging to the guest and demo users is always ephemeral. |
| 637 if (IsGuestAccountId(account_id) || IsDemoApp(account_id)) | 637 if (IsGuestAccountId(account_id) || IsDemoApp(account_id)) |
| 638 return true; | 638 return true; |
| 639 | 639 |
| 640 // Data belonging to the public accounts is always ephemeral. | 640 // Data belonging to the public accounts is always ephemeral. |
| 641 const User* user = FindUser(account_id); | 641 const User* user = FindUser(account_id); |
| 642 if (user && user->GetType() == USER_TYPE_PUBLIC_ACCOUNT) | 642 if (user && user->GetType() == USER_TYPE_PUBLIC_ACCOUNT) |
| 643 return true; | 643 return true; |
| 644 | 644 |
| 645 // Ephemeral users. | 645 // Ephemeral users. |
| 646 if (user && user->GetType() == USER_TYPE_REGULAR && | 646 if (AreEphemeralUsersEnabled() && user && |
| 647 user->GetType() == USER_TYPE_REGULAR && |
| 647 FindUserInList(account_id) == nullptr) { | 648 FindUserInList(account_id) == nullptr) { |
| 648 return true; | 649 return true; |
| 649 } | 650 } |
| 650 | 651 |
| 651 return false; | 652 return false; |
| 652 } | 653 } |
| 653 | 654 |
| 654 void UserManagerBase::AddObserver(UserManager::Observer* obs) { | 655 void UserManagerBase::AddObserver(UserManager::Observer* obs) { |
| 655 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 656 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| 656 observer_list_.AddObserver(obs); | 657 observer_list_.AddObserver(obs); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 } | 1074 } |
| 1074 | 1075 |
| 1075 void UserManagerBase::DeleteUser(User* user) { | 1076 void UserManagerBase::DeleteUser(User* user) { |
| 1076 const bool is_active_user = (user == active_user_); | 1077 const bool is_active_user = (user == active_user_); |
| 1077 delete user; | 1078 delete user; |
| 1078 if (is_active_user) | 1079 if (is_active_user) |
| 1079 active_user_ = nullptr; | 1080 active_user_ = nullptr; |
| 1080 } | 1081 } |
| 1081 | 1082 |
| 1082 } // namespace user_manager | 1083 } // namespace user_manager |
| OLD | NEW |