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

Side by Side Diff: chrome/browser/chromeos/login/users/user_manager_impl.cc

Issue 393343002: Rename "managed (mode|user)" to "supervised user" (part 7) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more alphabetize (and rebase again) Created 6 years, 5 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 | Annotate | Revision Log
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 "chrome/browser/chromeos/login/users/user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/users/user_manager_impl.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 9
10 #include "ash/multi_profile_uma.h" 10 #include "ash/multi_profile_uma.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 policy::DeviceLocalAccount::TYPE_KIOSK_APP) { 402 policy::DeviceLocalAccount::TYPE_KIOSK_APP) {
403 KioskAppLoggedIn(user_id); 403 KioskAppLoggedIn(user_id);
404 } else if (DemoAppLauncher::IsDemoAppSession(user_id)) { 404 } else if (DemoAppLauncher::IsDemoAppSession(user_id)) {
405 DemoAccountLoggedIn(); 405 DemoAccountLoggedIn();
406 } else { 406 } else {
407 EnsureUsersLoaded(); 407 EnsureUsersLoaded();
408 408
409 if (user && user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { 409 if (user && user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) {
410 PublicAccountUserLoggedIn(user); 410 PublicAccountUserLoggedIn(user);
411 } else if ((user && 411 } else if ((user &&
412 user->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED) || 412 user->GetType() == user_manager::USER_TYPE_SUPERVISED) ||
413 (!user && 413 (!user &&
414 gaia::ExtractDomainName(user_id) == 414 gaia::ExtractDomainName(user_id) ==
415 chromeos::login::kLocallyManagedUserDomain)) { 415 chromeos::login::kSupervisedUserDomain)) {
416 LocallyManagedUserLoggedIn(user_id); 416 SupervisedUserLoggedIn(user_id);
417 } else if (browser_restart && user_id == g_browser_process->local_state()-> 417 } else if (browser_restart && user_id == g_browser_process->local_state()->
418 GetString(kPublicAccountPendingDataRemoval)) { 418 GetString(kPublicAccountPendingDataRemoval)) {
419 PublicAccountUserLoggedIn(User::CreatePublicAccountUser(user_id)); 419 PublicAccountUserLoggedIn(User::CreatePublicAccountUser(user_id));
420 } else if (user_id != owner_email_ && !user && 420 } else if (user_id != owner_email_ && !user &&
421 (AreEphemeralUsersEnabled() || browser_restart)) { 421 (AreEphemeralUsersEnabled() || browser_restart)) {
422 RegularUserLoggedInAsEphemeral(user_id); 422 RegularUserLoggedInAsEphemeral(user_id);
423 } else { 423 } else {
424 RegularUserLoggedIn(user_id); 424 RegularUserLoggedIn(user_id);
425 } 425 }
426 426
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 g_browser_process->local_state()->CommitPendingWrite(); 508 g_browser_process->local_state()->CommitPendingWrite();
509 } 509 }
510 } 510 }
511 511
512 void UserManagerImpl::RemoveUser(const std::string& user_id, 512 void UserManagerImpl::RemoveUser(const std::string& user_id,
513 RemoveUserDelegate* delegate) { 513 RemoveUserDelegate* delegate) {
514 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 514 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
515 515
516 const User* user = FindUser(user_id); 516 const User* user = FindUser(user_id);
517 if (!user || (user->GetType() != user_manager::USER_TYPE_REGULAR && 517 if (!user || (user->GetType() != user_manager::USER_TYPE_REGULAR &&
518 user->GetType() != user_manager::USER_TYPE_LOCALLY_MANAGED)) 518 user->GetType() != user_manager::USER_TYPE_SUPERVISED))
519 return; 519 return;
520 520
521 // Sanity check: we must not remove single user unless it's an enterprise 521 // Sanity check: we must not remove single user unless it's an enterprise
522 // device. This check may seem redundant at a first sight because 522 // device. This check may seem redundant at a first sight because
523 // this single user must be an owner and we perform special check later 523 // this single user must be an owner and we perform special check later
524 // in order not to remove an owner. However due to non-instant nature of 524 // in order not to remove an owner. However due to non-instant nature of
525 // ownership assignment this later check may sometimes fail. 525 // ownership assignment this later check may sometimes fail.
526 // See http://crosbug.com/12723 526 // See http://crosbug.com/12723
527 policy::BrowserPolicyConnectorChromeOS* connector = 527 policy::BrowserPolicyConnectorChromeOS* connector =
528 g_browser_process->platform_part() 528 g_browser_process->platform_part()
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 user_email, base::Bind(&OnRemoveUserComplete, user_email)); 571 user_email, base::Bind(&OnRemoveUserComplete, user_email));
572 572
573 if (delegate) 573 if (delegate)
574 delegate->OnUserRemoved(user_email); 574 delegate->OnUserRemoved(user_email);
575 } 575 }
576 576
577 void UserManagerImpl::RemoveUserFromList(const std::string& user_id) { 577 void UserManagerImpl::RemoveUserFromList(const std::string& user_id) {
578 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 578 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
579 RemoveNonCryptohomeData(user_id); 579 RemoveNonCryptohomeData(user_id);
580 if (user_loading_stage_ == STAGE_LOADED) { 580 if (user_loading_stage_ == STAGE_LOADED) {
581 DeleteUser(RemoveRegularOrLocallyManagedUserFromList(user_id)); 581 DeleteUser(RemoveRegularOrSupervisedUserFromList(user_id));
582 } else if (user_loading_stage_ == STAGE_LOADING) { 582 } else if (user_loading_stage_ == STAGE_LOADING) {
583 DCHECK(gaia::ExtractDomainName(user_id) == 583 DCHECK(gaia::ExtractDomainName(user_id) ==
584 chromeos::login::kLocallyManagedUserDomain); 584 chromeos::login::kSupervisedUserDomain);
585 // Special case, removing partially-constructed supervised user during user 585 // Special case, removing partially-constructed supervised user during user
586 // list loading. 586 // list loading.
587 ListPrefUpdate users_update(g_browser_process->local_state(), 587 ListPrefUpdate users_update(g_browser_process->local_state(),
588 kRegularUsers); 588 kRegularUsers);
589 users_update->Remove(base::StringValue(user_id), NULL); 589 users_update->Remove(base::StringValue(user_id), NULL);
590 } else { 590 } else {
591 NOTREACHED() << "Users are not loaded yet."; 591 NOTREACHED() << "Users are not loaded yet.";
592 return; 592 return;
593 } 593 }
594 // Make sure that new data is persisted to Local State. 594 // Make sure that new data is persisted to Local State.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 device_local_account_policy_service_->AddObserver(this); 777 device_local_account_policy_service_->AddObserver(this);
778 } 778 }
779 RetrieveTrustedDevicePolicies(); 779 RetrieveTrustedDevicePolicies();
780 UpdateOwnership(); 780 UpdateOwnership();
781 break; 781 break;
782 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: { 782 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: {
783 Profile* profile = content::Details<Profile>(details).ptr(); 783 Profile* profile = content::Details<Profile>(details).ptr();
784 if (IsUserLoggedIn() && 784 if (IsUserLoggedIn() &&
785 !IsLoggedInAsGuest() && 785 !IsLoggedInAsGuest() &&
786 !IsLoggedInAsKioskApp()) { 786 !IsLoggedInAsKioskApp()) {
787 if (IsLoggedInAsLocallyManagedUser()) 787 if (IsLoggedInAsSupervisedUser())
788 SupervisedUserPasswordServiceFactory::GetForProfile(profile); 788 SupervisedUserPasswordServiceFactory::GetForProfile(profile);
789 if (IsLoggedInAsRegularUser()) 789 if (IsLoggedInAsRegularUser())
790 ManagerPasswordServiceFactory::GetForProfile(profile); 790 ManagerPasswordServiceFactory::GetForProfile(profile);
791 791
792 if (!profile->IsOffTheRecord()) { 792 if (!profile->IsOffTheRecord()) {
793 AuthSyncObserver* sync_observer = 793 AuthSyncObserver* sync_observer =
794 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile); 794 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile);
795 sync_observer->StartObserving(); 795 sync_observer->StartObserving();
796 multi_profile_user_controller_->StartObserving(profile); 796 multi_profile_user_controller_->StartObserving(profile);
797 } 797 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 return IsUserLoggedIn() && 920 return IsUserLoggedIn() &&
921 active_user_->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; 921 active_user_->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT;
922 } 922 }
923 923
924 bool UserManagerImpl::IsLoggedInAsGuest() const { 924 bool UserManagerImpl::IsLoggedInAsGuest() const {
925 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 925 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
926 return IsUserLoggedIn() && 926 return IsUserLoggedIn() &&
927 active_user_->GetType() == user_manager::USER_TYPE_GUEST; 927 active_user_->GetType() == user_manager::USER_TYPE_GUEST;
928 } 928 }
929 929
930 bool UserManagerImpl::IsLoggedInAsLocallyManagedUser() const { 930 bool UserManagerImpl::IsLoggedInAsSupervisedUser() const {
931 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 931 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
932 return IsUserLoggedIn() && 932 return IsUserLoggedIn() &&
933 active_user_->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED; 933 active_user_->GetType() == user_manager::USER_TYPE_SUPERVISED;
934 } 934 }
935 935
936 bool UserManagerImpl::IsLoggedInAsKioskApp() const { 936 bool UserManagerImpl::IsLoggedInAsKioskApp() const {
937 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 937 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
938 return IsUserLoggedIn() && 938 return IsUserLoggedIn() &&
939 active_user_->GetType() == user_manager::USER_TYPE_KIOSK_APP; 939 active_user_->GetType() == user_manager::USER_TYPE_KIOSK_APP;
940 } 940 }
941 941
942 bool UserManagerImpl::IsLoggedInAsStub() const { 942 bool UserManagerImpl::IsLoggedInAsStub() const {
943 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 943 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 std::vector<std::string> public_sessions; 1043 std::vector<std::string> public_sessions;
1044 std::set<std::string> public_sessions_set; 1044 std::set<std::string> public_sessions_set;
1045 ParseUserList(*prefs_public_sessions, std::set<std::string>(), 1045 ParseUserList(*prefs_public_sessions, std::set<std::string>(),
1046 &public_sessions, &public_sessions_set); 1046 &public_sessions, &public_sessions_set);
1047 for (std::vector<std::string>::const_iterator it = public_sessions.begin(); 1047 for (std::vector<std::string>::const_iterator it = public_sessions.begin();
1048 it != public_sessions.end(); ++it) { 1048 it != public_sessions.end(); ++it) {
1049 users_.push_back(User::CreatePublicAccountUser(*it)); 1049 users_.push_back(User::CreatePublicAccountUser(*it));
1050 UpdatePublicAccountDisplayName(*it); 1050 UpdatePublicAccountDisplayName(*it);
1051 } 1051 }
1052 1052
1053 // Load regular users and locally managed users. 1053 // Load regular users and supervised users.
1054 std::vector<std::string> regular_users; 1054 std::vector<std::string> regular_users;
1055 std::set<std::string> regular_users_set; 1055 std::set<std::string> regular_users_set;
1056 ParseUserList(*prefs_regular_users, public_sessions_set, 1056 ParseUserList(*prefs_regular_users, public_sessions_set,
1057 &regular_users, &regular_users_set); 1057 &regular_users, &regular_users_set);
1058 for (std::vector<std::string>::const_iterator it = regular_users.begin(); 1058 for (std::vector<std::string>::const_iterator it = regular_users.begin();
1059 it != regular_users.end(); ++it) { 1059 it != regular_users.end(); ++it) {
1060 User* user = NULL; 1060 User* user = NULL;
1061 const std::string domain = gaia::ExtractDomainName(*it); 1061 const std::string domain = gaia::ExtractDomainName(*it);
1062 if (domain == chromeos::login::kLocallyManagedUserDomain) 1062 if (domain == chromeos::login::kSupervisedUserDomain)
1063 user = User::CreateLocallyManagedUser(*it); 1063 user = User::CreateSupervisedUser(*it);
1064 else 1064 else
1065 user = User::CreateRegularUser(*it); 1065 user = User::CreateRegularUser(*it);
1066 user->set_oauth_token_status(LoadUserOAuthStatus(*it)); 1066 user->set_oauth_token_status(LoadUserOAuthStatus(*it));
1067 user->set_force_online_signin(LoadForceOnlineSignin(*it)); 1067 user->set_force_online_signin(LoadForceOnlineSignin(*it));
1068 users_.push_back(user); 1068 users_.push_back(user);
1069 1069
1070 base::string16 display_name; 1070 base::string16 display_name;
1071 if (prefs_display_names->GetStringWithoutPathExpansion(*it, 1071 if (prefs_display_names->GetStringWithoutPathExpansion(*it,
1072 &display_name)) { 1072 &display_name)) {
1073 user->set_display_name(display_name); 1073 user->set_display_name(display_name);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 void UserManagerImpl::AddUserRecord(User* user) { 1194 void UserManagerImpl::AddUserRecord(User* user) {
1195 // Add the user to the front of the user list. 1195 // Add the user to the front of the user list.
1196 ListPrefUpdate prefs_users_update(g_browser_process->local_state(), 1196 ListPrefUpdate prefs_users_update(g_browser_process->local_state(),
1197 kRegularUsers); 1197 kRegularUsers);
1198 prefs_users_update->Insert(0, new base::StringValue(user->email())); 1198 prefs_users_update->Insert(0, new base::StringValue(user->email()));
1199 users_.insert(users_.begin(), user); 1199 users_.insert(users_.begin(), user);
1200 } 1200 }
1201 1201
1202 void UserManagerImpl::RegularUserLoggedIn(const std::string& user_id) { 1202 void UserManagerImpl::RegularUserLoggedIn(const std::string& user_id) {
1203 // Remove the user from the user list. 1203 // Remove the user from the user list.
1204 active_user_ = RemoveRegularOrLocallyManagedUserFromList(user_id); 1204 active_user_ = RemoveRegularOrSupervisedUserFromList(user_id);
1205 1205
1206 // If the user was not found on the user list, create a new user. 1206 // If the user was not found on the user list, create a new user.
1207 is_current_user_new_ = !active_user_; 1207 is_current_user_new_ = !active_user_;
1208 if (!active_user_) { 1208 if (!active_user_) {
1209 active_user_ = User::CreateRegularUser(user_id); 1209 active_user_ = User::CreateRegularUser(user_id);
1210 active_user_->set_oauth_token_status(LoadUserOAuthStatus(user_id)); 1210 active_user_->set_oauth_token_status(LoadUserOAuthStatus(user_id));
1211 SaveUserDisplayName(active_user_->email(), 1211 SaveUserDisplayName(active_user_->email(),
1212 base::UTF8ToUTF16(active_user_->GetAccountName(true))); 1212 base::UTF8ToUTF16(active_user_->GetAccountName(true)));
1213 WallpaperManager::Get()->SetUserWallpaperNow(user_id); 1213 WallpaperManager::Get()->SetUserWallpaperNow(user_id);
1214 } 1214 }
(...skipping 11 matching lines...) Expand all
1226 void UserManagerImpl::RegularUserLoggedInAsEphemeral( 1226 void UserManagerImpl::RegularUserLoggedInAsEphemeral(
1227 const std::string& user_id) { 1227 const std::string& user_id) {
1228 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1228 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1229 is_current_user_new_ = true; 1229 is_current_user_new_ = true;
1230 is_current_user_ephemeral_regular_user_ = true; 1230 is_current_user_ephemeral_regular_user_ = true;
1231 active_user_ = User::CreateRegularUser(user_id); 1231 active_user_ = User::CreateRegularUser(user_id);
1232 GetUserImageManager(user_id)->UserLoggedIn(is_current_user_new_, false); 1232 GetUserImageManager(user_id)->UserLoggedIn(is_current_user_new_, false);
1233 WallpaperManager::Get()->SetUserWallpaperNow(user_id); 1233 WallpaperManager::Get()->SetUserWallpaperNow(user_id);
1234 } 1234 }
1235 1235
1236 void UserManagerImpl::LocallyManagedUserLoggedIn( 1236 void UserManagerImpl::SupervisedUserLoggedIn(
1237 const std::string& user_id) { 1237 const std::string& user_id) {
1238 // TODO(nkostylev): Refactor, share code with RegularUserLoggedIn(). 1238 // TODO(nkostylev): Refactor, share code with RegularUserLoggedIn().
1239 1239
1240 // Remove the user from the user list. 1240 // Remove the user from the user list.
1241 active_user_ = RemoveRegularOrLocallyManagedUserFromList(user_id); 1241 active_user_ = RemoveRegularOrSupervisedUserFromList(user_id);
1242 // If the user was not found on the user list, create a new user. 1242 // If the user was not found on the user list, create a new user.
1243 if (!active_user_) { 1243 if (!active_user_) {
1244 is_current_user_new_ = true; 1244 is_current_user_new_ = true;
1245 active_user_ = User::CreateLocallyManagedUser(user_id); 1245 active_user_ = User::CreateSupervisedUser(user_id);
1246 // Leaving OAuth token status at the default state = unknown. 1246 // Leaving OAuth token status at the default state = unknown.
1247 WallpaperManager::Get()->SetUserWallpaperNow(user_id); 1247 WallpaperManager::Get()->SetUserWallpaperNow(user_id);
1248 } else { 1248 } else {
1249 if (supervised_user_manager_->CheckForFirstRun(user_id)) { 1249 if (supervised_user_manager_->CheckForFirstRun(user_id)) {
1250 is_current_user_new_ = true; 1250 is_current_user_new_ = true;
1251 WallpaperManager::Get()->SetUserWallpaperNow(user_id); 1251 WallpaperManager::Get()->SetUserWallpaperNow(user_id);
1252 } else { 1252 } else {
1253 is_current_user_new_ = false; 1253 is_current_user_new_ = false;
1254 } 1254 }
1255 } 1255 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 prefs_oauth_update->RemoveWithoutPathExpansion(user_id, NULL); 1434 prefs_oauth_update->RemoveWithoutPathExpansion(user_id, NULL);
1435 1435
1436 DictionaryPrefUpdate prefs_force_online_update(prefs, kUserForceOnlineSignin); 1436 DictionaryPrefUpdate prefs_force_online_update(prefs, kUserForceOnlineSignin);
1437 prefs_force_online_update->RemoveWithoutPathExpansion(user_id, NULL); 1437 prefs_force_online_update->RemoveWithoutPathExpansion(user_id, NULL);
1438 1438
1439 supervised_user_manager_->RemoveNonCryptohomeData(user_id); 1439 supervised_user_manager_->RemoveNonCryptohomeData(user_id);
1440 1440
1441 multi_profile_user_controller_->RemoveCachedValues(user_id); 1441 multi_profile_user_controller_->RemoveCachedValues(user_id);
1442 } 1442 }
1443 1443
1444 User* UserManagerImpl::RemoveRegularOrLocallyManagedUserFromList( 1444 User* UserManagerImpl::RemoveRegularOrSupervisedUserFromList(
1445 const std::string& user_id) { 1445 const std::string& user_id) {
1446 ListPrefUpdate prefs_users_update(g_browser_process->local_state(), 1446 ListPrefUpdate prefs_users_update(g_browser_process->local_state(),
1447 kRegularUsers); 1447 kRegularUsers);
1448 prefs_users_update->Clear(); 1448 prefs_users_update->Clear();
1449 User* user = NULL; 1449 User* user = NULL;
1450 for (UserList::iterator it = users_.begin(); it != users_.end(); ) { 1450 for (UserList::iterator it = users_.begin(); it != users_.end(); ) {
1451 const std::string user_email = (*it)->email(); 1451 const std::string user_email = (*it)->email();
1452 if (user_email == user_id) { 1452 if (user_email == user_id) {
1453 user = *it; 1453 user = *it;
1454 it = users_.erase(it); 1454 it = users_.erase(it);
1455 } else { 1455 } else {
1456 if ((*it)->GetType() == user_manager::USER_TYPE_REGULAR || 1456 if ((*it)->GetType() == user_manager::USER_TYPE_REGULAR ||
1457 (*it)->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED) { 1457 (*it)->GetType() == user_manager::USER_TYPE_SUPERVISED) {
1458 prefs_users_update->Append(new base::StringValue(user_email)); 1458 prefs_users_update->Append(new base::StringValue(user_email));
1459 } 1459 }
1460 ++it; 1460 ++it;
1461 } 1461 }
1462 } 1462 }
1463 return user; 1463 return user;
1464 } 1464 }
1465 1465
1466 void UserManagerImpl::CleanUpPublicAccountNonCryptohomeDataPendingRemoval() { 1466 void UserManagerImpl::CleanUpPublicAccountNonCryptohomeDataPendingRemoval() {
1467 PrefService* local_state = g_browser_process->local_state(); 1467 PrefService* local_state = g_browser_process->local_state();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 1623
1624 void UserManagerImpl::ResetUserFlow(const std::string& user_id) { 1624 void UserManagerImpl::ResetUserFlow(const std::string& user_id) {
1625 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1625 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1626 FlowMap::iterator it = specific_flows_.find(user_id); 1626 FlowMap::iterator it = specific_flows_.find(user_id);
1627 if (it != specific_flows_.end()) { 1627 if (it != specific_flows_.end()) {
1628 delete it->second; 1628 delete it->second;
1629 specific_flows_.erase(it); 1629 specific_flows_.erase(it);
1630 } 1630 }
1631 } 1631 }
1632 1632
1633 bool UserManagerImpl::AreLocallyManagedUsersAllowed() const { 1633 bool UserManagerImpl::AreSupervisedUsersAllowed() const {
1634 bool locally_managed_users_allowed = false; 1634 bool supervised_users_allowed = false;
1635 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled, 1635 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled,
1636 &locally_managed_users_allowed); 1636 &supervised_users_allowed);
1637 return locally_managed_users_allowed; 1637 return supervised_users_allowed;
1638 } 1638 }
1639 1639
1640 UserFlow* UserManagerImpl::GetDefaultUserFlow() const { 1640 UserFlow* UserManagerImpl::GetDefaultUserFlow() const {
1641 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1641 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1642 if (!default_flow_.get()) 1642 if (!default_flow_.get())
1643 default_flow_.reset(new DefaultUserFlow()); 1643 default_flow_.reset(new DefaultUserFlow());
1644 return default_flow_.get(); 1644 return default_flow_.get();
1645 } 1645 }
1646 1646
1647 void UserManagerImpl::NotifyUserListChanged() { 1647 void UserManagerImpl::NotifyUserListChanged() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 if (logged_in_state == LoginState::LOGGED_IN_NONE) 1684 if (logged_in_state == LoginState::LOGGED_IN_NONE)
1685 login_user_type = LoginState::LOGGED_IN_USER_NONE; 1685 login_user_type = LoginState::LOGGED_IN_USER_NONE;
1686 else if (is_current_user_owner_) 1686 else if (is_current_user_owner_)
1687 login_user_type = LoginState::LOGGED_IN_USER_OWNER; 1687 login_user_type = LoginState::LOGGED_IN_USER_OWNER;
1688 else if (active_user_->GetType() == user_manager::USER_TYPE_GUEST) 1688 else if (active_user_->GetType() == user_manager::USER_TYPE_GUEST)
1689 login_user_type = LoginState::LOGGED_IN_USER_GUEST; 1689 login_user_type = LoginState::LOGGED_IN_USER_GUEST;
1690 else if (active_user_->GetType() == user_manager::USER_TYPE_RETAIL_MODE) 1690 else if (active_user_->GetType() == user_manager::USER_TYPE_RETAIL_MODE)
1691 login_user_type = LoginState::LOGGED_IN_USER_RETAIL_MODE; 1691 login_user_type = LoginState::LOGGED_IN_USER_RETAIL_MODE;
1692 else if (active_user_->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) 1692 else if (active_user_->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT)
1693 login_user_type = LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT; 1693 login_user_type = LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT;
1694 else if (active_user_->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED) 1694 else if (active_user_->GetType() == user_manager::USER_TYPE_SUPERVISED)
1695 login_user_type = LoginState::LOGGED_IN_USER_LOCALLY_MANAGED; 1695 login_user_type = LoginState::LOGGED_IN_USER_SUPERVISED;
1696 else if (active_user_->GetType() == user_manager::USER_TYPE_KIOSK_APP) 1696 else if (active_user_->GetType() == user_manager::USER_TYPE_KIOSK_APP)
1697 login_user_type = LoginState::LOGGED_IN_USER_KIOSK_APP; 1697 login_user_type = LoginState::LOGGED_IN_USER_KIOSK_APP;
1698 else 1698 else
1699 login_user_type = LoginState::LOGGED_IN_USER_REGULAR; 1699 login_user_type = LoginState::LOGGED_IN_USER_REGULAR;
1700 1700
1701 if (primary_user_) { 1701 if (primary_user_) {
1702 LoginState::Get()->SetLoggedInStateAndPrimaryUser( 1702 LoginState::Get()->SetLoggedInStateAndPrimaryUser(
1703 logged_in_state, login_user_type, primary_user_->username_hash()); 1703 logged_in_state, login_user_type, primary_user_->username_hash());
1704 } else { 1704 } else {
1705 LoginState::Get()->SetLoggedInState(logged_in_state, login_user_type); 1705 LoginState::Get()->SetLoggedInState(logged_in_state, login_user_type);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 } 1773 }
1774 1774
1775 void UserManagerImpl::DeleteUser(User* user) { 1775 void UserManagerImpl::DeleteUser(User* user) {
1776 const bool is_active_user = (user == active_user_); 1776 const bool is_active_user = (user == active_user_);
1777 delete user; 1777 delete user;
1778 if (is_active_user) 1778 if (is_active_user)
1779 active_user_ = NULL; 1779 active_user_ = NULL;
1780 } 1780 }
1781 1781
1782 } // namespace chromeos 1782 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/users/user_manager_impl.h ('k') | chrome/browser/chromeos/login/users/user_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698