OLD | NEW |
(Empty) | |
| 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/system/chromeos/audio/tray_audio_delegate_chromeos.h" |
| 6 |
| 7 #include "chromeos/audio/cras_audio_handler.h" |
| 8 #include "grit/ash_resources.h" |
| 9 #include "grit/ash_strings.h" |
| 10 |
| 11 using chromeos::CrasAudioHandler; |
| 12 |
| 13 namespace ash { |
| 14 namespace system { |
| 15 |
| 16 void TrayAudioDelegateChromeOs::AdjustOutputVolumeToAudibleLevel() { |
| 17 CrasAudioHandler::Get()->AdjustOutputVolumeToAudibleLevel(); |
| 18 } |
| 19 |
| 20 int TrayAudioDelegateChromeOs::GetOutputDefaultVolumeMuteLevel() { |
| 21 return CrasAudioHandler::Get()->GetOutputDefaultVolumeMuteThreshold(); |
| 22 } |
| 23 |
| 24 int TrayAudioDelegateChromeOs::GetOutputVolumeLevel() { |
| 25 return CrasAudioHandler::Get()->GetOutputVolumePercent(); |
| 26 } |
| 27 |
| 28 int TrayAudioDelegateChromeOs::GetActiveOutputDeviceIconId() { |
| 29 chromeos::AudioDevice device; |
| 30 if (!CrasAudioHandler::Get()->GetActiveOutputDevice(&device)) |
| 31 return kNoAudioDeviceIcon; |
| 32 |
| 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; |
| 43 } |
| 44 |
| 45 |
| 46 bool TrayAudioDelegateChromeOs::HasAlternativeSources() { |
| 47 CrasAudioHandler* audio_handler = CrasAudioHandler::Get(); |
| 48 return (audio_handler->has_alternative_output() || |
| 49 audio_handler->has_alternative_input()); |
| 50 } |
| 51 |
| 52 bool TrayAudioDelegateChromeOs::IsOutputAudioMuted() { |
| 53 return CrasAudioHandler::Get()->IsOutputMuted(); |
| 54 } |
| 55 |
| 56 void TrayAudioDelegateChromeOs::SetOutputAudioIsMuted(bool is_muted) { |
| 57 CrasAudioHandler::Get()->SetOutputMute(is_muted); |
| 58 } |
| 59 |
| 60 void TrayAudioDelegateChromeOs::SetOutputVolumeLevel(int level) { |
| 61 CrasAudioHandler::Get()->SetOutputVolumePercent(level); |
| 62 } |
| 63 |
| 64 } // namespace system |
| 65 } // namespace ash |
OLD | NEW |