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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 #if defined(USE_ATHENA) | 374 #if defined(USE_ATHENA) |
| 375 // crbug.com/413926 | 375 // crbug.com/413926 |
| 376 return; | 376 return; |
| 377 #endif | 377 #endif |
| 378 | 378 |
| 379 content::RecordAction(UserMetricsAction("ScreenLocker_Show")); | 379 content::RecordAction(UserMetricsAction("ScreenLocker_Show")); |
| 380 DCHECK(base::MessageLoopForUI::IsCurrent()); | 380 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 381 | 381 |
| 382 // Check whether the currently logged in user is a guest account and if so, | 382 // Check whether the currently logged in user is a guest account and if so, |
| 383 // refuse to lock the screen (crosbug.com/23764). | 383 // refuse to lock the screen (crosbug.com/23764). |
| 384 // For a demo user, we should never show the lock screen (crosbug.com/27647). | 384 // For a demo user, we should never show the lock screen (crosbug.com/27647). |
|
Nikita (slow)
2014/10/01 07:13:01
nit: updated comment
rkc
2014/10/01 17:29:52
Done.
| |
| 385 if (user_manager::UserManager::Get()->IsLoggedInAsGuest() || | 385 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) { |
| 386 user_manager::UserManager::Get()->IsLoggedInAsDemoUser()) { | |
| 387 VLOG(1) << "Refusing to lock screen for guest/demo account"; | 386 VLOG(1) << "Refusing to lock screen for guest/demo account"; |
| 388 return; | 387 return; |
| 389 } | 388 } |
| 390 | 389 |
| 391 // If the active window is fullscreen, exit fullscreen to avoid the web page | 390 // If the active window is fullscreen, exit fullscreen to avoid the web page |
| 392 // or app mimicking the lock screen. Do not exit fullscreen if the shelf is | 391 // or app mimicking the lock screen. Do not exit fullscreen if the shelf is |
| 393 // visible while in fullscreen because the shelf makes it harder for a web | 392 // visible while in fullscreen because the shelf makes it harder for a web |
| 394 // page or app to mimick the lock screen. | 393 // page or app to mimick the lock screen. |
| 395 ash::wm::WindowState* active_window_state = ash::wm::GetActiveWindowState(); | 394 ash::wm::WindowState* active_window_state = ash::wm::GetActiveWindowState(); |
| 396 if (active_window_state && | 395 if (active_window_state && |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 414 } | 413 } |
| 415 | 414 |
| 416 // static | 415 // static |
| 417 void ScreenLocker::Hide() { | 416 void ScreenLocker::Hide() { |
| 418 #if defined(USE_ATHENA) | 417 #if defined(USE_ATHENA) |
| 419 // crbug.com/413926 | 418 // crbug.com/413926 |
| 420 return; | 419 return; |
| 421 #endif | 420 #endif |
| 422 | 421 |
| 423 DCHECK(base::MessageLoopForUI::IsCurrent()); | 422 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 424 // For a guest/demo user, screen_locker_ would have never been initialized. | 423 // For a guest/demo user, screen_locker_ would have never been initialized. |
|
Nikita (slow)
2014/10/01 07:13:01
nit: update comment
rkc
2014/10/01 17:29:52
Done.
| |
| 425 if (user_manager::UserManager::Get()->IsLoggedInAsGuest() || | 424 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) { |
| 426 user_manager::UserManager::Get()->IsLoggedInAsDemoUser()) { | |
| 427 VLOG(1) << "Refusing to hide lock screen for guest/demo account"; | 425 VLOG(1) << "Refusing to hide lock screen for guest/demo account"; |
| 428 return; | 426 return; |
| 429 } | 427 } |
| 430 | 428 |
| 431 DCHECK(screen_locker_); | 429 DCHECK(screen_locker_); |
| 432 base::Callback<void(void)> callback = | 430 base::Callback<void(void)> callback = |
| 433 base::Bind(&ScreenLocker::ScheduleDeletion); | 431 base::Bind(&ScreenLocker::ScheduleDeletion); |
| 434 ash::Shell::GetInstance()->lock_state_controller()-> | 432 ash::Shell::GetInstance()->lock_state_controller()-> |
| 435 OnLockScreenHide(callback); | 433 OnLockScreenHide(callback); |
| 436 } | 434 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 518 for (user_manager::UserList::const_iterator it = users_.begin(); | 516 for (user_manager::UserList::const_iterator it = users_.begin(); |
| 519 it != users_.end(); | 517 it != users_.end(); |
| 520 ++it) { | 518 ++it) { |
| 521 if ((*it)->email() == username) | 519 if ((*it)->email() == username) |
| 522 return true; | 520 return true; |
| 523 } | 521 } |
| 524 return false; | 522 return false; |
| 525 } | 523 } |
| 526 | 524 |
| 527 } // namespace chromeos | 525 } // namespace chromeos |
| OLD | NEW |