| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 return true; | 344 return true; |
| 345 } | 345 } |
| 346 | 346 |
| 347 AudioDeviceInfo AudioServiceImpl::ToAudioDeviceInfo( | 347 AudioDeviceInfo AudioServiceImpl::ToAudioDeviceInfo( |
| 348 const chromeos::AudioDevice& device) { | 348 const chromeos::AudioDevice& device) { |
| 349 AudioDeviceInfo info; | 349 AudioDeviceInfo info; |
| 350 info.id = base::Uint64ToString(device.id); | 350 info.id = base::Uint64ToString(device.id); |
| 351 info.stream_type = device.is_input | 351 info.stream_type = device.is_input |
| 352 ? extensions::api::audio::STREAM_TYPE_INPUT | 352 ? extensions::api::audio::STREAM_TYPE_INPUT |
| 353 : extensions::api::audio::STREAM_TYPE_OUTPUT; | 353 : extensions::api::audio::STREAM_TYPE_OUTPUT; |
| 354 info.is_input = device.is_input; | |
| 355 info.device_type = GetAsAudioApiDeviceType(device.type); | 354 info.device_type = GetAsAudioApiDeviceType(device.type); |
| 356 info.display_name = device.display_name; | 355 info.display_name = device.display_name; |
| 357 info.device_name = device.device_name; | 356 info.device_name = device.device_name; |
| 358 info.is_active = device.active; | 357 info.is_active = device.active; |
| 359 info.is_muted = device.is_input | |
| 360 ? cras_audio_handler_->IsInputMutedForDevice(device.id) | |
| 361 : cras_audio_handler_->IsOutputMutedForDevice(device.id); | |
| 362 info.level = | 358 info.level = |
| 363 device.is_input | 359 device.is_input |
| 364 ? cras_audio_handler_->GetOutputVolumePercentForDevice(device.id) | 360 ? cras_audio_handler_->GetOutputVolumePercentForDevice(device.id) |
| 365 : cras_audio_handler_->GetInputGainPercentForDevice(device.id); | 361 : cras_audio_handler_->GetInputGainPercentForDevice(device.id); |
| 366 info.stable_device_id.reset( | 362 info.stable_device_id.reset( |
| 367 new std::string(base::Uint64ToString(device.stable_device_id))); | 363 new std::string(base::Uint64ToString(device.stable_device_id))); |
| 368 | 364 |
| 369 return info; | 365 return info; |
| 370 } | 366 } |
| 371 | 367 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 // Notify DeviceChanged event for backward compatibility. | 433 // Notify DeviceChanged event for backward compatibility. |
| 438 // TODO(jennyz): remove this code when the old version of hotrod retires. | 434 // TODO(jennyz): remove this code when the old version of hotrod retires. |
| 439 NotifyDeviceChanged(); | 435 NotifyDeviceChanged(); |
| 440 } | 436 } |
| 441 | 437 |
| 442 AudioService* AudioService::CreateInstance() { | 438 AudioService* AudioService::CreateInstance() { |
| 443 return new AudioServiceImpl; | 439 return new AudioServiceImpl; |
| 444 } | 440 } |
| 445 | 441 |
| 446 } // namespace extensions | 442 } // namespace extensions |
| OLD | NEW |