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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/chromeos/audio/tray_audio_delegate_chromeos.cc
diff --git a/ash/system/chromeos/audio/tray_audio_delegate_chromeos.cc b/ash/system/chromeos/audio/tray_audio_delegate_chromeos.cc
new file mode 100644
index 0000000000000000000000000000000000000000..59f6ecfdf9af398eae82dfcc9328b67c1f2c8ed7
--- /dev/null
+++ b/ash/system/chromeos/audio/tray_audio_delegate_chromeos.cc
@@ -0,0 +1,65 @@
+// 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"
+#include "grit/ash_strings.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()->GetActiveOutputDevice(&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);
+}
+
+} // namespace system
+} // namespace ash
« 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