blob: fb1532fe37d177f9c42339ada7980d8f309fc7d2 (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// 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/system/chromeos/audio/tray_audio_delegate_chromeos.h"
#include "chromeos/audio/cras_audio_handler.h"
#include "grit/ash_resources.h"
using chromeos::CrasAudioHandler;
namespace ash {
namespace system {
void TrayAudioDelegateChromeOs::AdjustOutputVolumeToAudibleLevel() {
CrasAudioHandler::Get()->AdjustOutputVolumeToAudibleLevel();
}
int TrayAudioDelegateChromeOs::GetOutputDefaultVolumeMuteLevel() {
return CrasAudioHandler::Get()->GetOutputDefaultVolumeMuteThreshold();
}
int TrayAudioDelegateChromeOs::GetOutputVolumeLevel() {
return CrasAudioHandler::Get()->GetOutputVolumePercent();
}
int TrayAudioDelegateChromeOs::GetActiveOutputDeviceIconId() {
chromeos::AudioDevice device;
if (!CrasAudioHandler::Get()->GetPrimaryActiveOutputDevice(&device))
return kNoAudioDeviceIcon;
if (device.type == chromeos::AUDIO_TYPE_HEADPHONE)
return IDR_AURA_UBER_TRAY_AUDIO_HEADPHONE;
else if (device.type == chromeos::AUDIO_TYPE_USB)
return IDR_AURA_UBER_TRAY_AUDIO_USB;
else if (device.type == chromeos::AUDIO_TYPE_BLUETOOTH)
return IDR_AURA_UBER_TRAY_AUDIO_BLUETOOTH;
else if (device.type == chromeos::AUDIO_TYPE_HDMI)
return IDR_AURA_UBER_TRAY_AUDIO_HDMI;
else
return kNoAudioDeviceIcon;
}
bool TrayAudioDelegateChromeOs::HasAlternativeSources() {
CrasAudioHandler* audio_handler = CrasAudioHandler::Get();
return (audio_handler->has_alternative_output() ||
audio_handler->has_alternative_input());
}
bool TrayAudioDelegateChromeOs::IsOutputAudioMuted() {
return CrasAudioHandler::Get()->IsOutputMuted();
}
void TrayAudioDelegateChromeOs::SetOutputAudioIsMuted(bool is_muted) {
CrasAudioHandler::Get()->SetOutputMute(is_muted);
}
void TrayAudioDelegateChromeOs::SetOutputVolumeLevel(int level) {
CrasAudioHandler::Get()->SetOutputVolumePercent(level);
}
void TrayAudioDelegateChromeOs::SetInternalSpeakerChannelMode(
AudioChannelMode mode) {
CrasAudioHandler::Get()->SwapInternalSpeakerLeftRightChannel(
mode == LEFT_RIGHT_SWAPPED);
}
} // namespace system
} // namespace ash
|