Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: chrome/browser/chromeos/login/user_manager_impl.cc

Issue 24261010: Allow explicitly whitelisted apps/extensions in public sessions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix handing of guest user ID. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 active_user_ = user; 1399 active_user_ = user;
1396 // The UserImageManager chooses a random avatar picture when a user logs in 1400 // The UserImageManager chooses a random avatar picture when a user logs in
1397 // for the first time. Tell the UserImageManager that this user is not new to 1401 // for the first time. Tell the UserImageManager that this user is not new to
1398 // prevent the avatar from getting changed. 1402 // prevent the avatar from getting changed.
1399 user_image_manager_->UserLoggedIn(user->email(), false, true); 1403 user_image_manager_->UserLoggedIn(user->email(), false, true);
1400 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); 1404 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded();
1401 } 1405 }
1402 1406
1403 void UserManagerImpl::KioskAppLoggedIn(const std::string& username) { 1407 void UserManagerImpl::KioskAppLoggedIn(const std::string& username) {
1404 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1408 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1405 DCHECK(policy::IsKioskAppUser(username)); 1409 policy::DeviceLocalAccount::Type device_local_account_type;
1410 DCHECK(policy::IsDeviceLocalAccountUser(username,
1411 &device_local_account_type));
1412 DCHECK_EQ(policy::DeviceLocalAccount::TYPE_KIOSK_APP,
1413 device_local_account_type);
1406 1414
1407 active_user_ = User::CreateKioskAppUser(username); 1415 active_user_ = User::CreateKioskAppUser(username);
1408 active_user_->SetStubImage(User::kInvalidImageIndex, false); 1416 active_user_->SetStubImage(User::kInvalidImageIndex, false);
1409 WallpaperManager::Get()->SetInitialUserWallpaper(username, false); 1417 WallpaperManager::Get()->SetInitialUserWallpaper(username, false);
1410 1418
1411 // TODO(bartfab): Add KioskAppUsers to the users_ list and keep metadata like 1419 // TODO(bartfab): Add KioskAppUsers to the users_ list and keep metadata like
1412 // the kiosk_app_id in these objects, removing the need to re-parse the 1420 // the kiosk_app_id in these objects, removing the need to re-parse the
1413 // device-local account list here to extract the kiosk_app_id. 1421 // device-local account list here to extract the kiosk_app_id.
1414 const std::vector<policy::DeviceLocalAccount> device_local_accounts = 1422 const std::vector<policy::DeviceLocalAccount> device_local_accounts =
1415 policy::GetDeviceLocalAccounts(cros_settings_); 1423 policy::GetDeviceLocalAccounts(cros_settings_);
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 } 2002 }
1995 } 2003 }
1996 2004
1997 void UserManagerImpl::OnUserNotAllowed() { 2005 void UserManagerImpl::OnUserNotAllowed() {
1998 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " 2006 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the "
1999 "current session"; 2007 "current session";
2000 chrome::AttemptUserExit(); 2008 chrome::AttemptUserExit();
2001 } 2009 }
2002 2010
2003 } // namespace chromeos 2011 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698