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..ad5235ca14c3376fb99f6ea71dcb82b9946c46b7 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" |
@@ -58,6 +59,10 @@ namespace { |
static chromeos::AccessibilityManager* g_accessibility_manager = NULL; |
+namespace { |
+const int kChromeVoxUnloadDelaySeconds = 1; |
+} // namespace |
+ |
// Helper class that directly loads an extension's content scripts into |
// all of the frames corresponding to a given RenderViewHost. |
class ContentScriptLoader { |
@@ -272,8 +277,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 +392,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 +402,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 announce outgoing messages. |
+ content::BrowserThread::PostDelayedTask( |
+ content::BrowserThread::UI, |
+ FROM_HERE, |
+ base::Bind(&AccessibilityManager::UnloadChromeVox, |
+ base::Unretained(this)), |
+ base::TimeDelta::FromSeconds(kChromeVoxUnloadDelaySeconds)); |
+ } |
} |
void AccessibilityManager::LoadChromeVox() { |
@@ -710,6 +728,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. |