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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 | 737 |
738 GetUserImageManager(account_id)->UserLoggedIn(IsCurrentUserNew(), true); | 738 GetUserImageManager(account_id)->UserLoggedIn(IsCurrentUserNew(), true); |
739 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); | 739 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); |
740 | 740 |
741 // Make sure that new data is persisted to Local State. | 741 // Make sure that new data is persisted to Local State. |
742 GetLocalState()->CommitPendingWrite(); | 742 GetLocalState()->CommitPendingWrite(); |
743 } | 743 } |
744 | 744 |
745 bool ChromeUserManagerImpl::HasPendingBootstrap( | 745 bool ChromeUserManagerImpl::HasPendingBootstrap( |
746 const AccountId& account_id) const { | 746 const AccountId& account_id) const { |
747 return bootstrap_manager_->HasPendingBootstrap(account_id.GetUserEmail()); | 747 return bootstrap_manager_->HasPendingBootstrap(account_id); |
748 } | 748 } |
749 | 749 |
750 void ChromeUserManagerImpl::PublicAccountUserLoggedIn( | 750 void ChromeUserManagerImpl::PublicAccountUserLoggedIn( |
751 user_manager::User* user) { | 751 user_manager::User* user) { |
752 SetIsCurrentUserNew(true); | 752 SetIsCurrentUserNew(true); |
753 active_user_ = user; | 753 active_user_ = user; |
754 | 754 |
755 // The UserImageManager chooses a random avatar picture when a user logs in | 755 // The UserImageManager chooses a random avatar picture when a user logs in |
756 // for the first time. Tell the UserImageManager that this user is not new to | 756 // for the first time. Tell the UserImageManager that this user is not new to |
757 // prevent the avatar from getting changed. | 757 // prevent the avatar from getting changed. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 const AccountId& account_id) { | 863 const AccountId& account_id) { |
864 ChromeUserManager::RemoveNonCryptohomeData(account_id); | 864 ChromeUserManager::RemoveNonCryptohomeData(account_id); |
865 | 865 |
866 WallpaperManager::Get()->RemoveUserWallpaperInfo(account_id); | 866 WallpaperManager::Get()->RemoveUserWallpaperInfo(account_id); |
867 GetUserImageManager(account_id)->DeleteUserImage(); | 867 GetUserImageManager(account_id)->DeleteUserImage(); |
868 | 868 |
869 supervised_user_manager_->RemoveNonCryptohomeData(account_id.GetUserEmail()); | 869 supervised_user_manager_->RemoveNonCryptohomeData(account_id.GetUserEmail()); |
870 | 870 |
871 multi_profile_user_controller_->RemoveCachedValues(account_id.GetUserEmail()); | 871 multi_profile_user_controller_->RemoveCachedValues(account_id.GetUserEmail()); |
872 | 872 |
873 EasyUnlockService::ResetLocalStateForUser(account_id.GetUserEmail()); | 873 EasyUnlockService::ResetLocalStateForUser(account_id); |
874 } | 874 } |
875 | 875 |
876 void | 876 void |
877 ChromeUserManagerImpl::CleanUpPublicAccountNonCryptohomeDataPendingRemoval() { | 877 ChromeUserManagerImpl::CleanUpPublicAccountNonCryptohomeDataPendingRemoval() { |
878 PrefService* local_state = GetLocalState(); | 878 PrefService* local_state = GetLocalState(); |
879 const std::string public_account_pending_data_removal = | 879 const std::string public_account_pending_data_removal = |
880 local_state->GetString(kPublicAccountPendingDataRemoval); | 880 local_state->GetString(kPublicAccountPendingDataRemoval); |
881 if (public_account_pending_data_removal.empty() || | 881 if (public_account_pending_data_removal.empty() || |
882 (IsUserLoggedIn() && | 882 (IsUserLoggedIn() && |
883 public_account_pending_data_removal == GetActiveUser()->email())) { | 883 public_account_pending_data_removal == GetActiveUser()->email())) { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 ChromeUserManager::NotifyUserAddedToSession(added_user, user_switch_pending); | 1093 ChromeUserManager::NotifyUserAddedToSession(added_user, user_switch_pending); |
1094 } | 1094 } |
1095 | 1095 |
1096 void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) { | 1096 void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) { |
1097 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " | 1097 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " |
1098 "current session"; | 1098 "current session"; |
1099 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email); | 1099 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email); |
1100 } | 1100 } |
1101 | 1101 |
1102 void ChromeUserManagerImpl::RemovePendingBootstrapUser( | 1102 void ChromeUserManagerImpl::RemovePendingBootstrapUser( |
1103 const std::string& user_id) { | 1103 const AccountId& account_id) { |
1104 const AccountId account_id(AccountId::FromUserEmail(user_id)); | |
1105 DCHECK(HasPendingBootstrap(account_id)); | 1104 DCHECK(HasPendingBootstrap(account_id)); |
1106 RemoveNonOwnerUserInternal(account_id, nullptr); | 1105 RemoveNonOwnerUserInternal(account_id, nullptr); |
1107 } | 1106 } |
1108 | 1107 |
1109 void ChromeUserManagerImpl::UpdateNumberOfUsers() { | 1108 void ChromeUserManagerImpl::UpdateNumberOfUsers() { |
1110 size_t users = GetLoggedInUsers().size(); | 1109 size_t users = GetLoggedInUsers().size(); |
1111 if (users) { | 1110 if (users) { |
1112 // Write the user number as UMA stat when a multi user session is possible. | 1111 // Write the user number as UMA stat when a multi user session is possible. |
1113 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) | 1112 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) |
1114 ash::MultiProfileUMA::RecordUserCount(users); | 1113 ash::MultiProfileUMA::RecordUserCount(users); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 new base::StringValue(account_id.GetUserEmail())); | 1191 new base::StringValue(account_id.GetUserEmail())); |
1193 } | 1192 } |
1194 | 1193 |
1195 void ChromeUserManagerImpl::RemoveReportingUser(const AccountId& account_id) { | 1194 void ChromeUserManagerImpl::RemoveReportingUser(const AccountId& account_id) { |
1196 ListPrefUpdate users_update(GetLocalState(), kReportingUsers); | 1195 ListPrefUpdate users_update(GetLocalState(), kReportingUsers); |
1197 users_update->Remove( | 1196 users_update->Remove( |
1198 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); | 1197 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); |
1199 } | 1198 } |
1200 | 1199 |
1201 } // namespace chromeos | 1200 } // namespace chromeos |
OLD | NEW |