| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 DCHECK(!IsUserLoggedIn()); | 417 DCHECK(!IsUserLoggedIn()); |
| 418 | 418 |
| 419 User* user = FindUserInListAndModify(user_id); | 419 User* user = FindUserInListAndModify(user_id); |
| 420 if (active_user_ && user) { | 420 if (active_user_ && user) { |
| 421 user->set_is_logged_in(true); | 421 user->set_is_logged_in(true); |
| 422 user->set_username_hash(username_hash); | 422 user->set_username_hash(username_hash); |
| 423 logged_in_users_.push_back(user); | 423 logged_in_users_.push_back(user); |
| 424 lru_logged_in_users_.push_back(user); | 424 lru_logged_in_users_.push_back(user); |
| 425 // Reset the new user flag if the user already exists. | 425 // Reset the new user flag if the user already exists. |
| 426 is_current_user_new_ = false; | 426 is_current_user_new_ = false; |
| 427 // Set active user wallpaper back. |
| 428 WallpaperManager::Get()->SetUserWallpaperNow(active_user_->email()); |
| 427 NotifyUserAddedToSession(user); | 429 NotifyUserAddedToSession(user); |
| 428 // Remember that we need to switch to this user as soon as profile ready. | |
| 429 pending_user_switch_ = user_id; | |
| 430 return; | 430 return; |
| 431 } | 431 } |
| 432 | 432 |
| 433 policy::DeviceLocalAccount::Type device_local_account_type; | 433 policy::DeviceLocalAccount::Type device_local_account_type; |
| 434 if (user_id == UserManager::kGuestUserName) { | 434 if (user_id == UserManager::kGuestUserName) { |
| 435 GuestUserLoggedIn(); | 435 GuestUserLoggedIn(); |
| 436 } else if (user_id == UserManager::kRetailModeUserName) { | 436 } else if (user_id == UserManager::kRetailModeUserName) { |
| 437 RetailModeUserLoggedIn(); | 437 RetailModeUserLoggedIn(); |
| 438 } else if (policy::IsDeviceLocalAccountUser(user_id, | 438 } else if (policy::IsDeviceLocalAccountUser(user_id, |
| 439 &device_local_account_type) && | 439 &device_local_account_type) && |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 GetNSSCertDatabaseForProfile(profile, | 964 GetNSSCertDatabaseForProfile(profile, |
| 965 base::Bind(&OnGetNSSCertDatabaseForUser)); | 965 base::Bind(&OnGetNSSCertDatabaseForUser)); |
| 966 } | 966 } |
| 967 break; | 967 break; |
| 968 } | 968 } |
| 969 case chrome::NOTIFICATION_PROFILE_CREATED: { | 969 case chrome::NOTIFICATION_PROFILE_CREATED: { |
| 970 Profile* profile = content::Source<Profile>(source).ptr(); | 970 Profile* profile = content::Source<Profile>(source).ptr(); |
| 971 User* user = GetUserByProfile(profile); | 971 User* user = GetUserByProfile(profile); |
| 972 if (user != NULL) | 972 if (user != NULL) |
| 973 user->set_profile_is_created(); | 973 user->set_profile_is_created(); |
| 974 // If there is pending user switch, do it now. | 974 |
| 975 if (!pending_user_switch_.empty()) { | |
| 976 // Call SwitchActiveUser async because otherwise it may cause | |
| 977 // ProfileManager::GetProfile before the profile gets registered | |
| 978 // in ProfileManager. It happens in case of sync profile load when | |
| 979 // NOTIFICATION_PROFILE_CREATED is called synchronously. | |
| 980 base::MessageLoop::current()->PostTask(FROM_HERE, | |
| 981 base::Bind(&UserManagerImpl::SwitchActiveUser, | |
| 982 base::Unretained(this), | |
| 983 pending_user_switch_)); | |
| 984 pending_user_switch_.clear(); | |
| 985 } | |
| 986 break; | 975 break; |
| 987 } | 976 } |
| 988 default: | 977 default: |
| 989 NOTREACHED(); | 978 NOTREACHED(); |
| 990 } | 979 } |
| 991 } | 980 } |
| 992 | 981 |
| 993 void UserManagerImpl::OnExternalDataSet(const std::string& policy, | 982 void UserManagerImpl::OnExternalDataSet(const std::string& policy, |
| 994 const std::string& user_id) { | 983 const std::string& user_id) { |
| 995 if (policy == policy::key::kUserAvatarImage) | 984 if (policy == policy::key::kUserAvatarImage) |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2091 } | 2080 } |
| 2092 | 2081 |
| 2093 void UserManagerImpl::DeleteUser(User* user) { | 2082 void UserManagerImpl::DeleteUser(User* user) { |
| 2094 const bool is_active_user = (user == active_user_); | 2083 const bool is_active_user = (user == active_user_); |
| 2095 delete user; | 2084 delete user; |
| 2096 if (is_active_user) | 2085 if (is_active_user) |
| 2097 active_user_ = NULL; | 2086 active_user_ = NULL; |
| 2098 } | 2087 } |
| 2099 | 2088 |
| 2100 } // namespace chromeos | 2089 } // namespace chromeos |
| OLD | NEW |