Home | History | Annotate | Download | only in audio
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "ash/audio/sounds.h"
      6 
      7 #include "ash/accessibility_delegate.h"
      8 #include "ash/ash_switches.h"
      9 #include "ash/shell.h"
     10 #include "base/command_line.h"
     11 
     12 using media::SoundsManager;
     13 
     14 namespace ash {
     15 
     16 bool PlaySystemSoundAlways(media::SoundsManager::SoundKey key) {
     17   return SoundsManager::Get()->Play(key);
     18 }
     19 
     20 bool PlaySystemSoundIfSpokenFeedback(SoundsManager::SoundKey key) {
     21   CommandLine* cl = CommandLine::ForCurrentProcess();
     22   if (cl->HasSwitch(switches::kAshEnableSystemSounds))
     23     return SoundsManager::Get()->Play(key);
     24 
     25   Shell* shell = Shell::GetInstance();
     26   if (!shell->accessibility_delegate()->IsSpokenFeedbackEnabled())
     27     return false;
     28   return SoundsManager::Get()->Play(key);
     29 }
     30 
     31 }  // namespace ash
     32