ProfilePolicyConnectorFactory: Refactoring from Profile to BrowserContext.
[chromium-blink-merge.git] / ash / system / chromeos / audio / tray_audio_delegate_chromeos.cc
blobfb1532fe37d177f9c42339ada7980d8f309fc7d2
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"
10 using chromeos::CrasAudioHandler;
12 namespace ash {
13 namespace system {
15 void TrayAudioDelegateChromeOs::AdjustOutputVolumeToAudibleLevel() {
16 CrasAudioHandler::Get()->AdjustOutputVolumeToAudibleLevel();
19 int TrayAudioDelegateChromeOs::GetOutputDefaultVolumeMuteLevel() {
20 return CrasAudioHandler::Get()->GetOutputDefaultVolumeMuteThreshold();
23 int TrayAudioDelegateChromeOs::GetOutputVolumeLevel() {
24 return CrasAudioHandler::Get()->GetOutputVolumePercent();
27 int TrayAudioDelegateChromeOs::GetActiveOutputDeviceIconId() {
28 chromeos::AudioDevice device;
29 if (!CrasAudioHandler::Get()->GetPrimaryActiveOutputDevice(&device))
30 return kNoAudioDeviceIcon;
32 if (device.type == chromeos::AUDIO_TYPE_HEADPHONE)
33 return IDR_AURA_UBER_TRAY_AUDIO_HEADPHONE;
34 else if (device.type == chromeos::AUDIO_TYPE_USB)
35 return IDR_AURA_UBER_TRAY_AUDIO_USB;
36 else if (device.type == chromeos::AUDIO_TYPE_BLUETOOTH)
37 return IDR_AURA_UBER_TRAY_AUDIO_BLUETOOTH;
38 else if (device.type == chromeos::AUDIO_TYPE_HDMI)
39 return IDR_AURA_UBER_TRAY_AUDIO_HDMI;
40 else
41 return kNoAudioDeviceIcon;
45 bool TrayAudioDelegateChromeOs::HasAlternativeSources() {
46 CrasAudioHandler* audio_handler = CrasAudioHandler::Get();
47 return (audio_handler->has_alternative_output() ||
48 audio_handler->has_alternative_input());
51 bool TrayAudioDelegateChromeOs::IsOutputAudioMuted() {
52 return CrasAudioHandler::Get()->IsOutputMuted();
55 void TrayAudioDelegateChromeOs::SetOutputAudioIsMuted(bool is_muted) {
56 CrasAudioHandler::Get()->SetOutputMute(is_muted);
59 void TrayAudioDelegateChromeOs::SetOutputVolumeLevel(int level) {
60 CrasAudioHandler::Get()->SetOutputVolumePercent(level);
63 void TrayAudioDelegateChromeOs::SetInternalSpeakerChannelMode(
64 AudioChannelMode mode) {
65 CrasAudioHandler::Get()->SwapInternalSpeakerLeftRightChannel(
66 mode == LEFT_RIGHT_SWAPPED);
69 } // namespace system
70 } // namespace ash