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..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); |
| }; |