summaryrefslogtreecommitdiffstats
path: root/ash/audio/sounds.cc
blob: b377e35293634030e42a0013fe916e467fb1ec37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// 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 PlaySystemSoundAlways(media::SoundsManager::SoundKey key) {
  return SoundsManager::Get()->Play(key);
}

bool PlaySystemSoundIfSpokenFeedback(SoundsManager::SoundKey key) {
  base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
  if (cl->HasSwitch(switches::kAshEnableSystemSounds))
    return SoundsManager::Get()->Play(key);

  Shell* shell = Shell::GetInstance();
  if (!shell->accessibility_delegate()->IsSpokenFeedbackEnabled())
    return false;
  return SoundsManager::Get()->Play(key);
}

}  // namespace ash