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 "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 policy::GetDeviceLocalAccounts(cros_settings_)); | 576 policy::GetDeviceLocalAccounts(cros_settings_)); |
577 | 577 |
578 // If ephemeral users are enabled and we are on the login screen, take this | 578 // If ephemeral users are enabled and we are on the login screen, take this |
579 // opportunity to clean up by removing all regular users except the owner. | 579 // opportunity to clean up by removing all regular users except the owner. |
580 if (GetEphemeralUsersEnabled() && !IsUserLoggedIn()) { | 580 if (GetEphemeralUsersEnabled() && !IsUserLoggedIn()) { |
581 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers); | 581 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers); |
582 prefs_users_update->Clear(); | 582 prefs_users_update->Clear(); |
583 for (user_manager::UserList::iterator it = users_.begin(); | 583 for (user_manager::UserList::iterator it = users_.begin(); |
584 it != users_.end();) { | 584 it != users_.end();) { |
585 const std::string user_email = (*it)->email(); | 585 const std::string user_email = (*it)->email(); |
586 if ((*it)->GetType() == user_manager::USER_TYPE_REGULAR && | 586 if ((*it)->IsRegular() && user_email != GetOwnerEmail()) { |
587 user_email != GetOwnerEmail()) { | |
588 RemoveNonCryptohomeData(user_email); | 587 RemoveNonCryptohomeData(user_email); |
589 DeleteUser(*it); | 588 DeleteUser(*it); |
590 it = users_.erase(it); | 589 it = users_.erase(it); |
591 changed = true; | 590 changed = true; |
592 } else { | 591 } else { |
593 if ((*it)->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 592 if ((*it)->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
594 prefs_users_update->Append(new base::StringValue(user_email)); | 593 prefs_users_update->Append(new base::StringValue(user_email)); |
595 ++it; | 594 ++it; |
596 } | 595 } |
597 } | 596 } |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 ash::MultiProfileUMA::RecordUserCount(users); | 1069 ash::MultiProfileUMA::RecordUserCount(users); |
1071 } | 1070 } |
1072 #endif | 1071 #endif |
1073 | 1072 |
1074 base::debug::SetCrashKeyValue( | 1073 base::debug::SetCrashKeyValue( |
1075 crash_keys::kNumberOfUsers, | 1074 crash_keys::kNumberOfUsers, |
1076 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); | 1075 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); |
1077 } | 1076 } |
1078 | 1077 |
1079 } // namespace chromeos | 1078 } // namespace chromeos |
OLD | NEW |