Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/power/tablet_power_button_controller.h" | 5 #include "ash/system/power/tablet_power_button_controller.h" |
| 6 | 6 |
| 7 #include "ash/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
| 8 #include "ash/session/session_controller.h" | 8 #include "ash/session/session_controller.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 void TabletPowerButtonController::BrightnessChanged(int level, | 155 void TabletPowerButtonController::BrightnessChanged(int level, |
| 156 bool user_initiated) { | 156 bool user_initiated) { |
| 157 brightness_level_is_zero_ = level == 0; | 157 brightness_level_is_zero_ = level == 0; |
| 158 } | 158 } |
| 159 | 159 |
| 160 void TabletPowerButtonController::SuspendDone( | 160 void TabletPowerButtonController::SuspendDone( |
| 161 const base::TimeDelta& sleep_duration) { | 161 const base::TimeDelta& sleep_duration) { |
| 162 last_resume_time_ = tick_clock_->NowTicks(); | 162 last_resume_time_ = tick_clock_->NowTicks(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void TabletPowerButtonController::LidEventReceived( | |
| 166 chromeos::PowerManagerClient::LidState state, | |
| 167 const base::TimeTicks& timestamp) { | |
| 168 if (state == chromeos::PowerManagerClient::LidState::OPEN || | |
| 169 state == chromeos::PowerManagerClient::LidState::CLOSED) { | |
|
Daniel Erat
2017/04/13 04:31:16
you don't really need to test this; these are the
Qiang(Joe) Xu
2017/04/13 04:49:40
Done.
| |
| 170 SetDisplayForcedOff(false); | |
| 171 } | |
| 172 } | |
| 173 | |
| 165 void TabletPowerButtonController::OnMaximizeModeStarted() { | 174 void TabletPowerButtonController::OnMaximizeModeStarted() { |
| 166 shutdown_timer_.Stop(); | 175 shutdown_timer_.Stop(); |
| 167 if (controller_->CanCancelShutdownAnimation()) | 176 if (controller_->CanCancelShutdownAnimation()) |
| 168 controller_->CancelShutdownAnimation(); | 177 controller_->CancelShutdownAnimation(); |
| 169 } | 178 } |
| 170 | 179 |
| 171 void TabletPowerButtonController::OnMaximizeModeEnded() { | 180 void TabletPowerButtonController::OnMaximizeModeEnded() { |
| 172 shutdown_timer_.Stop(); | 181 shutdown_timer_.Stop(); |
| 173 if (controller_->CanCancelShutdownAnimation()) | 182 if (controller_->CanCancelShutdownAnimation()) |
| 174 controller_->CancelShutdownAnimation(); | 183 controller_->CancelShutdownAnimation(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 SessionController* session_controller = Shell::Get()->session_controller(); | 263 SessionController* session_controller = Shell::Get()->session_controller(); |
| 255 if (session_controller->ShouldLockScreenAutomatically() && | 264 if (session_controller->ShouldLockScreenAutomatically() && |
| 256 session_controller->CanLockScreen() && | 265 session_controller->CanLockScreen() && |
| 257 !session_controller->IsUserSessionBlocked() && | 266 !session_controller->IsUserSessionBlocked() && |
| 258 !controller_->LockRequested()) { | 267 !controller_->LockRequested()) { |
| 259 session_controller->LockScreen(); | 268 session_controller->LockScreen(); |
| 260 } | 269 } |
| 261 } | 270 } |
| 262 | 271 |
| 263 } // namespace ash | 272 } // namespace ash |
| OLD | NEW |