Chromium Code Reviews| Index: ash/wm/lock_state_controller.cc |
| diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc |
| index 7ba8a2f20723b6075b0645c736e9cd004e4fc865..80a8594dbb603d696233e7fb910c3116ff2283c0 100644 |
| --- a/ash/wm/lock_state_controller.cc |
| +++ b/ash/wm/lock_state_controller.cc |
| @@ -16,8 +16,11 @@ |
| #include "ash/shell_window_ids.h" |
| #include "ash/wm/session_state_animator.h" |
| #include "ash/wm/session_state_animator_impl.h" |
| +#include "base/bind.h" |
| #include "base/bind_helpers.h" |
| #include "base/command_line.h" |
| +#include "base/location.h" |
| +#include "base/logging.h" |
| #include "base/strings/string_util.h" |
| #include "base/timer/timer.h" |
| #include "ui/aura/window_tree_host.h" |
| @@ -164,7 +167,7 @@ void LockStateController::OnStartingLock() { |
| StartImmediatePreLockAnimation(false /* request_lock_on_completion */); |
| } |
| -void LockStateController::RequestShutdown() { |
| +void LockStateController::RequestShutdown(ShutdownMode mode) { |
| if (shutting_down_) |
| return; |
| @@ -178,7 +181,7 @@ void LockStateController::RequestShutdown() { |
| SessionStateAnimator::ROOT_CONTAINER, |
| SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS, |
| SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); |
| - StartRealShutdownTimer(true); |
| + StartRealShutdownTimer(true, mode); |
| } |
| void LockStateController::OnLockScreenHide( |
| @@ -269,10 +272,11 @@ void LockStateController::OnPreShutdownAnimationTimeout() { |
| Shell* shell = ash::Shell::GetInstance(); |
| shell->cursor_manager()->HideCursor(); |
| - StartRealShutdownTimer(false); |
| + StartRealShutdownTimer(false, POWER_OFF); |
| } |
| -void LockStateController::StartRealShutdownTimer(bool with_animation_time) { |
| +void LockStateController::StartRealShutdownTimer(bool with_animation_time, |
| + ShutdownMode shutdown_mode) { |
| base::TimeDelta duration = |
| base::TimeDelta::FromMilliseconds(kShutdownRequestDelayMs); |
| if (with_animation_time) { |
| @@ -291,11 +295,11 @@ void LockStateController::StartRealShutdownTimer(bool with_animation_time) { |
| #endif |
| real_shutdown_timer_.Start( |
| - FROM_HERE, duration, this, &LockStateController::OnRealShutdownTimeout); |
| + FROM_HERE, duration, base::Bind(&LockStateController::OnRealPowerTimeout, |
| + base::Unretained(this), shutdown_mode)); |
| } |
| -void LockStateController::OnRealShutdownTimeout() { |
| - VLOG(1) << "OnRealShutdownTimeout"; |
|
bartfab (slow)
2014/12/08 16:49:44
Why did you remove this?
cschuet (SLOW)
2014/12/08 18:57:04
Removed by accident. Restored.
|
| +void LockStateController::OnRealPowerTimeout(ShutdownMode shutdown_mode) { |
| DCHECK(shutting_down_); |
| #if defined(OS_CHROMEOS) |
| if (!base::SysInfo::IsRunningOnChromeOS()) { |
| @@ -306,9 +310,15 @@ void LockStateController::OnRealShutdownTimeout() { |
| } |
| } |
| #endif |
| - Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
| - UMA_ACCEL_SHUT_DOWN_POWER_BUTTON); |
| - delegate_->RequestShutdown(); |
| + if (shutdown_mode == POWER_OFF) { |
| + Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
| + UMA_ACCEL_SHUT_DOWN_POWER_BUTTON); |
| + delegate_->RequestShutdown(); |
|
bartfab (slow)
2014/12/08 16:49:44
Nit: If you return here, you can save yourself the
cschuet (SLOW)
2014/12/08 18:57:04
Done.
|
| + } else { |
| + Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
| + UMA_ACCEL_RESTART_POWER_BUTTON); |
| + delegate_->RequestRestart(); |
| + } |
| } |
| void LockStateController::StartCancellableShutdownAnimation() { |