| Index: content/browser/renderer_host/media/audio_output_authorization_handler.cc
|
| diff --git a/content/browser/renderer_host/media/audio_output_authorization_handler.cc b/content/browser/renderer_host/media/audio_output_authorization_handler.cc
|
| index a2866d2557b708235ccbb01cc1a1d079f529070e..4d3e55c41f45b509ae2a1dee4d0c4ab64644ac1b 100644
|
| --- a/content/browser/renderer_host/media/audio_output_authorization_handler.cc
|
| +++ b/content/browser/renderer_host/media/audio_output_authorization_handler.cc
|
| @@ -74,8 +74,9 @@ void AudioOutputAuthorizationHandler::RequestDeviceAuthorization(
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
|
|
| if (!IsValidDeviceId(device_id)) {
|
| - cb.Run(media::OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND, false,
|
| - media::AudioParameters::UnavailableDeviceParams(), std::string());
|
| + std::move(cb).Run(media::OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND, false,
|
| + media::AudioParameters::UnavailableDeviceParams(),
|
| + std::string());
|
| return;
|
| }
|
|
|
| @@ -114,8 +115,9 @@ void AudioOutputAuthorizationHandler::RequestDeviceAuthorization(
|
| // Check security origin if nondefault device is requested.
|
| if (!MediaStreamManager::IsOriginAllowed(render_process_id_,
|
| security_origin)) {
|
| - cb.Run(media::OUTPUT_DEVICE_STATUS_ERROR_NOT_AUTHORIZED, false,
|
| - media::AudioParameters::UnavailableDeviceParams(), std::string());
|
| + std::move(cb).Run(media::OUTPUT_DEVICE_STATUS_ERROR_NOT_AUTHORIZED, false,
|
| + media::AudioParameters::UnavailableDeviceParams(),
|
| + std::string());
|
| bad_message::ReceivedBadMessage(render_process_id_,
|
| bad_message::AOAH_UNAUTHORIZED_URL);
|
| return;
|
| @@ -125,9 +127,9 @@ void AudioOutputAuthorizationHandler::RequestDeviceAuthorization(
|
| // nondefault devices.
|
| permission_checker_->CheckPermission(
|
| MEDIA_DEVICE_TYPE_AUDIO_OUTPUT, render_process_id_, render_frame_id,
|
| - base::Bind(&AudioOutputAuthorizationHandler::AccessChecked,
|
| - weak_factory_.GetWeakPtr(), std::move(cb), device_id,
|
| - security_origin));
|
| + base::BindOnce(&AudioOutputAuthorizationHandler::AccessChecked,
|
| + weak_factory_.GetWeakPtr(), std::move(cb), device_id,
|
| + security_origin));
|
| }
|
|
|
| void AudioOutputAuthorizationHandler::AccessChecked(
|
| @@ -138,8 +140,9 @@ void AudioOutputAuthorizationHandler::AccessChecked(
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
|
|
| if (!has_access) {
|
| - cb.Run(media::OUTPUT_DEVICE_STATUS_ERROR_NOT_AUTHORIZED, false,
|
| - media::AudioParameters::UnavailableDeviceParams(), std::string());
|
| + std::move(cb).Run(media::OUTPUT_DEVICE_STATUS_ERROR_NOT_AUTHORIZED, false,
|
| + media::AudioParameters::UnavailableDeviceParams(),
|
| + std::string());
|
| return;
|
| }
|
|
|
| @@ -148,15 +151,15 @@ void AudioOutputAuthorizationHandler::AccessChecked(
|
| if (media::AudioDeviceDescription::IsDefaultDevice(device_id)) {
|
| GetDeviceParameters(std::move(cb),
|
| media::AudioDeviceDescription::kDefaultDeviceId);
|
| - } else {
|
| - MediaDevicesManager::BoolDeviceTypes devices_to_enumerate;
|
| - devices_to_enumerate[MEDIA_DEVICE_TYPE_AUDIO_OUTPUT] = true;
|
| - media_stream_manager_->media_devices_manager()->EnumerateDevices(
|
| - devices_to_enumerate,
|
| - base::Bind(&AudioOutputAuthorizationHandler::TranslateDeviceID,
|
| - weak_factory_.GetWeakPtr(), std::move(cb), device_id,
|
| - security_origin));
|
| + return;
|
| }
|
| + MediaDevicesManager::BoolDeviceTypes devices_to_enumerate;
|
| + devices_to_enumerate[MEDIA_DEVICE_TYPE_AUDIO_OUTPUT] = true;
|
| + media_stream_manager_->media_devices_manager()->EnumerateDevices(
|
| + devices_to_enumerate,
|
| + base::Bind(&AudioOutputAuthorizationHandler::TranslateDeviceID,
|
| + weak_factory_.GetWeakPtr(), base::Passed(&cb), device_id,
|
| + security_origin));
|
| }
|
|
|
| void AudioOutputAuthorizationHandler::TranslateDeviceID(
|
| @@ -174,8 +177,9 @@ void AudioOutputAuthorizationHandler::TranslateDeviceID(
|
| return;
|
| }
|
| }
|
| - cb.Run(media::OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND, false,
|
| - media::AudioParameters::UnavailableDeviceParams(), std::string());
|
| + std::move(cb).Run(media::OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND, false,
|
| + media::AudioParameters::UnavailableDeviceParams(),
|
| + std::string());
|
| }
|
|
|
| void AudioOutputAuthorizationHandler::GetDeviceParameters(
|
| @@ -185,9 +189,9 @@ void AudioOutputAuthorizationHandler::GetDeviceParameters(
|
| DCHECK(!raw_device_id.empty());
|
| audio_system_->GetOutputStreamParameters(
|
| raw_device_id,
|
| - base::Bind(&AudioOutputAuthorizationHandler::DeviceParametersReceived,
|
| - weak_factory_.GetWeakPtr(), std::move(cb), false,
|
| - raw_device_id));
|
| + base::BindOnce(&AudioOutputAuthorizationHandler::DeviceParametersReceived,
|
| + weak_factory_.GetWeakPtr(), std::move(cb), false,
|
| + raw_device_id));
|
| }
|
|
|
| void AudioOutputAuthorizationHandler::DeviceParametersReceived(
|
| @@ -198,10 +202,11 @@ void AudioOutputAuthorizationHandler::DeviceParametersReceived(
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| DCHECK(!raw_device_id.empty());
|
|
|
| - cb.Run(media::OUTPUT_DEVICE_STATUS_OK, should_send_id,
|
| - output_params.IsValid() ? output_params
|
| - : TryToFixAudioParameters(output_params),
|
| - raw_device_id);
|
| + std::move(cb).Run(media::OUTPUT_DEVICE_STATUS_OK, should_send_id,
|
| + output_params.IsValid()
|
| + ? output_params
|
| + : TryToFixAudioParameters(output_params),
|
| + raw_device_id);
|
| }
|
|
|
| } // namespace content
|
|
|