diff options
Diffstat (limited to 'ash')
-rw-r--r-- | ash/ash.gyp | 2 | ||||
-rw-r--r-- | ash/ash_switches.cc | 4 | ||||
-rw-r--r-- | ash/ash_switches.h | 1 | ||||
-rw-r--r-- | ash/audio/sounds.cc | 30 | ||||
-rw-r--r-- | ash/audio/sounds.h | 28 |
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_ |