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

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: nits 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..91e19043a26349c1027e2a4d2e714286a14bc4ed 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -287,6 +287,9 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate {
msg = IDS_A11Y_ALERT_CAPS_OFF;
break;
case ash::A11Y_ALERT_SCREEN_ON:
+ // Enable automation manager when alert is screen-on, as it is
+ // previously disabled by alert screen-off.
+ SetAutomationManagerEnabled(profile, true);
msg = IDS_A11Y_ALERT_SCREEN_ON;
break;
case ash::A11Y_ALERT_SCREEN_OFF:
@@ -306,6 +309,10 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate {
if (msg) {
AutomationManagerAura::GetInstance()->HandleAlert(
profile, l10n_util::GetStringUTF8(msg));
+ // After handling the alert, if the alert is screen-off, we should
+ // disable automation manager to handle any following a11y events.
+ if (alert == ash::A11Y_ALERT_SCREEN_OFF)
+ SetAutomationManagerEnabled(profile, false);
}
}
}
@@ -339,6 +346,16 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate {
}
private:
+ void SetAutomationManagerEnabled(content::BrowserContext* context,
+ bool enabled) {
+ DCHECK(context);
+ AutomationManagerAura* manager = AutomationManagerAura::GetInstance();
+ if (enabled)
+ manager->Enable(context);
+ else
+ manager->Disable();
+ }
+
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