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

Side by Side Diff: chromeos/audio/cras_audio_handler.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
« no previous file with comments | « chromeos/audio/cras_audio_handler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/audio/cras_audio_handler.h" 5 #include "chromeos/audio/cras_audio_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return input_mute_on_; 123 return input_mute_on_;
124 } 124 }
125 125
126 bool CrasAudioHandler::IsInputMutedForDevice(uint64 device_id) { 126 bool CrasAudioHandler::IsInputMutedForDevice(uint64 device_id) {
127 const AudioDevice* device = GetDeviceFromId(device_id); 127 const AudioDevice* device = GetDeviceFromId(device_id);
128 if (!device) 128 if (!device)
129 return false; 129 return false;
130 return audio_pref_handler_->GetMuteValue(*device); 130 return audio_pref_handler_->GetMuteValue(*device);
131 } 131 }
132 132
133 int CrasAudioHandler::GetOutputDefaultVolumeMuteThreshold() {
134 return kMuteThresholdPercent;
135 }
136
133 int CrasAudioHandler::GetOutputVolumePercent() { 137 int CrasAudioHandler::GetOutputVolumePercent() {
134 return output_volume_; 138 return output_volume_;
135 } 139 }
136 140
137 int CrasAudioHandler::GetOutputVolumePercentForDevice(uint64 device_id) { 141 int CrasAudioHandler::GetOutputVolumePercentForDevice(uint64 device_id) {
138 if (device_id == active_output_node_id_) { 142 if (device_id == active_output_node_id_) {
139 return output_volume_; 143 return output_volume_;
140 } else { 144 } else {
141 const AudioDevice* device = GetDeviceFromId(device_id); 145 const AudioDevice* device = GetDeviceFromId(device_id);
142 return static_cast<int>(audio_pref_handler_->GetOutputVolumeValue(device)); 146 return static_cast<int>(audio_pref_handler_->GetOutputVolumeValue(device));
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 UpdateDevicesAndSwitchActive(node_list); 693 UpdateDevicesAndSwitchActive(node_list);
690 FOR_EACH_OBSERVER(AudioObserver, observers_, OnAudioNodesChanged()); 694 FOR_EACH_OBSERVER(AudioObserver, observers_, OnAudioNodesChanged());
691 } 695 }
692 696
693 void CrasAudioHandler::HandleGetNodesError(const std::string& error_name, 697 void CrasAudioHandler::HandleGetNodesError(const std::string& error_name,
694 const std::string& error_msg) { 698 const std::string& error_msg) {
695 LOG_IF(ERROR, log_errors_) << "Failed to call GetNodes: " 699 LOG_IF(ERROR, log_errors_) << "Failed to call GetNodes: "
696 << error_name << ": " << error_msg; 700 << error_name << ": " << error_msg;
697 } 701 }
698 } // namespace chromeos 702 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/audio/cras_audio_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698