summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-15 08:22:45 +0000
committerygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-15 08:22:45 +0000
commit4f011f1da4329fe52c9bc00a75b62cc546255083 (patch)
treea500fc2349f497e628a2b44250199e88920a3ed3 /ash
parentb0c8f2e4f91a41b13de3c03e788732b36ad27c93 (diff)
downloadchromium_src-4f011f1da4329fe52c9bc00a75b62cc546255083.zip
chromium_src-4f011f1da4329fe52c9bc00a75b62cc546255083.tar.gz
chromium_src-4f011f1da4329fe52c9bc00a75b62cc546255083.tar.bz2
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
Diffstat (limited to 'ash')
-rw-r--r--ash/ash.gyp2
-rw-r--r--ash/ash_switches.cc4
-rw-r--r--ash/ash_switches.h1
-rw-r--r--ash/audio/sounds.cc30
-rw-r--r--ash/audio/sounds.h28
5 files changed, 65 insertions, 0 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 4da728f..f18b68f 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -70,6 +70,8 @@
'accelerators/nested_dispatcher_controller.cc',
'accelerators/nested_dispatcher_controller.h',
'accessibility_delegate.h',
+ 'audio/sounds.cc',
+ 'audio/sounds.h',
'autoclick/autoclick_controller.cc',
'autoclick/autoclick_controller.h',
'ash_constants.cc',
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index 6f369b6..37b26fb 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -133,6 +133,10 @@ const char kAshEnableSoftwareMirroring[] = "ash-enable-software-mirroring";
// Enables "sticky" edges instead of "snap-to-edge"
const char kAshEnableStickyEdges[] = "ash-enable-sticky-edges";
+// When this flag is set, system sounds will be played whether the
+// ChromeVox is enabled or not.
+const char kAshEnableSystemSounds[] = "ash-enable-system-sounds";
+
// Enables showing the tray bubble by dragging on the shelf.
const char kAshEnableTrayDragging[] = "ash-enable-tray-dragging";
diff --git a/ash/ash_switches.h b/ash/ash_switches.h
index 161d72c..0783e0f 100644
--- a/ash/ash_switches.h
+++ b/ash/ash_switches.h
@@ -56,6 +56,7 @@ ASH_EXPORT extern const char kAshEnableMultiUserTray[];
ASH_EXPORT extern const char kAshEnableOak[];
ASH_EXPORT extern const char kAshEnableSoftwareMirroring[];
ASH_EXPORT extern const char kAshEnableStickyEdges[];
+ASH_EXPORT extern const char kAshEnableSystemSounds[];
ASH_EXPORT extern const char kAshEnableTrayDragging[];
ASH_EXPORT extern const char kAshForceMirrorMode[];
ASH_EXPORT extern const char kAshGuestWallpaperLarge[];
diff --git a/ash/audio/sounds.cc b/ash/audio/sounds.cc
new file mode 100644
index 0000000..dd521b7
--- /dev/null
+++ b/ash/audio/sounds.cc
@@ -0,0 +1,30 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/audio/sounds.h"
+
+#include "ash/accessibility_delegate.h"
+#include "ash/ash_switches.h"
+#include "ash/shell.h"
+#include "base/command_line.h"
+
+using media::SoundsManager;
+
+namespace ash {
+
+bool PlaySystemSound(SoundsManager::SoundKey key, bool honor_spoken_feedback) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAshEnableSystemSounds)) {
+ return SoundsManager::Get()->Play(key);
+ }
+
+ if (honor_spoken_feedback &&
+ !Shell::GetInstance()->accessibility_delegate()->
+ IsSpokenFeedbackEnabled()) {
+ return false;
+ }
+ return SoundsManager::Get()->Play(key);
+}
+
+} // namespace ash
diff --git a/ash/audio/sounds.h b/ash/audio/sounds.h
new file mode 100644
index 0000000..6c641c0
--- /dev/null
+++ b/ash/audio/sounds.h
@@ -0,0 +1,28 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_AUDIO_SOUNDS_H_
+#define ASH_AUDIO_SOUNDS_H_
+
+#include "ash/ash_export.h"
+#include "media/audio/sounds/sounds_manager.h"
+
+namespace ash {
+
+// A wrapper around media::SoundsManager::Play() method, which plays
+// sound identified by |key| iff at least one of the following
+// conditions is true:
+// * ash::switches::kAshEnableSystemSounds flag is set
+// * |honor_spoken_feedback| is true and spoken feedback is enabled
+// * ash::switches::kAshEnableSystemSounds is not set and
+// |honor_spoken_feedback| is false
+//
+// Currently the latter case is applied for startup sound at OOBE screen
+// and ChromeVox enable/disable sounds.
+ASH_EXPORT bool PlaySystemSound(media::SoundsManager::SoundKey key,
+ bool honor_spoken_feedback);
+
+} // namespace ash
+
+#endif // ASH_AUDIO_SOUNDS_H_