| OLD | NEW |
| 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 Loading... |
| 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 | |
| 137 int CrasAudioHandler::GetOutputVolumePercent() { | 133 int CrasAudioHandler::GetOutputVolumePercent() { |
| 138 return output_volume_; | 134 return output_volume_; |
| 139 } | 135 } |
| 140 | 136 |
| 141 int CrasAudioHandler::GetOutputVolumePercentForDevice(uint64 device_id) { | 137 int CrasAudioHandler::GetOutputVolumePercentForDevice(uint64 device_id) { |
| 142 if (device_id == active_output_node_id_) { | 138 if (device_id == active_output_node_id_) { |
| 143 return output_volume_; | 139 return output_volume_; |
| 144 } else { | 140 } else { |
| 145 const AudioDevice* device = GetDeviceFromId(device_id); | 141 const AudioDevice* device = GetDeviceFromId(device_id); |
| 146 return static_cast<int>(audio_pref_handler_->GetOutputVolumeValue(device)); | 142 return static_cast<int>(audio_pref_handler_->GetOutputVolumeValue(device)); |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 UpdateDevicesAndSwitchActive(node_list); | 689 UpdateDevicesAndSwitchActive(node_list); |
| 694 FOR_EACH_OBSERVER(AudioObserver, observers_, OnAudioNodesChanged()); | 690 FOR_EACH_OBSERVER(AudioObserver, observers_, OnAudioNodesChanged()); |
| 695 } | 691 } |
| 696 | 692 |
| 697 void CrasAudioHandler::HandleGetNodesError(const std::string& error_name, | 693 void CrasAudioHandler::HandleGetNodesError(const std::string& error_name, |
| 698 const std::string& error_msg) { | 694 const std::string& error_msg) { |
| 699 LOG_IF(ERROR, log_errors_) << "Failed to call GetNodes: " | 695 LOG_IF(ERROR, log_errors_) << "Failed to call GetNodes: " |
| 700 << error_name << ": " << error_msg; | 696 << error_name << ": " << error_msg; |
| 701 } | 697 } |
| 702 } // namespace chromeos | 698 } // namespace chromeos |
| OLD | NEW |