diff options
author | ygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-15 08:22:45 +0000 |
---|---|---|
committer | ygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-15 08:22:45 +0000 |
commit | 4f011f1da4329fe52c9bc00a75b62cc546255083 (patch) | |
tree | a500fc2349f497e628a2b44250199e88920a3ed3 /ash/audio | |
parent | b0c8f2e4f91a41b13de3c03e788732b36ad27c93 (diff) | |
download | chromium_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/audio')
-rw-r--r-- | ash/audio/sounds.cc | 30 | ||||
-rw-r--r-- | ash/audio/sounds.h | 28 |
2 files changed, 58 insertions, 0 deletions
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_ |