Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: ash/system/chromeos/audio/tray_audio_delegate_chromeos.cc

Issue 2113113002: mash: Move chromeos audio system tray files to //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
10 using chromeos::CrasAudioHandler;
11
12 namespace ash {
13 namespace system {
14
15 void TrayAudioDelegateChromeOs::AdjustOutputVolumeToAudibleLevel() {
16 CrasAudioHandler::Get()->AdjustOutputVolumeToAudibleLevel();
17 }
18
19 int TrayAudioDelegateChromeOs::GetOutputDefaultVolumeMuteLevel() {
20 return CrasAudioHandler::Get()->GetOutputDefaultVolumeMuteThreshold();
21 }
22
23 int TrayAudioDelegateChromeOs::GetOutputVolumeLevel() {
24 return CrasAudioHandler::Get()->GetOutputVolumePercent();
25 }
26
27 int TrayAudioDelegateChromeOs::GetActiveOutputDeviceIconId() {
28 chromeos::AudioDevice device;
29 if (!CrasAudioHandler::Get()->GetPrimaryActiveOutputDevice(&device))
30 return kNoAudioDeviceIcon;
31
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;
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
OLDNEW
« no previous file with comments | « ash/system/chromeos/audio/tray_audio_delegate_chromeos.h ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698