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

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

Issue 165393013: Resubmit 'Refactor the TrayAudio code so that it can be used by other platforms.' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT Created 6 years, 10 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 #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
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