Index: ash/wm/power_button_controller.cc |
diff --git a/ash/wm/power_button_controller.cc b/ash/wm/power_button_controller.cc |
index 2c720dbc21652bd21e15b419de1309c2928e5508..f18c1e0d46efee0c68d0e3df721c0063f9793d8e 100644 |
--- a/ash/wm/power_button_controller.cc |
+++ b/ash/wm/power_button_controller.cc |
@@ -340,6 +340,7 @@ void PowerButtonController::OnLockStateChange(bool locked) { |
lock_timer_.Stop(); |
lock_fail_timer_.Stop(); |
+#if !defined(CHROMEOS_LEGACY_POWER_BUTTON) |
if (power_button_down_) { |
lock_to_shutdown_timer_.Stop(); |
lock_to_shutdown_timer_.Start( |
@@ -347,6 +348,7 @@ void PowerButtonController::OnLockStateChange(bool locked) { |
base::TimeDelta::FromMilliseconds(kLockToShutdownTimeoutMs), |
this, &PowerButtonController::OnLockToShutdownTimeout); |
} |
+#endif |
} else { |
StartAnimation(ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
ANIMATION_RESTORE); |
@@ -372,6 +374,21 @@ void PowerButtonController::OnPowerButtonEvent( |
if (shutting_down_) |
return; |
+#if defined(CHROMEOS_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) { |
+ ShowBackgroundLayer(); |
+ if (logged_in_as_non_guest_ && !locked_) { |
+ StartAnimation(ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ ANIMATION_SLOW_CLOSE); |
+ OnLockTimeout(); |
+ } else { |
+ OnShutdownTimeout(); |
+ } |
+ } |
+#else |
if (down) { |
// If we already have a pending request to lock the screen, wait. |
if (lock_fail_timer_.IsRunning()) |
@@ -401,6 +418,7 @@ void PowerButtonController::OnPowerButtonEvent( |
shutdown_timer_.Stop(); |
lock_to_shutdown_timer_.Stop(); |
} |
+#endif |
} |
void PowerButtonController::OnLockButtonEvent( |