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

Side by Side Diff: ash/system/chromeos/power/tablet_power_button_controller.cc

Issue 2544073002: Resuming from suspend should stop backlights forced off if they are (Closed)
Patch Set: nits Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | ash/system/chromeos/power/tablet_power_button_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/system/chromeos/power/tablet_power_button_controller.h" 5 #include "ash/system/chromeos/power/tablet_power_button_controller.h"
6 6
7 #include "ash/common/accessibility_delegate.h" 7 #include "ash/common/accessibility_delegate.h"
8 #include "ash/common/session/session_state_delegate.h" 8 #include "ash/common/session/session_state_delegate.h"
9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void TabletPowerButtonController::OnPowerButtonEvent( 91 void TabletPowerButtonController::OnPowerButtonEvent(
92 bool down, 92 bool down,
93 const base::TimeTicks& timestamp) { 93 const base::TimeTicks& timestamp) {
94 // When the system resumes in response to the power button being pressed, 94 // When the system resumes in response to the power button being pressed,
95 // Chrome receives powerd's SuspendDone signal and notification that the 95 // Chrome receives powerd's SuspendDone signal and notification that the
96 // backlight has been turned back on before seeing the power button events 96 // backlight has been turned back on before seeing the power button events
97 // that woke the system. Ignore events just after resuming to ensure that we 97 // that woke the system. Ignore events just after resuming to ensure that we
98 // don't turn the screen off in response to the events. 98 // don't turn the screen off in response to the events.
99 if (timestamp - last_resume_time_ <= 99 if (timestamp - last_resume_time_ <=
100 base::TimeDelta::FromMilliseconds(kIgnorePowerButtonAfterResumeMs)) { 100 base::TimeDelta::FromMilliseconds(kIgnorePowerButtonAfterResumeMs)) {
101 // If backlights are forced off, stop forcing off because resuming system
102 // doesn't handle this.
103 if (down && backlights_forced_off_)
104 SetBacklightsForcedOff(false);
101 return; 105 return;
102 } 106 }
103 107
104 if (down) { 108 if (down) {
105 screen_off_when_power_button_down_ = brightness_level_is_zero_; 109 screen_off_when_power_button_down_ = brightness_level_is_zero_;
106 SetBacklightsForcedOff(false); 110 SetBacklightsForcedOff(false);
107 StartShutdownTimer(); 111 StartShutdownTimer();
108 } else { 112 } else {
109 if (shutdown_timer_.IsRunning()) { 113 if (shutdown_timer_.IsRunning()) {
110 shutdown_timer_.Stop(); 114 shutdown_timer_.Stop();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 WmShell::Get()->GetSessionStateDelegate(); 219 WmShell::Get()->GetSessionStateDelegate();
216 if (session_state_delegate->ShouldLockScreenAutomatically() && 220 if (session_state_delegate->ShouldLockScreenAutomatically() &&
217 session_state_delegate->CanLockScreen() && 221 session_state_delegate->CanLockScreen() &&
218 !session_state_delegate->IsUserSessionBlocked() && 222 !session_state_delegate->IsUserSessionBlocked() &&
219 !controller_->LockRequested()) { 223 !controller_->LockRequested()) {
220 session_state_delegate->LockScreen(); 224 session_state_delegate->LockScreen();
221 } 225 }
222 } 226 }
223 227
224 } // namespace ash 228 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/system/chromeos/power/tablet_power_button_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698