| 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/lock/screen_locker.h" | 5 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 #if defined(USE_ATHENA) | 378 #if defined(USE_ATHENA) |
| 379 // crbug.com/413926 | 379 // crbug.com/413926 |
| 380 return; | 380 return; |
| 381 #endif | 381 #endif |
| 382 | 382 |
| 383 content::RecordAction(UserMetricsAction("ScreenLocker_Show")); | 383 content::RecordAction(UserMetricsAction("ScreenLocker_Show")); |
| 384 DCHECK(base::MessageLoopForUI::IsCurrent()); | 384 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 385 | 385 |
| 386 // Check whether the currently logged in user is a guest account and if so, | 386 // Check whether the currently logged in user is a guest account and if so, |
| 387 // refuse to lock the screen (crosbug.com/23764). | 387 // refuse to lock the screen (crosbug.com/23764). |
| 388 // For a demo user, we should never show the lock screen (crosbug.com/27647). | 388 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) { |
| 389 if (user_manager::UserManager::Get()->IsLoggedInAsGuest() || | 389 VLOG(1) << "Refusing to lock screen for guest account"; |
| 390 user_manager::UserManager::Get()->IsLoggedInAsDemoUser()) { | |
| 391 VLOG(1) << "Refusing to lock screen for guest/demo account"; | |
| 392 return; | 390 return; |
| 393 } | 391 } |
| 394 | 392 |
| 395 // If the active window is fullscreen, exit fullscreen to avoid the web page | 393 // If the active window is fullscreen, exit fullscreen to avoid the web page |
| 396 // or app mimicking the lock screen. Do not exit fullscreen if the shelf is | 394 // or app mimicking the lock screen. Do not exit fullscreen if the shelf is |
| 397 // visible while in fullscreen because the shelf makes it harder for a web | 395 // visible while in fullscreen because the shelf makes it harder for a web |
| 398 // page or app to mimick the lock screen. | 396 // page or app to mimick the lock screen. |
| 399 ash::wm::WindowState* active_window_state = ash::wm::GetActiveWindowState(); | 397 ash::wm::WindowState* active_window_state = ash::wm::GetActiveWindowState(); |
| 400 if (active_window_state && | 398 if (active_window_state && |
| 401 active_window_state->IsFullscreen() && | 399 active_window_state->IsFullscreen() && |
| (...skipping 16 matching lines...) Expand all Loading... |
| 418 } | 416 } |
| 419 | 417 |
| 420 // static | 418 // static |
| 421 void ScreenLocker::Hide() { | 419 void ScreenLocker::Hide() { |
| 422 #if defined(USE_ATHENA) | 420 #if defined(USE_ATHENA) |
| 423 // crbug.com/413926 | 421 // crbug.com/413926 |
| 424 return; | 422 return; |
| 425 #endif | 423 #endif |
| 426 | 424 |
| 427 DCHECK(base::MessageLoopForUI::IsCurrent()); | 425 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 428 // For a guest/demo user, screen_locker_ would have never been initialized. | 426 // For a guest user, screen_locker_ would have never been initialized. |
| 429 if (user_manager::UserManager::Get()->IsLoggedInAsGuest() || | 427 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) { |
| 430 user_manager::UserManager::Get()->IsLoggedInAsDemoUser()) { | 428 VLOG(1) << "Refusing to hide lock screen for guest account"; |
| 431 VLOG(1) << "Refusing to hide lock screen for guest/demo account"; | |
| 432 return; | 429 return; |
| 433 } | 430 } |
| 434 | 431 |
| 435 DCHECK(screen_locker_); | 432 DCHECK(screen_locker_); |
| 436 base::Callback<void(void)> callback = | 433 base::Callback<void(void)> callback = |
| 437 base::Bind(&ScreenLocker::ScheduleDeletion); | 434 base::Bind(&ScreenLocker::ScheduleDeletion); |
| 438 ash::Shell::GetInstance()->lock_state_controller()-> | 435 ash::Shell::GetInstance()->lock_state_controller()-> |
| 439 OnLockScreenHide(callback); | 436 OnLockScreenHide(callback); |
| 440 } | 437 } |
| 441 | 438 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 for (user_manager::UserList::const_iterator it = users_.begin(); | 519 for (user_manager::UserList::const_iterator it = users_.begin(); |
| 523 it != users_.end(); | 520 it != users_.end(); |
| 524 ++it) { | 521 ++it) { |
| 525 if ((*it)->email() == username) | 522 if ((*it)->email() == username) |
| 526 return true; | 523 return true; |
| 527 } | 524 } |
| 528 return false; | 525 return false; |
| 529 } | 526 } |
| 530 | 527 |
| 531 } // namespace chromeos | 528 } // namespace chromeos |
| OLD | NEW |