| 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 "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 user->set_username_hash(username_hash); | 355 user->set_username_hash(username_hash); |
| 356 logged_in_users_.push_back(user); | 356 logged_in_users_.push_back(user); |
| 357 lru_logged_in_users_.push_back(user); | 357 lru_logged_in_users_.push_back(user); |
| 358 // Reset the new user flag if the user already exists. | 358 // Reset the new user flag if the user already exists. |
| 359 is_current_user_new_ = false; | 359 is_current_user_new_ = false; |
| 360 // Set active user wallpaper back. | 360 // Set active user wallpaper back. |
| 361 WallpaperManager::Get()->SetUserWallpaper(active_user_->email()); | 361 WallpaperManager::Get()->SetUserWallpaper(active_user_->email()); |
| 362 return; | 362 return; |
| 363 } | 363 } |
| 364 | 364 |
| 365 policy::DeviceLocalAccount::Type device_local_account_type; |
| 365 if (email == UserManager::kGuestUserName) { | 366 if (email == UserManager::kGuestUserName) { |
| 366 GuestUserLoggedIn(); | 367 GuestUserLoggedIn(); |
| 367 } else if (email == UserManager::kRetailModeUserName) { | 368 } else if (email == UserManager::kRetailModeUserName) { |
| 368 RetailModeUserLoggedIn(); | 369 RetailModeUserLoggedIn(); |
| 369 } else if (policy::IsKioskAppUser(email)) { | 370 } else if (policy::IsDeviceLocalAccountUser(email, |
| 371 &device_local_account_type) && |
| 372 device_local_account_type == |
| 373 policy::DeviceLocalAccount::TYPE_KIOSK_APP) { |
| 370 KioskAppLoggedIn(email); | 374 KioskAppLoggedIn(email); |
| 371 } else { | 375 } else { |
| 372 EnsureUsersLoaded(); | 376 EnsureUsersLoaded(); |
| 373 | 377 |
| 374 if (user && user->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT) { | 378 if (user && user->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT) { |
| 375 PublicAccountUserLoggedIn(user); | 379 PublicAccountUserLoggedIn(user); |
| 376 } else if ((user && user->GetType() == User::USER_TYPE_LOCALLY_MANAGED) || | 380 } else if ((user && user->GetType() == User::USER_TYPE_LOCALLY_MANAGED) || |
| 377 (!user && gaia::ExtractDomainName(email) == | 381 (!user && gaia::ExtractDomainName(email) == |
| 378 UserManager::kLocallyManagedUserDomain)) { | 382 UserManager::kLocallyManagedUserDomain)) { |
| 379 LocallyManagedUserLoggedIn(email); | 383 LocallyManagedUserLoggedIn(email); |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 active_user_ = user; | 1393 active_user_ = user; |
| 1390 // The UserImageManager chooses a random avatar picture when a user logs in | 1394 // The UserImageManager chooses a random avatar picture when a user logs in |
| 1391 // for the first time. Tell the UserImageManager that this user is not new to | 1395 // for the first time. Tell the UserImageManager that this user is not new to |
| 1392 // prevent the avatar from getting changed. | 1396 // prevent the avatar from getting changed. |
| 1393 user_image_manager_->UserLoggedIn(user->email(), false, true); | 1397 user_image_manager_->UserLoggedIn(user->email(), false, true); |
| 1394 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); | 1398 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); |
| 1395 } | 1399 } |
| 1396 | 1400 |
| 1397 void UserManagerImpl::KioskAppLoggedIn(const std::string& username) { | 1401 void UserManagerImpl::KioskAppLoggedIn(const std::string& username) { |
| 1398 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1402 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1399 DCHECK(policy::IsKioskAppUser(username)); | 1403 policy::DeviceLocalAccount::Type device_local_account_type; |
| 1404 DCHECK(policy::IsDeviceLocalAccountUser(username, |
| 1405 &device_local_account_type)); |
| 1406 DCHECK_EQ(policy::DeviceLocalAccount::TYPE_KIOSK_APP, |
| 1407 device_local_account_type); |
| 1400 | 1408 |
| 1401 active_user_ = User::CreateKioskAppUser(username); | 1409 active_user_ = User::CreateKioskAppUser(username); |
| 1402 active_user_->SetStubImage(User::kInvalidImageIndex, false); | 1410 active_user_->SetStubImage(User::kInvalidImageIndex, false); |
| 1403 WallpaperManager::Get()->SetInitialUserWallpaper(username, false); | 1411 WallpaperManager::Get()->SetInitialUserWallpaper(username, false); |
| 1404 | 1412 |
| 1405 // TODO(bartfab): Add KioskAppUsers to the users_ list and keep metadata like | 1413 // TODO(bartfab): Add KioskAppUsers to the users_ list and keep metadata like |
| 1406 // the kiosk_app_id in these objects, removing the need to re-parse the | 1414 // the kiosk_app_id in these objects, removing the need to re-parse the |
| 1407 // device-local account list here to extract the kiosk_app_id. | 1415 // device-local account list here to extract the kiosk_app_id. |
| 1408 const std::vector<policy::DeviceLocalAccount> device_local_accounts = | 1416 const std::vector<policy::DeviceLocalAccount> device_local_accounts = |
| 1409 policy::GetDeviceLocalAccounts(cros_settings_); | 1417 policy::GetDeviceLocalAccounts(cros_settings_); |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1988 } | 1996 } |
| 1989 } | 1997 } |
| 1990 | 1998 |
| 1991 void UserManagerImpl::OnUserNotAllowed() { | 1999 void UserManagerImpl::OnUserNotAllowed() { |
| 1992 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " | 2000 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " |
| 1993 "current session"; | 2001 "current session"; |
| 1994 chrome::AttemptUserExit(); | 2002 chrome::AttemptUserExit(); |
| 1995 } | 2003 } |
| 1996 | 2004 |
| 1997 } // namespace chromeos | 2005 } // namespace chromeos |
| OLD | NEW |