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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 info->is_active = devices[i].active; | 266 info->is_active = devices[i].active; |
267 info->is_muted = | 267 info->is_muted = |
268 devices[i].is_input | 268 devices[i].is_input |
269 ? cras_audio_handler_->IsInputMutedForDevice(devices[i].id) | 269 ? cras_audio_handler_->IsInputMutedForDevice(devices[i].id) |
270 : cras_audio_handler_->IsOutputMutedForDevice(devices[i].id); | 270 : cras_audio_handler_->IsOutputMutedForDevice(devices[i].id); |
271 info->level = | 271 info->level = |
272 devices[i].is_input | 272 devices[i].is_input |
273 ? cras_audio_handler_->GetOutputVolumePercentForDevice( | 273 ? cras_audio_handler_->GetOutputVolumePercentForDevice( |
274 devices[i].id) | 274 devices[i].id) |
275 : cras_audio_handler_->GetInputGainPercentForDevice(devices[i].id); | 275 : cras_audio_handler_->GetInputGainPercentForDevice(devices[i].id); |
276 // TODO(jennyz): Set stable_device_id once it is implemented. | 276 info->stable_device_id.reset( |
277 // See crbug.com/466768. | 277 new std::string(base::Uint64ToString(devices[i].stable_device_id))); |
278 | 278 |
279 devices_info_list.push_back(info); | 279 devices_info_list.push_back(info); |
280 } | 280 } |
281 | 281 |
282 FOR_EACH_OBSERVER(AudioService::Observer, observer_list_, | 282 FOR_EACH_OBSERVER(AudioService::Observer, observer_list_, |
283 OnDevicesChanged(devices_info_list)); | 283 OnDevicesChanged(devices_info_list)); |
284 | 284 |
285 // Notify DeviceChanged event for backward compatibility. | 285 // Notify DeviceChanged event for backward compatibility. |
286 // TODO(jennyz): remove this code when the old version of hotrod retires. | 286 // TODO(jennyz): remove this code when the old version of hotrod retires. |
287 NotifyDeviceChanged(); | 287 NotifyDeviceChanged(); |
288 } | 288 } |
289 | 289 |
290 AudioService* AudioService::CreateInstance() { | 290 AudioService* AudioService::CreateInstance() { |
291 return new AudioServiceImpl; | 291 return new AudioServiceImpl; |
292 } | 292 } |
293 | 293 |
294 } // namespace extensions | 294 } // namespace extensions |
OLD | NEW |