| 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 "extensions/browser/api/audio/audio_service.h" | 5 #include "extensions/browser/api/audio/audio_service.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "chromeos/audio/audio_device.h" | 10 #include "chromeos/audio/audio_device.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 void SetActiveDevices(const DeviceIdList& device_list) override; | 34 void SetActiveDevices(const DeviceIdList& device_list) override; |
| 35 bool SetDeviceProperties(const std::string& device_id, | 35 bool SetDeviceProperties(const std::string& device_id, |
| 36 bool muted, | 36 bool muted, |
| 37 int volume, | 37 int volume, |
| 38 int gain) override; | 38 int gain) override; |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 // chromeos::CrasAudioHandler::AudioObserver overrides. | 41 // chromeos::CrasAudioHandler::AudioObserver overrides. |
| 42 void OnOutputNodeVolumeChanged(uint64_t id, int volume) override; | 42 void OnOutputNodeVolumeChanged(uint64_t id, int volume) override; |
| 43 void OnInputNodeGainChanged(uint64_t id, int gain) override; | 43 void OnInputNodeGainChanged(uint64_t id, int gain) override; |
| 44 void OnOutputMuteChanged(bool mute_on) override; | 44 void OnOutputMuteChanged(bool mute_on, bool system_adjust) override; |
| 45 void OnInputMuteChanged(bool mute_on) override; | 45 void OnInputMuteChanged(bool mute_on) override; |
| 46 void OnAudioNodesChanged() override; | 46 void OnAudioNodesChanged() override; |
| 47 void OnActiveOutputNodeChanged() override; | 47 void OnActiveOutputNodeChanged() override; |
| 48 void OnActiveInputNodeChanged() override; | 48 void OnActiveInputNodeChanged() override; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 void NotifyDeviceChanged(); | 51 void NotifyDeviceChanged(); |
| 52 void NotifyLevelChanged(uint64_t id, int level); | 52 void NotifyLevelChanged(uint64_t id, int level); |
| 53 void NotifyMuteChanged(bool is_input, bool is_muted); | 53 void NotifyMuteChanged(bool is_input, bool is_muted); |
| 54 void NotifyDevicesChanged(); | 54 void NotifyDevicesChanged(); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 if (!base::StringToUint64(id_str, &device_id)) | 192 if (!base::StringToUint64(id_str, &device_id)) |
| 193 return 0; | 193 return 0; |
| 194 else | 194 else |
| 195 return device_id; | 195 return device_id; |
| 196 } | 196 } |
| 197 | 197 |
| 198 void AudioServiceImpl::OnOutputNodeVolumeChanged(uint64_t id, int volume) { | 198 void AudioServiceImpl::OnOutputNodeVolumeChanged(uint64_t id, int volume) { |
| 199 NotifyLevelChanged(id, volume); | 199 NotifyLevelChanged(id, volume); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void AudioServiceImpl::OnOutputMuteChanged(bool mute_on) { | 202 void AudioServiceImpl::OnOutputMuteChanged(bool mute_on, bool system_adjust) { |
| 203 NotifyMuteChanged(false, mute_on); | 203 NotifyMuteChanged(false, mute_on); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void AudioServiceImpl::OnInputNodeGainChanged(uint64_t id, int gain) { | 206 void AudioServiceImpl::OnInputNodeGainChanged(uint64_t id, int gain) { |
| 207 NotifyLevelChanged(id, gain); | 207 NotifyLevelChanged(id, gain); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void AudioServiceImpl::OnInputMuteChanged(bool mute_on) { | 210 void AudioServiceImpl::OnInputMuteChanged(bool mute_on) { |
| 211 NotifyMuteChanged(true, mute_on); | 211 NotifyMuteChanged(true, mute_on); |
| 212 } | 212 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // Notify DeviceChanged event for backward compatibility. | 281 // Notify DeviceChanged event for backward compatibility. |
| 282 // TODO(jennyz): remove this code when the old version of hotrod retires. | 282 // TODO(jennyz): remove this code when the old version of hotrod retires. |
| 283 NotifyDeviceChanged(); | 283 NotifyDeviceChanged(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 AudioService* AudioService::CreateInstance() { | 286 AudioService* AudioService::CreateInstance() { |
| 287 return new AudioServiceImpl; | 287 return new AudioServiceImpl; |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace extensions | 290 } // namespace extensions |
| OLD | NEW |