diff options
Diffstat (limited to 'ash/wm/power_button_controller.cc')
-rw-r--r-- | ash/wm/power_button_controller.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/ash/wm/power_button_controller.cc b/ash/wm/power_button_controller.cc index 6850608..9359b8a 100644 --- a/ash/wm/power_button_controller.cc +++ b/ash/wm/power_button_controller.cc @@ -5,8 +5,8 @@ #include "ash/wm/power_button_controller.h" #include "ash/ash_switches.h" -#include "ash/session_state_delegate.h" #include "ash/shell.h" +#include "ash/shell_delegate.h" #include "ash/shell_window_ids.h" #include "ash/wm/session_state_animator.h" #include "ash/wm/session_state_controller.h" @@ -45,15 +45,13 @@ void PowerButtonController::OnPowerButtonEvent( if (screen_is_off_) return; - const SessionStateDelegate* session_state_delegate = - Shell::GetInstance()->session_state_delegate(); + Shell* shell = Shell::GetInstance(); if (has_legacy_power_button_) { // If power button releases won't get reported correctly because we're not // running on official hardware, just lock the screen or shut down // immediately. if (down) { - if (session_state_delegate->CanLockScreen() && - !session_state_delegate->IsScreenLocked() && + if (shell->CanLockScreen() && !shell->IsScreenLocked() && !controller_->LockRequested()) { controller_->StartLockAnimationAndLockImmediately(); } else { @@ -66,12 +64,10 @@ void PowerButtonController::OnPowerButtonEvent( if (controller_->LockRequested()) return; - if (session_state_delegate->CanLockScreen() && - !session_state_delegate->IsScreenLocked()) { + if (shell->CanLockScreen() && !shell->IsScreenLocked()) controller_->StartLockAnimation(true); - } else { + else controller_->StartShutdownAnimation(); - } } else { // Button is up. if (controller_->CanCancelLockAnimation()) controller_->CancelLockAnimation(); @@ -85,12 +81,9 @@ void PowerButtonController::OnLockButtonEvent( bool down, const base::TimeTicks& timestamp) { lock_button_down_ = down; - const SessionStateDelegate* session_state_delegate = - Shell::GetInstance()->session_state_delegate(); - if (!session_state_delegate->CanLockScreen() || - session_state_delegate->IsScreenLocked() || - controller_->LockRequested() || - controller_->ShutdownRequested()) { + Shell* shell = Shell::GetInstance(); + if (!shell->CanLockScreen() || shell->IsScreenLocked() || + controller_->LockRequested() || controller_->ShutdownRequested()) { return; } |