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 "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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 policy::DeviceLocalAccount::TYPE_KIOSK_APP) { | 401 policy::DeviceLocalAccount::TYPE_KIOSK_APP) { |
402 KioskAppLoggedIn(user_id); | 402 KioskAppLoggedIn(user_id); |
403 } else if (DemoAppLauncher::IsDemoAppSession(user_id)) { | 403 } else if (DemoAppLauncher::IsDemoAppSession(user_id)) { |
404 DemoAccountLoggedIn(); | 404 DemoAccountLoggedIn(); |
405 } else { | 405 } else { |
406 EnsureUsersLoaded(); | 406 EnsureUsersLoaded(); |
407 | 407 |
408 if (user && user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { | 408 if (user && user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { |
409 PublicAccountUserLoggedIn(user); | 409 PublicAccountUserLoggedIn(user); |
410 } else if ((user && | 410 } else if ((user && |
411 user->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED) || | 411 user->GetType() == user_manager::USER_TYPE_SUPERVISED) || |
412 (!user && | 412 (!user && |
413 gaia::ExtractDomainName(user_id) == | 413 gaia::ExtractDomainName(user_id) == |
414 chromeos::login::kLocallyManagedUserDomain)) { | 414 chromeos::login::kSupervisedUserDomain)) { |
415 LocallyManagedUserLoggedIn(user_id); | 415 SupervisedUserLoggedIn(user_id); |
416 } else if (browser_restart && user_id == g_browser_process->local_state()-> | 416 } else if (browser_restart && user_id == g_browser_process->local_state()-> |
417 GetString(kPublicAccountPendingDataRemoval)) { | 417 GetString(kPublicAccountPendingDataRemoval)) { |
418 PublicAccountUserLoggedIn(User::CreatePublicAccountUser(user_id)); | 418 PublicAccountUserLoggedIn(User::CreatePublicAccountUser(user_id)); |
419 } else if (user_id != owner_email_ && !user && | 419 } else if (user_id != owner_email_ && !user && |
420 (AreEphemeralUsersEnabled() || browser_restart)) { | 420 (AreEphemeralUsersEnabled() || browser_restart)) { |
421 RegularUserLoggedInAsEphemeral(user_id); | 421 RegularUserLoggedInAsEphemeral(user_id); |
422 } else { | 422 } else { |
423 RegularUserLoggedIn(user_id); | 423 RegularUserLoggedIn(user_id); |
424 } | 424 } |
425 | 425 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 g_browser_process->local_state()->CommitPendingWrite(); | 503 g_browser_process->local_state()->CommitPendingWrite(); |
504 } | 504 } |
505 } | 505 } |
506 | 506 |
507 void UserManagerImpl::RemoveUser(const std::string& user_id, | 507 void UserManagerImpl::RemoveUser(const std::string& user_id, |
508 RemoveUserDelegate* delegate) { | 508 RemoveUserDelegate* delegate) { |
509 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 509 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
510 | 510 |
511 const User* user = FindUser(user_id); | 511 const User* user = FindUser(user_id); |
512 if (!user || (user->GetType() != user_manager::USER_TYPE_REGULAR && | 512 if (!user || (user->GetType() != user_manager::USER_TYPE_REGULAR && |
513 user->GetType() != user_manager::USER_TYPE_LOCALLY_MANAGED)) | 513 user->GetType() != user_manager::USER_TYPE_SUPERVISED)) |
514 return; | 514 return; |
515 | 515 |
516 // Sanity check: we must not remove single user unless it's an enterprise | 516 // Sanity check: we must not remove single user unless it's an enterprise |
517 // device. This check may seem redundant at a first sight because | 517 // device. This check may seem redundant at a first sight because |
518 // this single user must be an owner and we perform special check later | 518 // this single user must be an owner and we perform special check later |
519 // in order not to remove an owner. However due to non-instant nature of | 519 // in order not to remove an owner. However due to non-instant nature of |
520 // ownership assignment this later check may sometimes fail. | 520 // ownership assignment this later check may sometimes fail. |
521 // See http://crosbug.com/12723 | 521 // See http://crosbug.com/12723 |
522 policy::BrowserPolicyConnectorChromeOS* connector = | 522 policy::BrowserPolicyConnectorChromeOS* connector = |
523 g_browser_process->platform_part() | 523 g_browser_process->platform_part() |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 user_email, base::Bind(&OnRemoveUserComplete, user_email)); | 566 user_email, base::Bind(&OnRemoveUserComplete, user_email)); |
567 | 567 |
568 if (delegate) | 568 if (delegate) |
569 delegate->OnUserRemoved(user_email); | 569 delegate->OnUserRemoved(user_email); |
570 } | 570 } |
571 | 571 |
572 void UserManagerImpl::RemoveUserFromList(const std::string& user_id) { | 572 void UserManagerImpl::RemoveUserFromList(const std::string& user_id) { |
573 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 573 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
574 RemoveNonCryptohomeData(user_id); | 574 RemoveNonCryptohomeData(user_id); |
575 if (user_loading_stage_ == STAGE_LOADED) { | 575 if (user_loading_stage_ == STAGE_LOADED) { |
576 DeleteUser(RemoveRegularOrLocallyManagedUserFromList(user_id)); | 576 DeleteUser(RemoveRegularOrSupervisedUserFromList(user_id)); |
577 } else if (user_loading_stage_ == STAGE_LOADING) { | 577 } else if (user_loading_stage_ == STAGE_LOADING) { |
578 DCHECK(gaia::ExtractDomainName(user_id) == | 578 DCHECK(gaia::ExtractDomainName(user_id) == |
579 chromeos::login::kLocallyManagedUserDomain); | 579 chromeos::login::kSupervisedUserDomain); |
580 // Special case, removing partially-constructed supervised user during user | 580 // Special case, removing partially-constructed supervised user during user |
581 // list loading. | 581 // list loading. |
582 ListPrefUpdate users_update(g_browser_process->local_state(), | 582 ListPrefUpdate users_update(g_browser_process->local_state(), |
583 kRegularUsers); | 583 kRegularUsers); |
584 users_update->Remove(base::StringValue(user_id), NULL); | 584 users_update->Remove(base::StringValue(user_id), NULL); |
585 } else { | 585 } else { |
586 NOTREACHED() << "Users are not loaded yet."; | 586 NOTREACHED() << "Users are not loaded yet."; |
587 return; | 587 return; |
588 } | 588 } |
589 // Make sure that new data is persisted to Local State. | 589 // Make sure that new data is persisted to Local State. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 device_local_account_policy_service_->AddObserver(this); | 772 device_local_account_policy_service_->AddObserver(this); |
773 } | 773 } |
774 RetrieveTrustedDevicePolicies(); | 774 RetrieveTrustedDevicePolicies(); |
775 UpdateOwnership(); | 775 UpdateOwnership(); |
776 break; | 776 break; |
777 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: { | 777 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: { |
778 Profile* profile = content::Details<Profile>(details).ptr(); | 778 Profile* profile = content::Details<Profile>(details).ptr(); |
779 if (IsUserLoggedIn() && | 779 if (IsUserLoggedIn() && |
780 !IsLoggedInAsGuest() && | 780 !IsLoggedInAsGuest() && |
781 !IsLoggedInAsKioskApp()) { | 781 !IsLoggedInAsKioskApp()) { |
782 if (IsLoggedInAsLocallyManagedUser()) | 782 if (IsLoggedInAsSupervisedUser()) |
783 SupervisedUserPasswordServiceFactory::GetForProfile(profile); | 783 SupervisedUserPasswordServiceFactory::GetForProfile(profile); |
784 if (IsLoggedInAsRegularUser()) | 784 if (IsLoggedInAsRegularUser()) |
785 ManagerPasswordServiceFactory::GetForProfile(profile); | 785 ManagerPasswordServiceFactory::GetForProfile(profile); |
786 | 786 |
787 if (!profile->IsOffTheRecord()) { | 787 if (!profile->IsOffTheRecord()) { |
788 AuthSyncObserver* sync_observer = | 788 AuthSyncObserver* sync_observer = |
789 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile); | 789 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile); |
790 sync_observer->StartObserving(); | 790 sync_observer->StartObserving(); |
791 multi_profile_user_controller_->StartObserving(profile); | 791 multi_profile_user_controller_->StartObserving(profile); |
792 } | 792 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 return IsUserLoggedIn() && | 915 return IsUserLoggedIn() && |
916 active_user_->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; | 916 active_user_->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; |
917 } | 917 } |
918 | 918 |
919 bool UserManagerImpl::IsLoggedInAsGuest() const { | 919 bool UserManagerImpl::IsLoggedInAsGuest() const { |
920 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 920 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
921 return IsUserLoggedIn() && | 921 return IsUserLoggedIn() && |
922 active_user_->GetType() == user_manager::USER_TYPE_GUEST; | 922 active_user_->GetType() == user_manager::USER_TYPE_GUEST; |
923 } | 923 } |
924 | 924 |
925 bool UserManagerImpl::IsLoggedInAsLocallyManagedUser() const { | 925 bool UserManagerImpl::IsLoggedInAsSupervisedUser() const { |
926 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 926 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
927 return IsUserLoggedIn() && | 927 return IsUserLoggedIn() && |
928 active_user_->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED; | 928 active_user_->GetType() == user_manager::USER_TYPE_SUPERVISED; |
929 } | 929 } |
930 | 930 |
931 bool UserManagerImpl::IsLoggedInAsKioskApp() const { | 931 bool UserManagerImpl::IsLoggedInAsKioskApp() const { |
932 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 932 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
933 return IsUserLoggedIn() && | 933 return IsUserLoggedIn() && |
934 active_user_->GetType() == user_manager::USER_TYPE_KIOSK_APP; | 934 active_user_->GetType() == user_manager::USER_TYPE_KIOSK_APP; |
935 } | 935 } |
936 | 936 |
937 bool UserManagerImpl::IsLoggedInAsStub() const { | 937 bool UserManagerImpl::IsLoggedInAsStub() const { |
938 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 938 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 std::vector<std::string> public_sessions; | 1038 std::vector<std::string> public_sessions; |
1039 std::set<std::string> public_sessions_set; | 1039 std::set<std::string> public_sessions_set; |
1040 ParseUserList(*prefs_public_sessions, std::set<std::string>(), | 1040 ParseUserList(*prefs_public_sessions, std::set<std::string>(), |
1041 &public_sessions, &public_sessions_set); | 1041 &public_sessions, &public_sessions_set); |
1042 for (std::vector<std::string>::const_iterator it = public_sessions.begin(); | 1042 for (std::vector<std::string>::const_iterator it = public_sessions.begin(); |
1043 it != public_sessions.end(); ++it) { | 1043 it != public_sessions.end(); ++it) { |
1044 users_.push_back(User::CreatePublicAccountUser(*it)); | 1044 users_.push_back(User::CreatePublicAccountUser(*it)); |
1045 UpdatePublicAccountDisplayName(*it); | 1045 UpdatePublicAccountDisplayName(*it); |
1046 } | 1046 } |
1047 | 1047 |
1048 // Load regular users and locally managed users. | 1048 // Load regular users and supervised users. |
1049 std::vector<std::string> regular_users; | 1049 std::vector<std::string> regular_users; |
1050 std::set<std::string> regular_users_set; | 1050 std::set<std::string> regular_users_set; |
1051 ParseUserList(*prefs_regular_users, public_sessions_set, | 1051 ParseUserList(*prefs_regular_users, public_sessions_set, |
1052 ®ular_users, ®ular_users_set); | 1052 ®ular_users, ®ular_users_set); |
1053 for (std::vector<std::string>::const_iterator it = regular_users.begin(); | 1053 for (std::vector<std::string>::const_iterator it = regular_users.begin(); |
1054 it != regular_users.end(); ++it) { | 1054 it != regular_users.end(); ++it) { |
1055 User* user = NULL; | 1055 User* user = NULL; |
1056 const std::string domain = gaia::ExtractDomainName(*it); | 1056 const std::string domain = gaia::ExtractDomainName(*it); |
1057 if (domain == chromeos::login::kLocallyManagedUserDomain) | 1057 if (domain == chromeos::login::kSupervisedUserDomain) |
1058 user = User::CreateLocallyManagedUser(*it); | 1058 user = User::CreateSupervisedUser(*it); |
1059 else | 1059 else |
1060 user = User::CreateRegularUser(*it); | 1060 user = User::CreateRegularUser(*it); |
1061 user->set_oauth_token_status(LoadUserOAuthStatus(*it)); | 1061 user->set_oauth_token_status(LoadUserOAuthStatus(*it)); |
1062 user->set_force_online_signin(LoadForceOnlineSignin(*it)); | 1062 user->set_force_online_signin(LoadForceOnlineSignin(*it)); |
1063 users_.push_back(user); | 1063 users_.push_back(user); |
1064 | 1064 |
1065 base::string16 display_name; | 1065 base::string16 display_name; |
1066 if (prefs_display_names->GetStringWithoutPathExpansion(*it, | 1066 if (prefs_display_names->GetStringWithoutPathExpansion(*it, |
1067 &display_name)) { | 1067 &display_name)) { |
1068 user->set_display_name(display_name); | 1068 user->set_display_name(display_name); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 void UserManagerImpl::AddUserRecord(User* user) { | 1189 void UserManagerImpl::AddUserRecord(User* user) { |
1190 // Add the user to the front of the user list. | 1190 // Add the user to the front of the user list. |
1191 ListPrefUpdate prefs_users_update(g_browser_process->local_state(), | 1191 ListPrefUpdate prefs_users_update(g_browser_process->local_state(), |
1192 kRegularUsers); | 1192 kRegularUsers); |
1193 prefs_users_update->Insert(0, new base::StringValue(user->email())); | 1193 prefs_users_update->Insert(0, new base::StringValue(user->email())); |
1194 users_.insert(users_.begin(), user); | 1194 users_.insert(users_.begin(), user); |
1195 } | 1195 } |
1196 | 1196 |
1197 void UserManagerImpl::RegularUserLoggedIn(const std::string& user_id) { | 1197 void UserManagerImpl::RegularUserLoggedIn(const std::string& user_id) { |
1198 // Remove the user from the user list. | 1198 // Remove the user from the user list. |
1199 active_user_ = RemoveRegularOrLocallyManagedUserFromList(user_id); | 1199 active_user_ = RemoveRegularOrSupervisedUserFromList(user_id); |
1200 | 1200 |
1201 // If the user was not found on the user list, create a new user. | 1201 // If the user was not found on the user list, create a new user. |
1202 is_current_user_new_ = !active_user_; | 1202 is_current_user_new_ = !active_user_; |
1203 if (!active_user_) { | 1203 if (!active_user_) { |
1204 active_user_ = User::CreateRegularUser(user_id); | 1204 active_user_ = User::CreateRegularUser(user_id); |
1205 active_user_->set_oauth_token_status(LoadUserOAuthStatus(user_id)); | 1205 active_user_->set_oauth_token_status(LoadUserOAuthStatus(user_id)); |
1206 SaveUserDisplayName(active_user_->email(), | 1206 SaveUserDisplayName(active_user_->email(), |
1207 base::UTF8ToUTF16(active_user_->GetAccountName(true))); | 1207 base::UTF8ToUTF16(active_user_->GetAccountName(true))); |
1208 WallpaperManager::Get()->SetUserWallpaperNow(user_id); | 1208 WallpaperManager::Get()->SetUserWallpaperNow(user_id); |
1209 } | 1209 } |
(...skipping 11 matching lines...) Expand all Loading... |
1221 void UserManagerImpl::RegularUserLoggedInAsEphemeral( | 1221 void UserManagerImpl::RegularUserLoggedInAsEphemeral( |
1222 const std::string& user_id) { | 1222 const std::string& user_id) { |
1223 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1223 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1224 is_current_user_new_ = true; | 1224 is_current_user_new_ = true; |
1225 is_current_user_ephemeral_regular_user_ = true; | 1225 is_current_user_ephemeral_regular_user_ = true; |
1226 active_user_ = User::CreateRegularUser(user_id); | 1226 active_user_ = User::CreateRegularUser(user_id); |
1227 GetUserImageManager(user_id)->UserLoggedIn(is_current_user_new_, false); | 1227 GetUserImageManager(user_id)->UserLoggedIn(is_current_user_new_, false); |
1228 WallpaperManager::Get()->SetUserWallpaperNow(user_id); | 1228 WallpaperManager::Get()->SetUserWallpaperNow(user_id); |
1229 } | 1229 } |
1230 | 1230 |
1231 void UserManagerImpl::LocallyManagedUserLoggedIn( | 1231 void UserManagerImpl::SupervisedUserLoggedIn( |
1232 const std::string& user_id) { | 1232 const std::string& user_id) { |
1233 // TODO(nkostylev): Refactor, share code with RegularUserLoggedIn(). | 1233 // TODO(nkostylev): Refactor, share code with RegularUserLoggedIn(). |
1234 | 1234 |
1235 // Remove the user from the user list. | 1235 // Remove the user from the user list. |
1236 active_user_ = RemoveRegularOrLocallyManagedUserFromList(user_id); | 1236 active_user_ = RemoveRegularOrSupervisedUserFromList(user_id); |
1237 // If the user was not found on the user list, create a new user. | 1237 // If the user was not found on the user list, create a new user. |
1238 if (!active_user_) { | 1238 if (!active_user_) { |
1239 is_current_user_new_ = true; | 1239 is_current_user_new_ = true; |
1240 active_user_ = User::CreateLocallyManagedUser(user_id); | 1240 active_user_ = User::CreateSupervisedUser(user_id); |
1241 // Leaving OAuth token status at the default state = unknown. | 1241 // Leaving OAuth token status at the default state = unknown. |
1242 WallpaperManager::Get()->SetUserWallpaperNow(user_id); | 1242 WallpaperManager::Get()->SetUserWallpaperNow(user_id); |
1243 } else { | 1243 } else { |
1244 if (supervised_user_manager_->CheckForFirstRun(user_id)) { | 1244 if (supervised_user_manager_->CheckForFirstRun(user_id)) { |
1245 is_current_user_new_ = true; | 1245 is_current_user_new_ = true; |
1246 WallpaperManager::Get()->SetUserWallpaperNow(user_id); | 1246 WallpaperManager::Get()->SetUserWallpaperNow(user_id); |
1247 } else { | 1247 } else { |
1248 is_current_user_new_ = false; | 1248 is_current_user_new_ = false; |
1249 } | 1249 } |
1250 } | 1250 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 prefs_oauth_update->RemoveWithoutPathExpansion(user_id, NULL); | 1429 prefs_oauth_update->RemoveWithoutPathExpansion(user_id, NULL); |
1430 | 1430 |
1431 DictionaryPrefUpdate prefs_force_online_update(prefs, kUserForceOnlineSignin); | 1431 DictionaryPrefUpdate prefs_force_online_update(prefs, kUserForceOnlineSignin); |
1432 prefs_force_online_update->RemoveWithoutPathExpansion(user_id, NULL); | 1432 prefs_force_online_update->RemoveWithoutPathExpansion(user_id, NULL); |
1433 | 1433 |
1434 supervised_user_manager_->RemoveNonCryptohomeData(user_id); | 1434 supervised_user_manager_->RemoveNonCryptohomeData(user_id); |
1435 | 1435 |
1436 multi_profile_user_controller_->RemoveCachedValues(user_id); | 1436 multi_profile_user_controller_->RemoveCachedValues(user_id); |
1437 } | 1437 } |
1438 | 1438 |
1439 User* UserManagerImpl::RemoveRegularOrLocallyManagedUserFromList( | 1439 User* UserManagerImpl::RemoveRegularOrSupervisedUserFromList( |
1440 const std::string& user_id) { | 1440 const std::string& user_id) { |
1441 ListPrefUpdate prefs_users_update(g_browser_process->local_state(), | 1441 ListPrefUpdate prefs_users_update(g_browser_process->local_state(), |
1442 kRegularUsers); | 1442 kRegularUsers); |
1443 prefs_users_update->Clear(); | 1443 prefs_users_update->Clear(); |
1444 User* user = NULL; | 1444 User* user = NULL; |
1445 for (UserList::iterator it = users_.begin(); it != users_.end(); ) { | 1445 for (UserList::iterator it = users_.begin(); it != users_.end(); ) { |
1446 const std::string user_email = (*it)->email(); | 1446 const std::string user_email = (*it)->email(); |
1447 if (user_email == user_id) { | 1447 if (user_email == user_id) { |
1448 user = *it; | 1448 user = *it; |
1449 it = users_.erase(it); | 1449 it = users_.erase(it); |
1450 } else { | 1450 } else { |
1451 if ((*it)->GetType() == user_manager::USER_TYPE_REGULAR || | 1451 if ((*it)->GetType() == user_manager::USER_TYPE_REGULAR || |
1452 (*it)->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED) { | 1452 (*it)->GetType() == user_manager::USER_TYPE_SUPERVISED) { |
1453 prefs_users_update->Append(new base::StringValue(user_email)); | 1453 prefs_users_update->Append(new base::StringValue(user_email)); |
1454 } | 1454 } |
1455 ++it; | 1455 ++it; |
1456 } | 1456 } |
1457 } | 1457 } |
1458 return user; | 1458 return user; |
1459 } | 1459 } |
1460 | 1460 |
1461 void UserManagerImpl::CleanUpPublicAccountNonCryptohomeDataPendingRemoval() { | 1461 void UserManagerImpl::CleanUpPublicAccountNonCryptohomeDataPendingRemoval() { |
1462 PrefService* local_state = g_browser_process->local_state(); | 1462 PrefService* local_state = g_browser_process->local_state(); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 | 1618 |
1619 void UserManagerImpl::ResetUserFlow(const std::string& user_id) { | 1619 void UserManagerImpl::ResetUserFlow(const std::string& user_id) { |
1620 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1620 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1621 FlowMap::iterator it = specific_flows_.find(user_id); | 1621 FlowMap::iterator it = specific_flows_.find(user_id); |
1622 if (it != specific_flows_.end()) { | 1622 if (it != specific_flows_.end()) { |
1623 delete it->second; | 1623 delete it->second; |
1624 specific_flows_.erase(it); | 1624 specific_flows_.erase(it); |
1625 } | 1625 } |
1626 } | 1626 } |
1627 | 1627 |
1628 bool UserManagerImpl::AreLocallyManagedUsersAllowed() const { | 1628 bool UserManagerImpl::AreSupervisedUsersAllowed() const { |
1629 bool locally_managed_users_allowed = false; | 1629 bool supervised_users_allowed = false; |
1630 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled, | 1630 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled, |
1631 &locally_managed_users_allowed); | 1631 &supervised_users_allowed); |
1632 return locally_managed_users_allowed; | 1632 return supervised_users_allowed; |
1633 } | 1633 } |
1634 | 1634 |
1635 UserFlow* UserManagerImpl::GetDefaultUserFlow() const { | 1635 UserFlow* UserManagerImpl::GetDefaultUserFlow() const { |
1636 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1636 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1637 if (!default_flow_.get()) | 1637 if (!default_flow_.get()) |
1638 default_flow_.reset(new DefaultUserFlow()); | 1638 default_flow_.reset(new DefaultUserFlow()); |
1639 return default_flow_.get(); | 1639 return default_flow_.get(); |
1640 } | 1640 } |
1641 | 1641 |
1642 void UserManagerImpl::NotifyUserListChanged() { | 1642 void UserManagerImpl::NotifyUserListChanged() { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 if (logged_in_state == LoginState::LOGGED_IN_NONE) | 1679 if (logged_in_state == LoginState::LOGGED_IN_NONE) |
1680 login_user_type = LoginState::LOGGED_IN_USER_NONE; | 1680 login_user_type = LoginState::LOGGED_IN_USER_NONE; |
1681 else if (is_current_user_owner_) | 1681 else if (is_current_user_owner_) |
1682 login_user_type = LoginState::LOGGED_IN_USER_OWNER; | 1682 login_user_type = LoginState::LOGGED_IN_USER_OWNER; |
1683 else if (active_user_->GetType() == user_manager::USER_TYPE_GUEST) | 1683 else if (active_user_->GetType() == user_manager::USER_TYPE_GUEST) |
1684 login_user_type = LoginState::LOGGED_IN_USER_GUEST; | 1684 login_user_type = LoginState::LOGGED_IN_USER_GUEST; |
1685 else if (active_user_->GetType() == user_manager::USER_TYPE_RETAIL_MODE) | 1685 else if (active_user_->GetType() == user_manager::USER_TYPE_RETAIL_MODE) |
1686 login_user_type = LoginState::LOGGED_IN_USER_RETAIL_MODE; | 1686 login_user_type = LoginState::LOGGED_IN_USER_RETAIL_MODE; |
1687 else if (active_user_->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 1687 else if (active_user_->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
1688 login_user_type = LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT; | 1688 login_user_type = LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT; |
1689 else if (active_user_->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED) | 1689 else if (active_user_->GetType() == user_manager::USER_TYPE_SUPERVISED) |
1690 login_user_type = LoginState::LOGGED_IN_USER_LOCALLY_MANAGED; | 1690 login_user_type = LoginState::LOGGED_IN_USER_SUPERVISED; |
1691 else if (active_user_->GetType() == user_manager::USER_TYPE_KIOSK_APP) | 1691 else if (active_user_->GetType() == user_manager::USER_TYPE_KIOSK_APP) |
1692 login_user_type = LoginState::LOGGED_IN_USER_KIOSK_APP; | 1692 login_user_type = LoginState::LOGGED_IN_USER_KIOSK_APP; |
1693 else | 1693 else |
1694 login_user_type = LoginState::LOGGED_IN_USER_REGULAR; | 1694 login_user_type = LoginState::LOGGED_IN_USER_REGULAR; |
1695 | 1695 |
1696 if (primary_user_) { | 1696 if (primary_user_) { |
1697 LoginState::Get()->SetLoggedInStateAndPrimaryUser( | 1697 LoginState::Get()->SetLoggedInStateAndPrimaryUser( |
1698 logged_in_state, login_user_type, primary_user_->username_hash()); | 1698 logged_in_state, login_user_type, primary_user_->username_hash()); |
1699 } else { | 1699 } else { |
1700 LoginState::Get()->SetLoggedInState(logged_in_state, login_user_type); | 1700 LoginState::Get()->SetLoggedInState(logged_in_state, login_user_type); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1768 } | 1768 } |
1769 | 1769 |
1770 void UserManagerImpl::DeleteUser(User* user) { | 1770 void UserManagerImpl::DeleteUser(User* user) { |
1771 const bool is_active_user = (user == active_user_); | 1771 const bool is_active_user = (user == active_user_); |
1772 delete user; | 1772 delete user; |
1773 if (is_active_user) | 1773 if (is_active_user) |
1774 active_user_ = NULL; | 1774 active_user_ = NULL; |
1775 } | 1775 } |
1776 | 1776 |
1777 } // namespace chromeos | 1777 } // namespace chromeos |
OLD | NEW |