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()); | |
Nikita (slow)
2014/04/25 15:00:08
So I guess we don't need to switch wallpaper now s
Dmitry Polukhin
2014/04/25 16:07:20
Yes, new user wallpaper is set when his pod activa
| |
429 NotifyUserAddedToSession(user); | 427 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 | 974 // If there is pending user switch, do it now. |
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 } | |
975 break; | 986 break; |
976 } | 987 } |
977 default: | 988 default: |
978 NOTREACHED(); | 989 NOTREACHED(); |
979 } | 990 } |
980 } | 991 } |
981 | 992 |
982 void UserManagerImpl::OnExternalDataSet(const std::string& policy, | 993 void UserManagerImpl::OnExternalDataSet(const std::string& policy, |
983 const std::string& user_id) { | 994 const std::string& user_id) { |
984 if (policy == policy::key::kUserAvatarImage) | 995 if (policy == policy::key::kUserAvatarImage) |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2080 } | 2091 } |
2081 | 2092 |
2082 void UserManagerImpl::DeleteUser(User* user) { | 2093 void UserManagerImpl::DeleteUser(User* user) { |
2083 const bool is_active_user = (user == active_user_); | 2094 const bool is_active_user = (user == active_user_); |
2084 delete user; | 2095 delete user; |
2085 if (is_active_user) | 2096 if (is_active_user) |
2086 active_user_ = NULL; | 2097 active_user_ = NULL; |
2087 } | 2098 } |
2088 | 2099 |
2089 } // namespace chromeos | 2100 } // namespace chromeos |
OLD | NEW |