Chromium Code Reviews| Index: ash/wm/power_button_controller.cc |
| diff --git a/ash/wm/power_button_controller.cc b/ash/wm/power_button_controller.cc |
| index 9ea85af9688d4384cadcfba8d1538db73de06d38..0b126de45e9781a9d431d77882770dbf6ce36b73 100644 |
| --- a/ash/wm/power_button_controller.cc |
| +++ b/ash/wm/power_button_controller.cc |
| @@ -5,6 +5,7 @@ |
| #include "ash/wm/power_button_controller.h" |
| #include "ash/common/accelerators/accelerator_controller.h" |
| +#include "ash/common/accessibility_delegate.h" |
| #include "ash/common/ash_switches.h" |
| #include "ash/common/session/session_state_delegate.h" |
| #include "ash/common/system/tray/system_tray.h" |
| @@ -65,7 +66,16 @@ PowerButtonController::~PowerButtonController() { |
| } |
| void PowerButtonController::OnScreenBrightnessChanged(double percent) { |
| - brightness_is_zero_ = percent <= 0.001; |
| + bool new_brightness_is_zero = percent <= 0.001; |
|
Daniel Erat
2016/11/16 22:08:46
is PowerButtonController the best place for this t
Qiang(Joe) Xu
2016/11/17 04:09:20
I did the investigation more on this and found the
|
| + |
| + // Send an a11y alert when there is a switch between screen on and off. |
| + AccessibilityDelegate* delegate = WmShell::Get()->accessibility_delegate(); |
| + if (brightness_is_zero_ && !new_brightness_is_zero) |
| + delegate->TriggerAccessibilityAlert(A11Y_ALERT_SCEEEN_ON); |
| + else if (!brightness_is_zero_ && new_brightness_is_zero) |
| + delegate->TriggerAccessibilityAlert(A11Y_ALERT_SCREEN_OFF); |
| + |
| + brightness_is_zero_ = new_brightness_is_zero; |
| } |
| void PowerButtonController::OnPowerButtonEvent( |