| 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 607b92db194b6f2053d0c3bba00f1c7223d1fa2f..ac2a71e24b8c6dfd343af0b42fef74d70d058517 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;
|
| @@ -126,9 +128,9 @@ void AudioOutputAuthorizationHandler::RequestDeviceAuthorization(
|
| permission_checker_->CheckPermission(
|
| MEDIA_DEVICE_TYPE_AUDIO_OUTPUT, render_process_id_, render_frame_id,
|
| security_origin,
|
| - 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(
|
| @@ -139,8 +141,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;
|
| }
|
|
|
| @@ -149,15 +152,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(
|
| @@ -175,8 +178,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(
|
| @@ -186,9 +190,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(
|
| @@ -199,10 +203,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
|
|
|