Chromium Code Reviews| 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 377 } | 377 } |
| 378 } | 378 } |
| 379 | 379 |
| 380 // static | 380 // static |
| 381 void ScreenLocker::Show() { | 381 void ScreenLocker::Show() { |
| 382 content::RecordAction(UserMetricsAction("ScreenLocker_Show")); | 382 content::RecordAction(UserMetricsAction("ScreenLocker_Show")); |
| 383 DCHECK(base::MessageLoopForUI::IsCurrent()); | 383 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 384 | 384 |
| 385 // Check whether the currently logged in user is a guest account and if so, | 385 // Check whether the currently logged in user is a guest account and if so, |
| 386 // refuse to lock the screen (crosbug.com/23764). | 386 // refuse to lock the screen (crosbug.com/23764). |
| 387 // For a demo user, we should never show the lock screen (crosbug.com/27647). | 387 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) { |
| 388 if (user_manager::UserManager::Get()->IsLoggedInAsGuest() || | 388 VLOG(1) << "Refusing to lock screen for guest account"; |
| 389 user_manager::UserManager::Get()->IsLoggedInAsDemoUser()) { | |
| 390 VLOG(1) << "Refusing to lock screen for guest/demo account"; | |
| 391 return; | 389 return; |
| 392 } | 390 } |
| 393 | 391 |
| 394 #if !defined(USE_ATHENA) | 392 #if !defined(USE_ATHENA) |
| 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 && |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 414 VLOG(1) << "ScreenLocker " << screen_locker_ << " already exists; " | 412 VLOG(1) << "ScreenLocker " << screen_locker_ << " already exists; " |
| 415 << " calling session manager's HandleLockScreenShown D-Bus method"; | 413 << " calling session manager's HandleLockScreenShown D-Bus method"; |
| 416 DBusThreadManager::Get()->GetSessionManagerClient()-> | 414 DBusThreadManager::Get()->GetSessionManagerClient()-> |
| 417 NotifyLockScreenShown(); | 415 NotifyLockScreenShown(); |
| 418 } | 416 } |
| 419 } | 417 } |
| 420 | 418 |
| 421 // static | 419 // static |
| 422 void ScreenLocker::Hide() { | 420 void ScreenLocker::Hide() { |
| 423 DCHECK(base::MessageLoopForUI::IsCurrent()); | 421 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 424 // For a guest/demo user, screen_locker_ would have never been initialized. | 422 // For a guest/demo user, screen_locker_ would have never been initialized. |
|
bartfab (slow)
2014/11/27 16:25:47
Nit: s:/demo::
rkc
2014/12/01 19:15:04
Done.
| |
| 425 if (user_manager::UserManager::Get()->IsLoggedInAsGuest() || | 423 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) { |
| 426 user_manager::UserManager::Get()->IsLoggedInAsDemoUser()) { | 424 VLOG(1) << "Refusing to hide lock screen for guest account"; |
| 427 VLOG(1) << "Refusing to hide lock screen for guest/demo account"; | |
| 428 return; | 425 return; |
| 429 } | 426 } |
| 430 | 427 |
| 431 DCHECK(screen_locker_); | 428 DCHECK(screen_locker_); |
| 432 base::Callback<void(void)> callback = | 429 base::Callback<void(void)> callback = |
| 433 base::Bind(&ScreenLocker::ScheduleDeletion); | 430 base::Bind(&ScreenLocker::ScheduleDeletion); |
| 434 #if !defined(USE_ATHENA) | 431 #if !defined(USE_ATHENA) |
| 435 ash::Shell::GetInstance()->lock_state_controller()-> | 432 ash::Shell::GetInstance()->lock_state_controller()-> |
| 436 OnLockScreenHide(callback); | 433 OnLockScreenHide(callback); |
| 437 #else | 434 #else |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 527 for (user_manager::UserList::const_iterator it = users_.begin(); | 524 for (user_manager::UserList::const_iterator it = users_.begin(); |
| 528 it != users_.end(); | 525 it != users_.end(); |
| 529 ++it) { | 526 ++it) { |
| 530 if ((*it)->email() == username) | 527 if ((*it)->email() == username) |
| 531 return true; | 528 return true; |
| 532 } | 529 } |
| 533 return false; | 530 return false; |
| 534 } | 531 } |
| 535 | 532 |
| 536 } // namespace chromeos | 533 } // namespace chromeos |
| OLD | NEW |