Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: ash/wm/power_button_controller.cc

Issue 9110044: chromeos/aura: Handle power button on unofficial hardware. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: show background on shutdown and move gyp variable to a different scope Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/wm/power_button_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « no previous file | ash/wm/power_button_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698