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

Unified Diff: ash/wm/power_button_controller.cc

Issue 2507733004: Send screen on and off state as a11y alert (Closed)
Patch Set: Created 4 years, 1 month 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 | « ash/common/accessibility_types.h ('k') | chrome/app/generated_resources.grd » ('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 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(
« no previous file with comments | « ash/common/accessibility_types.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698