15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// found in the LICENSE file.
45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ash/audio/sounds.h"
65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ash/accessibility_delegate.h"
85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ash/ash_switches.h"
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ash/shell.h"
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/command_line.h"
115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)using media::SoundsManager;
135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace ash {
155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool PlaySystemSoundAlways(media::SoundsManager::SoundKey key) {
17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  return SoundsManager::Get()->Play(key);
18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)bool PlaySystemSoundIfSpokenFeedback(SoundsManager::SoundKey key) {
21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  CommandLine* cl = CommandLine::ForCurrentProcess();
22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  if (cl->HasSwitch(switches::kAshEnableSystemSounds))
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    return SoundsManager::Get()->Play(key);
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
25a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  Shell* shell = Shell::GetInstance();
26a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  if (!shell->accessibility_delegate()->IsSpokenFeedbackEnabled())
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    return false;
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  return SoundsManager::Get()->Play(key);
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}  // namespace ash
32