| 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/chrome_user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/chrome_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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 | 729 |
| 730 GetUserImageManager(account_id)->UserLoggedIn(IsCurrentUserNew(), true); | 730 GetUserImageManager(account_id)->UserLoggedIn(IsCurrentUserNew(), true); |
| 731 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); | 731 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); |
| 732 | 732 |
| 733 // Make sure that new data is persisted to Local State. | 733 // Make sure that new data is persisted to Local State. |
| 734 GetLocalState()->CommitPendingWrite(); | 734 GetLocalState()->CommitPendingWrite(); |
| 735 } | 735 } |
| 736 | 736 |
| 737 bool ChromeUserManagerImpl::HasPendingBootstrap( | 737 bool ChromeUserManagerImpl::HasPendingBootstrap( |
| 738 const AccountId& account_id) const { | 738 const AccountId& account_id) const { |
| 739 return bootstrap_manager_->HasPendingBootstrap(account_id.GetUserEmail()); | 739 return bootstrap_manager_->HasPendingBootstrap(account_id); |
| 740 } | 740 } |
| 741 | 741 |
| 742 void ChromeUserManagerImpl::PublicAccountUserLoggedIn( | 742 void ChromeUserManagerImpl::PublicAccountUserLoggedIn( |
| 743 user_manager::User* user) { | 743 user_manager::User* user) { |
| 744 SetIsCurrentUserNew(true); | 744 SetIsCurrentUserNew(true); |
| 745 active_user_ = user; | 745 active_user_ = user; |
| 746 | 746 |
| 747 // The UserImageManager chooses a random avatar picture when a user logs in | 747 // The UserImageManager chooses a random avatar picture when a user logs in |
| 748 // for the first time. Tell the UserImageManager that this user is not new to | 748 // for the first time. Tell the UserImageManager that this user is not new to |
| 749 // prevent the avatar from getting changed. | 749 // prevent the avatar from getting changed. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 const AccountId& account_id) { | 857 const AccountId& account_id) { |
| 858 ChromeUserManager::RemoveNonCryptohomeData(account_id); | 858 ChromeUserManager::RemoveNonCryptohomeData(account_id); |
| 859 | 859 |
| 860 WallpaperManager::Get()->RemoveUserWallpaperInfo(account_id.GetUserEmail()); | 860 WallpaperManager::Get()->RemoveUserWallpaperInfo(account_id.GetUserEmail()); |
| 861 GetUserImageManager(account_id)->DeleteUserImage(); | 861 GetUserImageManager(account_id)->DeleteUserImage(); |
| 862 | 862 |
| 863 supervised_user_manager_->RemoveNonCryptohomeData(account_id.GetUserEmail()); | 863 supervised_user_manager_->RemoveNonCryptohomeData(account_id.GetUserEmail()); |
| 864 | 864 |
| 865 multi_profile_user_controller_->RemoveCachedValues(account_id.GetUserEmail()); | 865 multi_profile_user_controller_->RemoveCachedValues(account_id.GetUserEmail()); |
| 866 | 866 |
| 867 EasyUnlockService::ResetLocalStateForUser(account_id.GetUserEmail()); | 867 EasyUnlockService::ResetLocalStateForUser(account_id); |
| 868 } | 868 } |
| 869 | 869 |
| 870 void | 870 void |
| 871 ChromeUserManagerImpl::CleanUpPublicAccountNonCryptohomeDataPendingRemoval() { | 871 ChromeUserManagerImpl::CleanUpPublicAccountNonCryptohomeDataPendingRemoval() { |
| 872 PrefService* local_state = GetLocalState(); | 872 PrefService* local_state = GetLocalState(); |
| 873 const std::string public_account_pending_data_removal = | 873 const std::string public_account_pending_data_removal = |
| 874 local_state->GetString(kPublicAccountPendingDataRemoval); | 874 local_state->GetString(kPublicAccountPendingDataRemoval); |
| 875 if (public_account_pending_data_removal.empty() || | 875 if (public_account_pending_data_removal.empty() || |
| 876 (IsUserLoggedIn() && | 876 (IsUserLoggedIn() && |
| 877 public_account_pending_data_removal == GetActiveUser()->email())) { | 877 public_account_pending_data_removal == GetActiveUser()->email())) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 ChromeUserManager::NotifyUserAddedToSession(added_user, user_switch_pending); | 1087 ChromeUserManager::NotifyUserAddedToSession(added_user, user_switch_pending); |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) { | 1090 void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) { |
| 1091 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " | 1091 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " |
| 1092 "current session"; | 1092 "current session"; |
| 1093 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email); | 1093 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 void ChromeUserManagerImpl::RemovePendingBootstrapUser( | 1096 void ChromeUserManagerImpl::RemovePendingBootstrapUser( |
| 1097 const std::string& user_id) { | 1097 const AccountId& account_id) { |
| 1098 const AccountId account_id(AccountId::FromUserEmail(user_id)); | |
| 1099 DCHECK(HasPendingBootstrap(account_id)); | 1098 DCHECK(HasPendingBootstrap(account_id)); |
| 1100 RemoveNonOwnerUserInternal(account_id, nullptr); | 1099 RemoveNonOwnerUserInternal(account_id, nullptr); |
| 1101 } | 1100 } |
| 1102 | 1101 |
| 1103 void ChromeUserManagerImpl::UpdateNumberOfUsers() { | 1102 void ChromeUserManagerImpl::UpdateNumberOfUsers() { |
| 1104 size_t users = GetLoggedInUsers().size(); | 1103 size_t users = GetLoggedInUsers().size(); |
| 1105 if (users) { | 1104 if (users) { |
| 1106 // Write the user number as UMA stat when a multi user session is possible. | 1105 // Write the user number as UMA stat when a multi user session is possible. |
| 1107 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) | 1106 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) |
| 1108 ash::MultiProfileUMA::RecordUserCount(users); | 1107 ash::MultiProfileUMA::RecordUserCount(users); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 new base::StringValue(account_id.GetUserEmail())); | 1185 new base::StringValue(account_id.GetUserEmail())); |
| 1187 } | 1186 } |
| 1188 | 1187 |
| 1189 void ChromeUserManagerImpl::RemoveReportingUser(const AccountId& account_id) { | 1188 void ChromeUserManagerImpl::RemoveReportingUser(const AccountId& account_id) { |
| 1190 ListPrefUpdate users_update(GetLocalState(), kReportingUsers); | 1189 ListPrefUpdate users_update(GetLocalState(), kReportingUsers); |
| 1191 users_update->Remove( | 1190 users_update->Remove( |
| 1192 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); | 1191 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); |
| 1193 } | 1192 } |
| 1194 | 1193 |
| 1195 } // namespace chromeos | 1194 } // namespace chromeos |
| OLD | NEW |