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 cdf37a793117fb182481dafa6f2c0c9d0ecefed3..d6271379d4114b88401be86a3cd142e410f84aa2 100644 |
--- a/chrome/browser/chromeos/accessibility/accessibility_manager.cc |
+++ b/chrome/browser/chromeos/accessibility/accessibility_manager.cc |
@@ -53,6 +53,7 @@ |
#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" |
#include "chrome/common/pref_names.h" |
#include "chrome/grit/browser_resources.h" |
+#include "chromeos/audio/audio_a11y_controller.h" |
#include "chromeos/audio/chromeos_sounds.h" |
#include "chromeos/login/login_state.h" |
#include "components/prefs/pref_member.h" |
@@ -400,6 +401,8 @@ AccessibilityManager::AccessibilityManager() |
autoclick_delay_pref_handler_(prefs::kAccessibilityAutoclickDelayMs), |
virtual_keyboard_pref_handler_( |
prefs::kAccessibilityVirtualKeyboardEnabled), |
+ mono_audio_pref_handler_( |
+ prefs::kAccessibilityMonoAudioEnabled), |
caret_highlight_pref_handler_(prefs::kAccessibilityCaretHighlightEnabled), |
cursor_highlight_pref_handler_( |
prefs::kAccessibilityCursorHighlightEnabled), |
@@ -413,6 +416,7 @@ AccessibilityManager::AccessibilityManager() |
autoclick_enabled_(false), |
autoclick_delay_ms_(ash::AutoclickController::kDefaultAutoclickDelayMs), |
virtual_keyboard_enabled_(false), |
+ mono_audio_enabled_(false), |
caret_highlight_enabled_(false), |
cursor_highlight_enabled_(false), |
focus_highlight_enabled_(false), |
@@ -491,7 +495,8 @@ bool AccessibilityManager::ShouldShowAccessibilityMenu() { |
pref_service->GetBoolean(prefs::kAccessibilityAutoclickEnabled) || |
pref_service->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu) || |
pref_service->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled) || |
- pref_service->GetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled)) |
+ pref_service->GetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled) || |
+ pref_service->GetBoolean(prefs::kAccessibilityMonoAudioEnabled)) |
return true; |
} |
return false; |
@@ -878,6 +883,40 @@ void AccessibilityManager::UpdateVirtualKeyboardFromPref() { |
NotifyAccessibilityStatusChanged(details); |
} |
+void AccessibilityManager::EnableMonoAudio(bool enabled) { |
+ if (!profile_) |
+ return; |
+ |
+ PrefService* pref_service = profile_->GetPrefs(); |
+ pref_service->SetBoolean(prefs::kAccessibilityMonoAudioEnabled, |
+ enabled); |
+ pref_service->CommitPendingWrite(); |
+} |
+ |
+bool AccessibilityManager::IsMonoAudioEnabled() { |
+ return mono_audio_enabled_; |
+} |
+ |
+void AccessibilityManager::UpdateMonoAudioFromPref() { |
+ if (!profile_) |
+ return; |
+ |
+ const bool enabled = profile_->GetPrefs()->GetBoolean( |
+ prefs::kAccessibilityMonoAudioEnabled); |
+ |
+ if (mono_audio_enabled_ == enabled) |
+ return; |
+ mono_audio_enabled_ = enabled; |
+ |
+ AccessibilityStatusEventDetails details( |
+ ACCESSIBILITY_TOGGLE_MONO_AUDIO, |
+ enabled, |
+ ui::A11Y_NOTIFICATION_NONE); |
+ NotifyAccessibilityStatusChanged(details); |
+ |
+ ash::Shell::GetInstance()->audio_a11y_controller()->SetOutputMono(enabled); |
+} |
+ |
void AccessibilityManager::SetCaretHighlightEnabled(bool enabled) { |
if (!profile_) |
return; |
@@ -1130,6 +1169,10 @@ void AccessibilityManager::SetProfile(Profile* profile) { |
base::Bind(&AccessibilityManager::UpdateVirtualKeyboardFromPref, |
base::Unretained(this))); |
pref_change_registrar_->Add( |
+ prefs::kAccessibilityMonoAudioEnabled, |
+ base::Bind(&AccessibilityManager::UpdateMonoAudioFromPref, |
+ base::Unretained(this))); |
+ pref_change_registrar_->Add( |
prefs::kAccessibilityCaretHighlightEnabled, |
base::Bind(&AccessibilityManager::UpdateCaretHighlightFromPref, |
base::Unretained(this))); |
@@ -1169,6 +1212,7 @@ void AccessibilityManager::SetProfile(Profile* profile) { |
autoclick_pref_handler_.HandleProfileChanged(profile_, profile); |
autoclick_delay_pref_handler_.HandleProfileChanged(profile_, profile); |
virtual_keyboard_pref_handler_.HandleProfileChanged(profile_, profile); |
+ mono_audio_pref_handler_.HandleProfileChanged(profile_, profile); |
caret_highlight_pref_handler_.HandleProfileChanged(profile_, profile); |
cursor_highlight_pref_handler_.HandleProfileChanged(profile_, profile); |
focus_highlight_pref_handler_.HandleProfileChanged(profile_, profile); |
@@ -1189,6 +1233,7 @@ void AccessibilityManager::SetProfile(Profile* profile) { |
UpdateAutoclickFromPref(); |
UpdateAutoclickDelayFromPref(); |
UpdateVirtualKeyboardFromPref(); |
+ UpdateMonoAudioFromPref(); |
UpdateCaretHighlightFromPref(); |
UpdateCursorHighlightFromPref(); |
UpdateFocusHighlightFromPref(); |