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

Unified Diff: chrome/browser/ui/ash/chrome_shell_delegate.cc

Issue 2676563003: ChromeVox: Disable following a11y events after screen off alert is received (Closed)
Patch Set: SetAutomationManagerEnabled Created 3 years, 10 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/chrome_shell_delegate.cc
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc
index 8eb1cba9e40d325810a6b7e0d54c1c394832878a..b54479c9ebbd84d4514dac678ea4da578deaf053 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -277,6 +277,7 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate {
void TriggerAccessibilityAlert(ash::AccessibilityAlert alert) override {
Profile* profile = ProfileManager::GetActiveUserProfile();
+ bool screen_off_alert = false;
if (profile) {
int msg = 0;
switch (alert) {
@@ -287,9 +288,11 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate {
msg = IDS_A11Y_ALERT_CAPS_OFF;
break;
case ash::A11Y_ALERT_SCREEN_ON:
+ SetAutomationManagerEnabled(profile, true);
msg = IDS_A11Y_ALERT_SCREEN_ON;
break;
case ash::A11Y_ALERT_SCREEN_OFF:
+ screen_off_alert = true;
msg = IDS_A11Y_ALERT_SCREEN_OFF;
break;
case ash::A11Y_ALERT_WINDOW_NEEDED:
@@ -306,6 +309,8 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate {
if (msg) {
AutomationManagerAura::GetInstance()->HandleAlert(
profile, l10n_util::GetStringUTF8(msg));
+ if (screen_off_alert)
James Cook 2017/02/04 00:00:38 Can you just check alert == ash::A11Y_ALERT_SCREEN
Qiang(Joe) Xu 2017/02/06 03:13:57 Done.
+ SetAutomationManagerEnabled(profile, false);
}
}
}
@@ -339,6 +344,12 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate {
}
private:
+ void SetAutomationManagerEnabled(content::BrowserContext* context,
+ bool enabled) {
+ AutomationManagerAura* manager = AutomationManagerAura::GetInstance();
James Cook 2017/02/04 00:00:38 optional: DCHECK(context); so the reader knows it
Qiang(Joe) Xu 2017/02/06 03:13:57 Done.
+ enabled ? manager->Enable(context) : manager->Disable();
James Cook 2017/02/04 00:00:38 Use if (enabled) not a trigraph.
Qiang(Joe) Xu 2017/02/06 03:13:57 Done.
+ }
+
DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl);
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698