| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 // Reset the new user flag if the user already exists. | 146 // Reset the new user flag if the user already exists. |
| 147 SetIsCurrentUserNew(false); | 147 SetIsCurrentUserNew(false); |
| 148 NotifyUserAddedToSession(user, true /* user switch pending */); | 148 NotifyUserAddedToSession(user, true /* user switch pending */); |
| 149 | 149 |
| 150 return; | 150 return; |
| 151 } | 151 } |
| 152 | 152 |
| 153 if (IsGuestAccountId(account_id)) { | 153 if (IsGuestAccountId(account_id)) { |
| 154 GuestUserLoggedIn(); | 154 GuestUserLoggedIn(); |
| 155 } else if (IsKioskApp(account_id)) { | |
| 156 KioskAppLoggedIn(account_id); | |
| 157 } else if (IsDemoApp(account_id)) { | 155 } else if (IsDemoApp(account_id)) { |
| 158 DemoAccountLoggedIn(); | 156 DemoAccountLoggedIn(); |
| 159 } else { | 157 } else { |
| 160 EnsureUsersLoaded(); | 158 EnsureUsersLoaded(); |
| 161 | 159 |
| 162 if (user && user->GetType() == USER_TYPE_PUBLIC_ACCOUNT) { | 160 if (user && user->GetType() == USER_TYPE_PUBLIC_ACCOUNT) { |
| 163 PublicAccountUserLoggedIn(user); | 161 PublicAccountUserLoggedIn(user); |
| 162 } else if (user && user->GetType() == USER_TYPE_KIOSK_APP) { |
| 163 KioskAppLoggedIn(user); |
| 164 } else if ((user && user->GetType() == USER_TYPE_SUPERVISED) || | 164 } else if ((user && user->GetType() == USER_TYPE_SUPERVISED) || |
| 165 (!user && IsSupervisedAccountId(account_id))) { | 165 (!user && IsSupervisedAccountId(account_id))) { |
| 166 SupervisedUserLoggedIn(account_id); | 166 SupervisedUserLoggedIn(account_id); |
| 167 } else if (browser_restart && IsPublicAccountMarkedForRemoval(account_id)) { | 167 } else if (browser_restart && IsPublicAccountMarkedForRemoval(account_id)) { |
| 168 PublicAccountUserLoggedIn(User::CreatePublicAccountUser(account_id)); | 168 PublicAccountUserLoggedIn(User::CreatePublicAccountUser(account_id)); |
| 169 } else if (account_id != GetOwnerAccountId() && !user && | 169 } else if (account_id != GetOwnerAccountId() && !user && |
| 170 (AreEphemeralUsersEnabled() || browser_restart)) { | 170 (AreEphemeralUsersEnabled() || browser_restart)) { |
| 171 RegularUserLoggedInAsEphemeral(account_id); | 171 RegularUserLoggedInAsEphemeral(account_id); |
| 172 } else { | 172 } else { |
| 173 RegularUserLoggedIn(account_id); | 173 RegularUserLoggedIn(account_id); |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 const base::DictionaryValue* prefs_display_names = | 719 const base::DictionaryValue* prefs_display_names = |
| 720 local_state->GetDictionary(kUserDisplayName); | 720 local_state->GetDictionary(kUserDisplayName); |
| 721 const base::DictionaryValue* prefs_given_names = | 721 const base::DictionaryValue* prefs_given_names = |
| 722 local_state->GetDictionary(kUserGivenName); | 722 local_state->GetDictionary(kUserGivenName); |
| 723 const base::DictionaryValue* prefs_display_emails = | 723 const base::DictionaryValue* prefs_display_emails = |
| 724 local_state->GetDictionary(kUserDisplayEmail); | 724 local_state->GetDictionary(kUserDisplayEmail); |
| 725 const base::DictionaryValue* prefs_user_types = | 725 const base::DictionaryValue* prefs_user_types = |
| 726 local_state->GetDictionary(kUserType); | 726 local_state->GetDictionary(kUserType); |
| 727 | 727 |
| 728 // Load public sessions first. | 728 // Load public sessions first. |
| 729 std::set<AccountId> public_sessions_set; | 729 std::set<AccountId> device_local_accounts_set; |
| 730 LoadPublicAccounts(&public_sessions_set); | 730 LoadDeviceLocalAccounts(&device_local_accounts_set); |
| 731 | 731 |
| 732 // Load regular users and supervised users. | 732 // Load regular users and supervised users. |
| 733 std::vector<AccountId> regular_users; | 733 std::vector<AccountId> regular_users; |
| 734 std::set<AccountId> regular_users_set; | 734 std::set<AccountId> regular_users_set; |
| 735 ParseUserList(*prefs_regular_users, | 735 ParseUserList(*prefs_regular_users, |
| 736 public_sessions_set, | 736 device_local_accounts_set, |
| 737 ®ular_users, | 737 ®ular_users, |
| 738 ®ular_users_set); | 738 ®ular_users_set); |
| 739 for (std::vector<AccountId>::const_iterator it = regular_users.begin(); | 739 for (std::vector<AccountId>::const_iterator it = regular_users.begin(); |
| 740 it != regular_users.end(); ++it) { | 740 it != regular_users.end(); ++it) { |
| 741 User* user = nullptr; | 741 User* user = nullptr; |
| 742 if (IsSupervisedAccountId(*it)) { | 742 if (IsSupervisedAccountId(*it)) { |
| 743 user = User::CreateSupervisedUser(*it); | 743 user = User::CreateSupervisedUser(*it); |
| 744 } else { | 744 } else { |
| 745 user = User::CreateRegularUser(*it); | 745 user = User::CreateRegularUser(*it); |
| 746 int user_type; | 746 int user_type; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 void UserManagerBase::DeleteUser(User* user) { | 1046 void UserManagerBase::DeleteUser(User* user) { |
| 1047 const bool is_active_user = (user == active_user_); | 1047 const bool is_active_user = (user == active_user_); |
| 1048 delete user; | 1048 delete user; |
| 1049 if (is_active_user) | 1049 if (is_active_user) |
| 1050 active_user_ = nullptr; | 1050 active_user_ = nullptr; |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 } // namespace user_manager | 1053 } // namespace user_manager |
| OLD | NEW |