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

Unified Diff: chrome/browser/chromeos/accessibility/accessibility_manager.cc

Issue 136633005: Turn back spoken feedback setting into a system-wide (non-per-user) preference (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
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 d5cd91ca77c9a4dfc8edf85da5cbe0490795434e..0d7b5a404d07e86e3d6349d946cce9c72f9bb432 100644
--- a/chrome/browser/chromeos/accessibility/accessibility_manager.cc
+++ b/chrome/browser/chromeos/accessibility/accessibility_manager.cc
@@ -291,7 +291,6 @@ AccessibilityManager::AccessibilityManager()
chrome_vox_loaded_on_lock_screen_(false),
chrome_vox_loaded_on_user_screen_(false),
large_cursor_pref_handler_(prefs::kLargeCursorEnabled),
- spoken_feedback_pref_handler_(prefs::kSpokenFeedbackEnabled),
high_contrast_pref_handler_(prefs::kHighContrastEnabled),
autoclick_pref_handler_(prefs::kAutoclickEnabled),
autoclick_delay_pref_handler_(prefs::kAutoclickDelayMs),
@@ -352,6 +351,13 @@ AccessibilityManager::~AccessibilityManager() {
}
bool AccessibilityManager::ShouldShowAccessibilityMenu() {
+ if (!g_browser_process)
+ return false;
+
+ PrefService* global_pref_service = g_browser_process->local_state();
+ if (global_pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled))
+ return true;
+
// If any of the loaded profiles has an accessibility feature turned on - or
// enforced to always show the menu - we return true to show the menu.
std::vector<Profile*> profiles =
@@ -362,7 +368,6 @@ bool AccessibilityManager::ShouldShowAccessibilityMenu() {
PrefService* pref_service = (*it)->GetPrefs();
if (pref_service->GetBoolean(prefs::kStickyKeysEnabled) ||
pref_service->GetBoolean(prefs::kLargeCursorEnabled) ||
- pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled) ||
pref_service->GetBoolean(prefs::kHighContrastEnabled) ||
pref_service->GetBoolean(prefs::kAutoclickEnabled) ||
pref_service->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu) ||
@@ -448,7 +453,7 @@ void AccessibilityManager::UpdateStickyKeysFromPref() {
void AccessibilityManager::EnableSpokenFeedback(
bool enabled,
ash::AccessibilityNotificationVisibility notify) {
- if (!profile_)
+ if (!g_browser_process)
return;
ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction(
@@ -457,20 +462,21 @@ void AccessibilityManager::EnableSpokenFeedback(
spoken_feedback_notification_ = notify;
- PrefService* pref_service = profile_->GetPrefs();
- pref_service->SetBoolean(
- prefs::kSpokenFeedbackEnabled, enabled);
- pref_service->CommitPendingWrite();
+ PrefService* global_pref_service = g_browser_process->local_state();
+ global_pref_service->SetBoolean(
+ prefs::kSpokenFeedbackEnabled, enabled);
+ global_pref_service->CommitPendingWrite();
spoken_feedback_notification_ = ash::A11Y_NOTIFICATION_NONE;
}
void AccessibilityManager::UpdateSpokenFeedbackFromPref() {
- if (!profile_)
+ if (!g_browser_process)
return;
+ PrefService* global_pref_service = g_browser_process->local_state();
const bool enabled =
- profile_->GetPrefs()->GetBoolean(prefs::kSpokenFeedbackEnabled);
+ global_pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled);
if (spoken_feedback_enabled_ == enabled)
return;
@@ -526,6 +532,9 @@ void AccessibilityManager::LoadChromeVoxToUserScreen() {
if (web_ui_login_view)
login_web_ui = web_ui_login_view->GetWebUI();
}
+
+ // Lock screen uses the signin progile.
+ chrome_vox_loaded_on_lock_screen_ = true;
}
LoadChromeVoxExtension(profile_, login_web_ui);
@@ -709,10 +718,6 @@ void AccessibilityManager::SetProfile(Profile* profile) {
base::Bind(&AccessibilityManager::UpdateStickyKeysFromPref,
base::Unretained(this)));
pref_change_registrar_->Add(
- prefs::kSpokenFeedbackEnabled,
- base::Bind(&AccessibilityManager::UpdateSpokenFeedbackFromPref,
- base::Unretained(this)));
- pref_change_registrar_->Add(
prefs::kHighContrastEnabled,
base::Bind(&AccessibilityManager::UpdateHighContrastFromPref,
base::Unretained(this)));
@@ -728,6 +733,10 @@ void AccessibilityManager::SetProfile(Profile* profile) {
local_state_pref_change_registrar_.reset(new PrefChangeRegistrar);
local_state_pref_change_registrar_->Init(g_browser_process->local_state());
local_state_pref_change_registrar_->Add(
+ prefs::kSpokenFeedbackEnabled,
+ base::Bind(&AccessibilityManager::UpdateSpokenFeedbackFromPref,
+ base::Unretained(this)));
+ local_state_pref_change_registrar_->Add(
prefs::kApplicationLocale,
base::Bind(&AccessibilityManager::LocalePrefChanged,
base::Unretained(this)));
@@ -739,7 +748,6 @@ void AccessibilityManager::SetProfile(Profile* profile) {
}
large_cursor_pref_handler_.HandleProfileChanged(profile_, profile);
- spoken_feedback_pref_handler_.HandleProfileChanged(profile_, profile);
high_contrast_pref_handler_.HandleProfileChanged(profile_, profile);
autoclick_pref_handler_.HandleProfileChanged(profile_, profile);
autoclick_delay_pref_handler_.HandleProfileChanged(profile_, profile);
@@ -868,12 +876,7 @@ void AccessibilityManager::Observe(
// this as well.
LoadChromeVoxToUserScreen();
} else {
- // Lock screen destroys its resources; no need for us to explicitly
- // unload ChromeVox.
- chrome_vox_loaded_on_lock_screen_ = false;
-
- // However, if spoken feedback was enabled, also enable it on the user
- // screen.
+ // If spoken feedback was enabled, also enable it on the user screen.
LoadChromeVoxToUserScreen();
}
}

Powered by Google App Engine
This is Rietveld 408576698