Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2146)

Side by Side Diff: components/user_manager/user_manager_base.cc

Issue 1865133002: kiosk: Fix kiosk session restart (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, fix nits Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/user_manager/user_manager_base.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 &&
168 IsDeviceLocalAccountMarkedForRemoval(account_id)) {
168 PublicAccountUserLoggedIn(User::CreatePublicAccountUser(account_id)); 169 PublicAccountUserLoggedIn(User::CreatePublicAccountUser(account_id));
169 } else if (account_id != GetOwnerAccountId() && !user && 170 } else if (account_id != GetOwnerAccountId() && !user &&
170 (AreEphemeralUsersEnabled() || browser_restart)) { 171 (AreEphemeralUsersEnabled() || browser_restart)) {
171 RegularUserLoggedInAsEphemeral(account_id); 172 RegularUserLoggedInAsEphemeral(account_id);
172 } else { 173 } else {
173 RegularUserLoggedIn(account_id); 174 RegularUserLoggedIn(account_id);
174 } 175 }
175 } 176 }
176 177
177 DCHECK(active_user_); 178 DCHECK(active_user_);
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 return session_started_; 589 return session_started_;
589 } 590 }
590 591
591 bool UserManagerBase::IsUserNonCryptohomeDataEphemeral( 592 bool UserManagerBase::IsUserNonCryptohomeDataEphemeral(
592 const AccountId& account_id) const { 593 const AccountId& account_id) const {
593 // Data belonging to the guest and stub users is always ephemeral. 594 // Data belonging to the guest and stub users is always ephemeral.
594 if (IsGuestAccountId(account_id) || IsStubAccountId(account_id)) 595 if (IsGuestAccountId(account_id) || IsStubAccountId(account_id))
595 return true; 596 return true;
596 597
597 // Data belonging to the owner, anyone found on the user list and obsolete 598 // Data belonging to the owner, anyone found on the user list and obsolete
598 // public accounts whose data has not been removed yet is not ephemeral. 599 // device local accounts whose data has not been removed yet is not ephemeral.
599 if (account_id == GetOwnerAccountId() || UserExistsInList(account_id) || 600 if (account_id == GetOwnerAccountId() || UserExistsInList(account_id) ||
600 IsPublicAccountMarkedForRemoval(account_id)) { 601 IsDeviceLocalAccountMarkedForRemoval(account_id)) {
601 return false; 602 return false;
602 } 603 }
603 604
604 // Data belonging to the currently logged-in user is ephemeral when: 605 // Data belonging to the currently logged-in user is ephemeral when:
605 // a) The user logged into a regular gaia account while the ephemeral users 606 // a) The user logged into a regular gaia account while the ephemeral users
606 // policy was enabled. 607 // policy was enabled.
607 // - or - 608 // - or -
608 // b) The user logged into any other account type. 609 // b) The user logged into any other account type.
609 if (IsUserLoggedIn() && (account_id == GetLoggedInUser()->GetAccountId()) && 610 if (IsUserLoggedIn() && (account_id == GetLoggedInUser()->GetAccountId()) &&
610 (is_current_user_ephemeral_regular_user_ || 611 (is_current_user_ephemeral_regular_user_ ||
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 const base::DictionaryValue* prefs_display_names = 720 const base::DictionaryValue* prefs_display_names =
720 local_state->GetDictionary(kUserDisplayName); 721 local_state->GetDictionary(kUserDisplayName);
721 const base::DictionaryValue* prefs_given_names = 722 const base::DictionaryValue* prefs_given_names =
722 local_state->GetDictionary(kUserGivenName); 723 local_state->GetDictionary(kUserGivenName);
723 const base::DictionaryValue* prefs_display_emails = 724 const base::DictionaryValue* prefs_display_emails =
724 local_state->GetDictionary(kUserDisplayEmail); 725 local_state->GetDictionary(kUserDisplayEmail);
725 const base::DictionaryValue* prefs_user_types = 726 const base::DictionaryValue* prefs_user_types =
726 local_state->GetDictionary(kUserType); 727 local_state->GetDictionary(kUserType);
727 728
728 // Load public sessions first. 729 // Load public sessions first.
729 std::set<AccountId> public_sessions_set; 730 std::set<AccountId> device_local_accounts_set;
730 LoadPublicAccounts(&public_sessions_set); 731 LoadDeviceLocalAccounts(&device_local_accounts_set);
731 732
732 // Load regular users and supervised users. 733 // Load regular users and supervised users.
733 std::vector<AccountId> regular_users; 734 std::vector<AccountId> regular_users;
734 std::set<AccountId> regular_users_set; 735 std::set<AccountId> regular_users_set;
735 ParseUserList(*prefs_regular_users, 736 ParseUserList(*prefs_regular_users, device_local_accounts_set, &regular_users,
736 public_sessions_set,
737 &regular_users,
738 &regular_users_set); 737 &regular_users_set);
739 for (std::vector<AccountId>::const_iterator it = regular_users.begin(); 738 for (std::vector<AccountId>::const_iterator it = regular_users.begin();
740 it != regular_users.end(); ++it) { 739 it != regular_users.end(); ++it) {
741 User* user = nullptr; 740 User* user = nullptr;
742 if (IsSupervisedAccountId(*it)) { 741 if (IsSupervisedAccountId(*it)) {
743 user = User::CreateSupervisedUser(*it); 742 user = User::CreateSupervisedUser(*it);
744 } else { 743 } else {
745 user = User::CreateRegularUser(*it); 744 user = User::CreateRegularUser(*it);
746 int user_type; 745 int user_type;
747 if (prefs_user_types->GetIntegerWithoutPathExpansion(it->GetUserEmail(), 746 if (prefs_user_types->GetIntegerWithoutPathExpansion(it->GetUserEmail(),
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 } 1043 }
1045 1044
1046 void UserManagerBase::DeleteUser(User* user) { 1045 void UserManagerBase::DeleteUser(User* user) {
1047 const bool is_active_user = (user == active_user_); 1046 const bool is_active_user = (user == active_user_);
1048 delete user; 1047 delete user;
1049 if (is_active_user) 1048 if (is_active_user)
1050 active_user_ = nullptr; 1049 active_user_ = nullptr;
1051 } 1050 }
1052 1051
1053 } // namespace user_manager 1052 } // namespace user_manager
OLDNEW
« no previous file with comments | « components/user_manager/user_manager_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698