Added flag that enables system sounds whether ChromeVox is enabled or not.

BUG=322820
TEST=manual tests on Lumpy

Review URL: https://codereview.chromium.org/105573008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244844 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.cc b/chrome/browser/chromeos/accessibility/accessibility_manager.cc
index d5cd91c..4b6e862f 100644
--- a/chrome/browser/chromeos/accessibility/accessibility_manager.cc
+++ b/chrome/browser/chromeos/accessibility/accessibility_manager.cc
@@ -4,6 +4,7 @@
 
 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
 
+#include "ash/audio/sounds.h"
 #include "ash/autoclick/autoclick_controller.h"
 #include "ash/high_contrast/high_contrast_controller.h"
 #include "ash/metrics/user_metrics_recorder.h"
@@ -548,7 +549,10 @@
 }
 
 void AccessibilityManager::UnloadChromeVox() {
-  PlaySound(SOUND_SPOKEN_FEEDBACK_DISABLED);
+  if (system_sounds_enabled_) {
+    ash::PlaySystemSound(SOUND_SPOKEN_FEEDBACK_DISABLED,
+                         false /* honor_spoken_feedback */);
+  }
   if (chrome_vox_loaded_on_lock_screen_)
     UnloadChromeVoxFromLockScreen();
 
@@ -777,12 +781,12 @@
 }
 
 base::TimeDelta AccessibilityManager::PlayShutdownSound() {
-  if (!IsSpokenFeedbackEnabled() || !system_sounds_enabled_)
+  if (!system_sounds_enabled_)
     return base::TimeDelta();
   system_sounds_enabled_ = false;
-  media::SoundsManager* manager = media::SoundsManager::Get();
-  manager->Play(SOUND_SHUTDOWN);
-  return manager->GetDuration(SOUND_SHUTDOWN);
+  if (!ash::PlaySystemSound(SOUND_SHUTDOWN, true /* honor_spoken_feedback */))
+    return base::TimeDelta();
+  return media::SoundsManager::Get()->GetDuration(SOUND_SHUTDOWN);
 }
 
 void AccessibilityManager::UpdateChromeOSAccessibilityHistograms() {
@@ -937,7 +941,10 @@
 
 void AccessibilityManager::SetUpPreLoadChromeVox(Profile* profile) {
   // Do any setup work needed immediately before ChromeVox actually loads.
-  PlaySound(SOUND_SPOKEN_FEEDBACK_ENABLED);
+  if (system_sounds_enabled_) {
+    ash::PlaySystemSound(SOUND_SPOKEN_FEEDBACK_ENABLED,
+                         false /* honor_spoken_feedback */);
+  }
 
   if (profile) {
     extensions::ExtensionSystem::Get(profile)->
@@ -957,8 +964,4 @@
   }
 }
 
-void AccessibilityManager::PlaySound(int sound_key) const {
-  media::SoundsManager::Get()->Play(sound_key);
-}
-
 }  // namespace chromeos