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

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

Issue 608283003: Remove retail mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
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 <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 // Reset the new user flag if the user already exists. 179 // Reset the new user flag if the user already exists.
180 SetIsCurrentUserNew(false); 180 SetIsCurrentUserNew(false);
181 NotifyUserAddedToSession(user, true /* user switch pending */); 181 NotifyUserAddedToSession(user, true /* user switch pending */);
182 182
183 return; 183 return;
184 } 184 }
185 185
186 if (user_id == chromeos::login::kGuestUserName) { 186 if (user_id == chromeos::login::kGuestUserName) {
187 GuestUserLoggedIn(); 187 GuestUserLoggedIn();
188 } else if (user_id == chromeos::login::kRetailModeUserName) {
189 RetailModeUserLoggedIn();
190 } else if (IsKioskApp(user_id)) { 188 } else if (IsKioskApp(user_id)) {
191 KioskAppLoggedIn(user_id); 189 KioskAppLoggedIn(user_id);
192 } else if (IsDemoApp(user_id)) { 190 } else if (IsDemoApp(user_id)) {
193 DemoAccountLoggedIn(); 191 DemoAccountLoggedIn();
194 } else { 192 } else {
195 EnsureUsersLoaded(); 193 EnsureUsersLoaded();
196 194
197 if (user && user->GetType() == USER_TYPE_PUBLIC_ACCOUNT) { 195 if (user && user->GetType() == USER_TYPE_PUBLIC_ACCOUNT) {
198 PublicAccountUserLoggedIn(user); 196 PublicAccountUserLoggedIn(user);
199 } else if ((user && user->GetType() == USER_TYPE_SUPERVISED) || 197 } else if ((user && user->GetType() == USER_TYPE_SUPERVISED) ||
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 578 DCHECK(task_runner_->RunsTasksOnCurrentThread());
581 return IsUserLoggedIn() && active_user_->HasGaiaAccount(); 579 return IsUserLoggedIn() && active_user_->HasGaiaAccount();
582 } 580 }
583 581
584 bool UserManagerBase::IsLoggedInAsRegularSupervisedUser() const { 582 bool UserManagerBase::IsLoggedInAsRegularSupervisedUser() const {
585 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 583 DCHECK(task_runner_->RunsTasksOnCurrentThread());
586 return IsUserLoggedIn() && active_user_->GetType() == 584 return IsUserLoggedIn() && active_user_->GetType() ==
587 USER_TYPE_REGULAR_SUPERVISED; 585 USER_TYPE_REGULAR_SUPERVISED;
588 } 586 }
589 587
590 bool UserManagerBase::IsLoggedInAsDemoUser() const {
591 DCHECK(task_runner_->RunsTasksOnCurrentThread());
592 return IsUserLoggedIn() && active_user_->GetType() == USER_TYPE_RETAIL_MODE;
593 }
594
595 bool UserManagerBase::IsLoggedInAsPublicAccount() const { 588 bool UserManagerBase::IsLoggedInAsPublicAccount() const {
596 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 589 DCHECK(task_runner_->RunsTasksOnCurrentThread());
597 return IsUserLoggedIn() && 590 return IsUserLoggedIn() &&
598 active_user_->GetType() == USER_TYPE_PUBLIC_ACCOUNT; 591 active_user_->GetType() == USER_TYPE_PUBLIC_ACCOUNT;
599 } 592 }
600 593
601 bool UserManagerBase::IsLoggedInAsGuest() const { 594 bool UserManagerBase::IsLoggedInAsGuest() const {
602 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 595 DCHECK(task_runner_->RunsTasksOnCurrentThread());
603 return IsUserLoggedIn() && active_user_->GetType() == USER_TYPE_GUEST; 596 return IsUserLoggedIn() && active_user_->GetType() == USER_TYPE_GUEST;
604 } 597 }
(...skipping 14 matching lines...) Expand all
619 active_user_->email() == chromeos::login::kStubUser; 612 active_user_->email() == chromeos::login::kStubUser;
620 } 613 }
621 614
622 bool UserManagerBase::IsSessionStarted() const { 615 bool UserManagerBase::IsSessionStarted() const {
623 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 616 DCHECK(task_runner_->RunsTasksOnCurrentThread());
624 return session_started_; 617 return session_started_;
625 } 618 }
626 619
627 bool UserManagerBase::IsUserNonCryptohomeDataEphemeral( 620 bool UserManagerBase::IsUserNonCryptohomeDataEphemeral(
628 const std::string& user_id) const { 621 const std::string& user_id) const {
629 // Data belonging to the guest, retail mode and stub users is always 622 // Data belonging to the guest and stub users is always ephemeral.
630 // ephemeral.
631 if (user_id == chromeos::login::kGuestUserName || 623 if (user_id == chromeos::login::kGuestUserName ||
632 user_id == chromeos::login::kRetailModeUserName ||
633 user_id == chromeos::login::kStubUser) { 624 user_id == chromeos::login::kStubUser) {
634 return true; 625 return true;
635 } 626 }
636 627
637 // Data belonging to the owner, anyone found on the user list and obsolete 628 // Data belonging to the owner, anyone found on the user list and obsolete
638 // public accounts whose data has not been removed yet is not ephemeral. 629 // public accounts whose data has not been removed yet is not ephemeral.
639 if (user_id == GetOwnerEmail() || UserExistsInList(user_id) || 630 if (user_id == GetOwnerEmail() || UserExistsInList(user_id) ||
640 IsPublicAccountMarkedForRemoval(user_id)) { 631 IsPublicAccountMarkedForRemoval(user_id)) {
641 return false; 632 return false;
642 } 633 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 logged_in_state = active_user_ ? chromeos::LoginState::LOGGED_IN_ACTIVE 1001 logged_in_state = active_user_ ? chromeos::LoginState::LOGGED_IN_ACTIVE
1011 : chromeos::LoginState::LOGGED_IN_NONE; 1002 : chromeos::LoginState::LOGGED_IN_NONE;
1012 1003
1013 chromeos::LoginState::LoggedInUserType login_user_type; 1004 chromeos::LoginState::LoggedInUserType login_user_type;
1014 if (logged_in_state == chromeos::LoginState::LOGGED_IN_NONE) 1005 if (logged_in_state == chromeos::LoginState::LOGGED_IN_NONE)
1015 login_user_type = chromeos::LoginState::LOGGED_IN_USER_NONE; 1006 login_user_type = chromeos::LoginState::LOGGED_IN_USER_NONE;
1016 else if (is_current_user_owner_) 1007 else if (is_current_user_owner_)
1017 login_user_type = chromeos::LoginState::LOGGED_IN_USER_OWNER; 1008 login_user_type = chromeos::LoginState::LOGGED_IN_USER_OWNER;
1018 else if (active_user_->GetType() == USER_TYPE_GUEST) 1009 else if (active_user_->GetType() == USER_TYPE_GUEST)
1019 login_user_type = chromeos::LoginState::LOGGED_IN_USER_GUEST; 1010 login_user_type = chromeos::LoginState::LOGGED_IN_USER_GUEST;
1020 else if (active_user_->GetType() == USER_TYPE_RETAIL_MODE)
1021 login_user_type = chromeos::LoginState::LOGGED_IN_USER_RETAIL_MODE;
1022 else if (active_user_->GetType() == USER_TYPE_PUBLIC_ACCOUNT) 1011 else if (active_user_->GetType() == USER_TYPE_PUBLIC_ACCOUNT)
1023 login_user_type = chromeos::LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT; 1012 login_user_type = chromeos::LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT;
1024 else if (active_user_->GetType() == USER_TYPE_SUPERVISED) 1013 else if (active_user_->GetType() == USER_TYPE_SUPERVISED)
1025 login_user_type = chromeos::LoginState::LOGGED_IN_USER_SUPERVISED; 1014 login_user_type = chromeos::LoginState::LOGGED_IN_USER_SUPERVISED;
1026 else if (active_user_->GetType() == USER_TYPE_KIOSK_APP) 1015 else if (active_user_->GetType() == USER_TYPE_KIOSK_APP)
1027 login_user_type = chromeos::LoginState::LOGGED_IN_USER_KIOSK_APP; 1016 login_user_type = chromeos::LoginState::LOGGED_IN_USER_KIOSK_APP;
1028 else 1017 else
1029 login_user_type = chromeos::LoginState::LOGGED_IN_USER_REGULAR; 1018 login_user_type = chromeos::LoginState::LOGGED_IN_USER_REGULAR;
1030 1019
1031 if (primary_user_) { 1020 if (primary_user_) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 } 1087 }
1099 1088
1100 void UserManagerBase::DeleteUser(User* user) { 1089 void UserManagerBase::DeleteUser(User* user) {
1101 const bool is_active_user = (user == active_user_); 1090 const bool is_active_user = (user == active_user_);
1102 delete user; 1091 delete user;
1103 if (is_active_user) 1092 if (is_active_user)
1104 active_user_ = NULL; 1093 active_user_ = NULL;
1105 } 1094 }
1106 1095
1107 } // namespace user_manager 1096 } // namespace user_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698