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

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, 2 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
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 // Reset the new user flag if the user already exists. 175 // Reset the new user flag if the user already exists.
176 SetIsCurrentUserNew(false); 176 SetIsCurrentUserNew(false);
177 NotifyUserAddedToSession(user, true /* user switch pending */); 177 NotifyUserAddedToSession(user, true /* user switch pending */);
178 178
179 return; 179 return;
180 } 180 }
181 181
182 if (user_id == chromeos::login::kGuestUserName) { 182 if (user_id == chromeos::login::kGuestUserName) {
183 GuestUserLoggedIn(); 183 GuestUserLoggedIn();
184 } else if (user_id == chromeos::login::kRetailModeUserName) {
185 RetailModeUserLoggedIn();
186 } else if (IsKioskApp(user_id)) { 184 } else if (IsKioskApp(user_id)) {
187 KioskAppLoggedIn(user_id); 185 KioskAppLoggedIn(user_id);
188 } else if (IsDemoApp(user_id)) { 186 } else if (IsDemoApp(user_id)) {
189 DemoAccountLoggedIn(); 187 DemoAccountLoggedIn();
190 } else { 188 } else {
191 EnsureUsersLoaded(); 189 EnsureUsersLoaded();
192 190
193 if (user && user->GetType() == USER_TYPE_PUBLIC_ACCOUNT) { 191 if (user && user->GetType() == USER_TYPE_PUBLIC_ACCOUNT) {
194 PublicAccountUserLoggedIn(user); 192 PublicAccountUserLoggedIn(user);
195 } else if ((user && user->GetType() == USER_TYPE_SUPERVISED) || 193 } else if ((user && user->GetType() == USER_TYPE_SUPERVISED) ||
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 bool UserManagerBase::IsUserLoggedIn() const { 547 bool UserManagerBase::IsUserLoggedIn() const {
550 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 548 DCHECK(task_runner_->RunsTasksOnCurrentThread());
551 return active_user_; 549 return active_user_;
552 } 550 }
553 551
554 bool UserManagerBase::IsLoggedInAsRegularUser() const { 552 bool UserManagerBase::IsLoggedInAsRegularUser() const {
555 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 553 DCHECK(task_runner_->RunsTasksOnCurrentThread());
556 return IsUserLoggedIn() && active_user_->GetType() == USER_TYPE_REGULAR; 554 return IsUserLoggedIn() && active_user_->GetType() == USER_TYPE_REGULAR;
557 } 555 }
558 556
559 bool UserManagerBase::IsLoggedInAsDemoUser() const {
560 DCHECK(task_runner_->RunsTasksOnCurrentThread());
561 return IsUserLoggedIn() && active_user_->GetType() == USER_TYPE_RETAIL_MODE;
562 }
563
564 bool UserManagerBase::IsLoggedInAsPublicAccount() const { 557 bool UserManagerBase::IsLoggedInAsPublicAccount() const {
565 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 558 DCHECK(task_runner_->RunsTasksOnCurrentThread());
566 return IsUserLoggedIn() && 559 return IsUserLoggedIn() &&
567 active_user_->GetType() == USER_TYPE_PUBLIC_ACCOUNT; 560 active_user_->GetType() == USER_TYPE_PUBLIC_ACCOUNT;
568 } 561 }
569 562
570 bool UserManagerBase::IsLoggedInAsGuest() const { 563 bool UserManagerBase::IsLoggedInAsGuest() const {
571 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 564 DCHECK(task_runner_->RunsTasksOnCurrentThread());
572 return IsUserLoggedIn() && active_user_->GetType() == USER_TYPE_GUEST; 565 return IsUserLoggedIn() && active_user_->GetType() == USER_TYPE_GUEST;
573 } 566 }
(...skipping 14 matching lines...) Expand all
588 active_user_->email() == chromeos::login::kStubUser; 581 active_user_->email() == chromeos::login::kStubUser;
589 } 582 }
590 583
591 bool UserManagerBase::IsSessionStarted() const { 584 bool UserManagerBase::IsSessionStarted() const {
592 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 585 DCHECK(task_runner_->RunsTasksOnCurrentThread());
593 return session_started_; 586 return session_started_;
594 } 587 }
595 588
596 bool UserManagerBase::IsUserNonCryptohomeDataEphemeral( 589 bool UserManagerBase::IsUserNonCryptohomeDataEphemeral(
597 const std::string& user_id) const { 590 const std::string& user_id) const {
598 // Data belonging to the guest, retail mode and stub users is always 591 // Data belonging to the guest and stub users is always
bartfab (slow) 2014/10/15 09:52:21 Nit: The entire comment fits on one line now.
rkc 2014/11/20 21:06:34 Done.
599 // ephemeral. 592 // ephemeral.
600 if (user_id == chromeos::login::kGuestUserName || 593 if (user_id == chromeos::login::kGuestUserName ||
601 user_id == chromeos::login::kRetailModeUserName ||
602 user_id == chromeos::login::kStubUser) { 594 user_id == chromeos::login::kStubUser) {
603 return true; 595 return true;
604 } 596 }
605 597
606 // 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
607 // public accounts whose data has not been removed yet is not ephemeral. 599 // public accounts whose data has not been removed yet is not ephemeral.
608 if (user_id == GetOwnerEmail() || UserExistsInList(user_id) || 600 if (user_id == GetOwnerEmail() || UserExistsInList(user_id) ||
609 IsPublicAccountMarkedForRemoval(user_id)) { 601 IsPublicAccountMarkedForRemoval(user_id)) {
610 return false; 602 return false;
611 } 603 }
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 logged_in_state = active_user_ ? chromeos::LoginState::LOGGED_IN_ACTIVE 958 logged_in_state = active_user_ ? chromeos::LoginState::LOGGED_IN_ACTIVE
967 : chromeos::LoginState::LOGGED_IN_NONE; 959 : chromeos::LoginState::LOGGED_IN_NONE;
968 960
969 chromeos::LoginState::LoggedInUserType login_user_type; 961 chromeos::LoginState::LoggedInUserType login_user_type;
970 if (logged_in_state == chromeos::LoginState::LOGGED_IN_NONE) 962 if (logged_in_state == chromeos::LoginState::LOGGED_IN_NONE)
971 login_user_type = chromeos::LoginState::LOGGED_IN_USER_NONE; 963 login_user_type = chromeos::LoginState::LOGGED_IN_USER_NONE;
972 else if (is_current_user_owner_) 964 else if (is_current_user_owner_)
973 login_user_type = chromeos::LoginState::LOGGED_IN_USER_OWNER; 965 login_user_type = chromeos::LoginState::LOGGED_IN_USER_OWNER;
974 else if (active_user_->GetType() == USER_TYPE_GUEST) 966 else if (active_user_->GetType() == USER_TYPE_GUEST)
975 login_user_type = chromeos::LoginState::LOGGED_IN_USER_GUEST; 967 login_user_type = chromeos::LoginState::LOGGED_IN_USER_GUEST;
976 else if (active_user_->GetType() == USER_TYPE_RETAIL_MODE)
977 login_user_type = chromeos::LoginState::LOGGED_IN_USER_RETAIL_MODE;
978 else if (active_user_->GetType() == USER_TYPE_PUBLIC_ACCOUNT) 968 else if (active_user_->GetType() == USER_TYPE_PUBLIC_ACCOUNT)
979 login_user_type = chromeos::LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT; 969 login_user_type = chromeos::LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT;
980 else if (active_user_->GetType() == USER_TYPE_SUPERVISED) 970 else if (active_user_->GetType() == USER_TYPE_SUPERVISED)
981 login_user_type = chromeos::LoginState::LOGGED_IN_USER_SUPERVISED; 971 login_user_type = chromeos::LoginState::LOGGED_IN_USER_SUPERVISED;
982 else if (active_user_->GetType() == USER_TYPE_KIOSK_APP) 972 else if (active_user_->GetType() == USER_TYPE_KIOSK_APP)
983 login_user_type = chromeos::LoginState::LOGGED_IN_USER_KIOSK_APP; 973 login_user_type = chromeos::LoginState::LOGGED_IN_USER_KIOSK_APP;
984 else 974 else
985 login_user_type = chromeos::LoginState::LOGGED_IN_USER_REGULAR; 975 login_user_type = chromeos::LoginState::LOGGED_IN_USER_REGULAR;
986 976
987 if (primary_user_) { 977 if (primary_user_) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 } 1044 }
1055 1045
1056 void UserManagerBase::DeleteUser(User* user) { 1046 void UserManagerBase::DeleteUser(User* user) {
1057 const bool is_active_user = (user == active_user_); 1047 const bool is_active_user = (user == active_user_);
1058 delete user; 1048 delete user;
1059 if (is_active_user) 1049 if (is_active_user)
1060 active_user_ = NULL; 1050 active_user_ = NULL;
1061 } 1051 }
1062 1052
1063 } // namespace user_manager 1053 } // namespace user_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698