Chromium Code Reviews| 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..7a7cff97bf8db0da79c96a79b4f4a6f6cb66f311 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) { |
| + AutomationManagerAura* manager = AutomationManagerAura::GetInstance(); |
| + DCHECK(context); |
|
James Cook
2017/02/06 16:38:45
super nit: Do this as the first line of the functi
|
| + if (enabled) |
| + manager->Enable(context); |
| + else |
| + manager->Disable(); |
| + } |
| + |
| DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl); |
| }; |