Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ash / system / chromeos / audio / tray_audio_delegate_chromeos.cc
blob59f6ecfdf9af398eae82dfcc9328b67c1f2c8ed7
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.
5 #include "ash/system/chromeos/audio/tray_audio_delegate_chromeos.h"
7 #include "chromeos/audio/cras_audio_handler.h"
8 #include "grit/ash_resources.h"
9 #include "grit/ash_strings.h"
11 using chromeos::CrasAudioHandler;
13 namespace ash {
14 namespace system {
16 void TrayAudioDelegateChromeOs::AdjustOutputVolumeToAudibleLevel() {
17 CrasAudioHandler::Get()->AdjustOutputVolumeToAudibleLevel();
20 int TrayAudioDelegateChromeOs::GetOutputDefaultVolumeMuteLevel() {
21 return CrasAudioHandler::Get()->GetOutputDefaultVolumeMuteThreshold();
24 int TrayAudioDelegateChromeOs::GetOutputVolumeLevel() {
25 return CrasAudioHandler::Get()->GetOutputVolumePercent();
28 int TrayAudioDelegateChromeOs::GetActiveOutputDeviceIconId() {
29 chromeos::AudioDevice device;
30 if (!CrasAudioHandler::Get()->GetActiveOutputDevice(&device))
31 return kNoAudioDeviceIcon;
33 if (device.type == chromeos::AUDIO_TYPE_HEADPHONE)
34 return IDR_AURA_UBER_TRAY_AUDIO_HEADPHONE;
35 else if (device.type == chromeos::AUDIO_TYPE_USB)
36 return IDR_AURA_UBER_TRAY_AUDIO_USB;
37 else if (device.type == chromeos::AUDIO_TYPE_BLUETOOTH)
38 return IDR_AURA_UBER_TRAY_AUDIO_BLUETOOTH;
39 else if (device.type == chromeos::AUDIO_TYPE_HDMI)
40 return IDR_AURA_UBER_TRAY_AUDIO_HDMI;
41 else
42 return kNoAudioDeviceIcon;
46 bool TrayAudioDelegateChromeOs::HasAlternativeSources() {
47 CrasAudioHandler* audio_handler = CrasAudioHandler::Get();
48 return (audio_handler->has_alternative_output() ||
49 audio_handler->has_alternative_input());
52 bool TrayAudioDelegateChromeOs::IsOutputAudioMuted() {
53 return CrasAudioHandler::Get()->IsOutputMuted();
56 void TrayAudioDelegateChromeOs::SetOutputAudioIsMuted(bool is_muted) {
57 CrasAudioHandler::Get()->SetOutputMute(is_muted);
60 void TrayAudioDelegateChromeOs::SetOutputVolumeLevel(int level) {
61 CrasAudioHandler::Get()->SetOutputVolumePercent(level);
64 } // namespace system
65 } // namespace ash