| 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/common/system/chromeos/audio/tray_audio_delegate_chromeos.h" | |
| 6 | |
| 7 #include "ash/resources/vector_icons/vector_icons.h" | |
| 8 #include "chromeos/audio/cras_audio_handler.h" | |
| 9 #include "ui/gfx/paint_vector_icon.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 const gfx::VectorIcon& | |
| 29 TrayAudioDelegateChromeOs::GetActiveOutputDeviceVectorIcon() { | |
| 30 chromeos::AudioDevice device; | |
| 31 if (CrasAudioHandler::Get()->GetPrimaryActiveOutputDevice(&device)) { | |
| 32 if (device.type == chromeos::AUDIO_TYPE_HEADPHONE) | |
| 33 return kSystemMenuHeadsetIcon; | |
| 34 if (device.type == chromeos::AUDIO_TYPE_USB) | |
| 35 return kSystemMenuUsbIcon; | |
| 36 if (device.type == chromeos::AUDIO_TYPE_BLUETOOTH) | |
| 37 return kSystemMenuBluetoothIcon; | |
| 38 if (device.type == chromeos::AUDIO_TYPE_HDMI) | |
| 39 return kSystemMenuHdmiIcon; | |
| 40 } | |
| 41 return gfx::kNoneIcon; | |
| 42 } | |
| 43 | |
| 44 bool TrayAudioDelegateChromeOs::HasAlternativeSources() { | |
| 45 CrasAudioHandler* audio_handler = CrasAudioHandler::Get(); | |
| 46 return (audio_handler->has_alternative_output() || | |
| 47 audio_handler->has_alternative_input()); | |
| 48 } | |
| 49 | |
| 50 bool TrayAudioDelegateChromeOs::IsOutputAudioMuted() { | |
| 51 return CrasAudioHandler::Get()->IsOutputMuted(); | |
| 52 } | |
| 53 | |
| 54 void TrayAudioDelegateChromeOs::SetOutputAudioIsMuted(bool is_muted) { | |
| 55 CrasAudioHandler::Get()->SetOutputMute(is_muted); | |
| 56 } | |
| 57 | |
| 58 void TrayAudioDelegateChromeOs::SetOutputVolumeLevel(int level) { | |
| 59 CrasAudioHandler::Get()->SetOutputVolumePercent(level); | |
| 60 } | |
| 61 | |
| 62 void TrayAudioDelegateChromeOs::SetInternalSpeakerChannelMode( | |
| 63 AudioChannelMode mode) { | |
| 64 CrasAudioHandler::Get()->SwapInternalSpeakerLeftRightChannel( | |
| 65 mode == LEFT_RIGHT_SWAPPED); | |
| 66 } | |
| 67 | |
| 68 void TrayAudioDelegateChromeOs::SetActiveHDMIOutoutRediscoveringIfNecessary( | |
| 69 bool force_rediscovering) { | |
| 70 CrasAudioHandler::Get()->SetActiveHDMIOutoutRediscoveringIfNecessary( | |
| 71 force_rediscovering); | |
| 72 } | |
| 73 | |
| 74 } // namespace system | |
| 75 } // namespace ash | |
| OLD | NEW |