Chromium Code Reviews| Index: chrome/browser/chromeos/accessibility/accessibility_manager.cc |
| diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.cc b/chrome/browser/chromeos/accessibility/accessibility_manager.cc |
| index 195c9c59170e8ca3017bc54b321cdcfe4ed527dd..33b80d4abd8afa3f7b392e011b876857a1021297 100644 |
| --- a/chrome/browser/chromeos/accessibility/accessibility_manager.cc |
| +++ b/chrome/browser/chromeos/accessibility/accessibility_manager.cc |
| @@ -36,6 +36,7 @@ |
| #include "chrome/common/pref_names.h" |
| #include "chromeos/login/login_state.h" |
| #include "content/public/browser/browser_accessibility_state.h" |
| +#include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/notification_details.h" |
| #include "content/public/browser/notification_service.h" |
| #include "content/public/browser/notification_source.h" |
| @@ -272,8 +273,8 @@ AccessibilityManager::AccessibilityManager() |
| spoken_feedback_enabled_(false), |
| high_contrast_enabled_(false), |
| autoclick_delay_ms_(ash::AutoclickController::kDefaultAutoclickDelayMs), |
| - spoken_feedback_notification_(ash::A11Y_NOTIFICATION_NONE) { |
| - |
| + spoken_feedback_notification_(ash::A11Y_NOTIFICATION_NONE), |
| + should_speak_chrome_vox_announcements_on_user_screen_(true) { |
| notification_registrar_.Add(this, |
| chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
| content::NotificationService::AllSources()); |
| @@ -387,10 +388,6 @@ void AccessibilityManager::UpdateSpokenFeedbackFromPref() { |
| spoken_feedback_enabled_ = enabled; |
| - Speak(l10n_util::GetStringUTF8( |
| - enabled ? IDS_CHROMEOS_ACC_SPOKEN_FEEDBACK_ENABLED : |
| - IDS_CHROMEOS_ACC_SPOKEN_FEEDBACK_DISABLED).c_str()); |
| - |
| ExtensionAccessibilityEventRouter::GetInstance()-> |
| SetAccessibilityEnabled(enabled); |
| @@ -401,10 +398,27 @@ void AccessibilityManager::UpdateSpokenFeedbackFromPref() { |
| content::NotificationService::AllSources(), |
| content::Details<AccessibilityStatusEventDetails>(&details)); |
| - if (enabled) |
| + if (enabled) { |
| LoadChromeVox(); |
| - else |
| - UnloadChromeVox(); |
| + ExtensionAccessibilityEventRouter::GetInstance()-> |
| + OnSpokenFeedbackEnabled(profile_, |
| + chrome_vox_loaded_on_lock_screen_ || |
| + should_speak_chrome_vox_announcements_on_user_screen_); |
| + |
| + should_speak_chrome_vox_announcements_on_user_screen_ = |
| + chrome_vox_loaded_on_lock_screen_; |
| + } else { |
| + ExtensionAccessibilityEventRouter::GetInstance()-> |
| + OnSpokenFeedbackDisabled(profile_); |
| + |
| + // Give ChromeVox a chance to speak/braille outgoing messages. |
|
dmazzoni
2013/10/25 23:09:16
How about "announce" instead of speak/braille
|
| + content::BrowserThread::PostDelayedTask( |
| + content::BrowserThread::UI, |
| + FROM_HERE, |
| + base::Bind(&AccessibilityManager::UnloadChromeVox, |
| + base::Unretained(this)), |
| + base::TimeDelta::FromSeconds(1)); |
|
dmazzoni
2013/10/25 23:09:16
I know it's trivial, but let's make 1 a named cons
|
| + } |
| } |
| void AccessibilityManager::LoadChromeVox() { |
| @@ -710,6 +724,9 @@ void AccessibilityManager::Observe( |
| case chrome::NOTIFICATION_SESSION_STARTED: |
| // Update |profile_| when entering a session. |
| SetProfile(ProfileManager::GetDefaultProfile()); |
| + |
| + // Ensure ChromeVox makes announcements at the start of new sessions. |
| + should_speak_chrome_vox_announcements_on_user_screen_ = true; |
| break; |
| case chrome::NOTIFICATION_PROFILE_DESTROYED: { |
| // Update |profile_| when exiting a session or shutting down. |