| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 if (backlights_forced_off_ == forced_off) | 214 if (backlights_forced_off_ == forced_off) |
| 215 return; | 215 return; |
| 216 | 216 |
| 217 // Set the display and keyboard backlights (if present) to |forced_off|. | 217 // Set the display and keyboard backlights (if present) to |forced_off|. |
| 218 chromeos::DBusThreadManager::Get() | 218 chromeos::DBusThreadManager::Get() |
| 219 ->GetPowerManagerClient() | 219 ->GetPowerManagerClient() |
| 220 ->SetBacklightsForcedOff(forced_off); | 220 ->SetBacklightsForcedOff(forced_off); |
| 221 backlights_forced_off_ = forced_off; | 221 backlights_forced_off_ = forced_off; |
| 222 UpdateTouchscreenStatus(); | 222 UpdateTouchscreenStatus(); |
| 223 | 223 |
| 224 if (backlights_forced_off_) |
| 225 Shell::Get()->shell_delegate()->SuspendMediaSessions(); |
| 226 |
| 224 // Send an a11y alert. | 227 // Send an a11y alert. |
| 225 Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( | 228 Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( |
| 226 forced_off ? A11Y_ALERT_SCREEN_OFF : A11Y_ALERT_SCREEN_ON); | 229 forced_off ? A11Y_ALERT_SCREEN_OFF : A11Y_ALERT_SCREEN_ON); |
| 227 } | 230 } |
| 228 | 231 |
| 229 void TabletPowerButtonController::GetInitialBacklightsForcedOff() { | 232 void TabletPowerButtonController::GetInitialBacklightsForcedOff() { |
| 230 chromeos::DBusThreadManager::Get() | 233 chromeos::DBusThreadManager::Get() |
| 231 ->GetPowerManagerClient() | 234 ->GetPowerManagerClient() |
| 232 ->GetBacklightsForcedOff(base::Bind( | 235 ->GetBacklightsForcedOff(base::Bind( |
| 233 &TabletPowerButtonController::OnGotInitialBacklightsForcedOff, | 236 &TabletPowerButtonController::OnGotInitialBacklightsForcedOff, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 263 SessionController* session_controller = Shell::Get()->session_controller(); | 266 SessionController* session_controller = Shell::Get()->session_controller(); |
| 264 if (session_controller->ShouldLockScreenAutomatically() && | 267 if (session_controller->ShouldLockScreenAutomatically() && |
| 265 session_controller->CanLockScreen() && | 268 session_controller->CanLockScreen() && |
| 266 !session_controller->IsUserSessionBlocked() && | 269 !session_controller->IsUserSessionBlocked() && |
| 267 !controller_->LockRequested()) { | 270 !controller_->LockRequested()) { |
| 268 session_controller->LockScreen(); | 271 session_controller->LockScreen(); |
| 269 } | 272 } |
| 270 } | 273 } |
| 271 | 274 |
| 272 } // namespace ash | 275 } // namespace ash |
| OLD | NEW |