| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/renderer_host/media/media_devices_dispatcher_host.h" | 5 #include "content/browser/renderer_host/media/media_devices_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 const url::Origin& security_origin, | 144 const url::Origin& security_origin, |
| 145 const EnumerateDevicesCallback& client_callback) { | 145 const EnumerateDevicesCallback& client_callback) { |
| 146 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 146 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 147 | 147 |
| 148 if (!request_audio_input && !request_video_input && !request_audio_output) { | 148 if (!request_audio_input && !request_video_input && !request_audio_output) { |
| 149 bad_message::ReceivedBadMessage( | 149 bad_message::ReceivedBadMessage( |
| 150 render_process_id_, bad_message::MDDH_INVALID_DEVICE_TYPE_REQUEST); | 150 render_process_id_, bad_message::MDDH_INVALID_DEVICE_TYPE_REQUEST); |
| 151 return; | 151 return; |
| 152 } | 152 } |
| 153 | 153 |
| 154 // Ignore requests from unique origins, but do not crash the renderer. | 154 // Ignore requests from opaque origins, but do not crash the renderer. |
| 155 if (security_origin.unique()) | 155 if (security_origin.opaque()) |
| 156 return; | 156 return; |
| 157 | 157 |
| 158 if (!MediaStreamManager::IsOriginAllowed(render_process_id_, | 158 if (!MediaStreamManager::IsOriginAllowed(render_process_id_, |
| 159 security_origin)) { | 159 security_origin)) { |
| 160 bad_message::ReceivedBadMessage(render_process_id_, | 160 bad_message::ReceivedBadMessage(render_process_id_, |
| 161 bad_message::MDDH_UNAUTHORIZED_ORIGIN); | 161 bad_message::MDDH_UNAUTHORIZED_ORIGIN); |
| 162 return; | 162 return; |
| 163 } | 163 } |
| 164 | 164 |
| 165 MediaDevicesManager::BoolDeviceTypes devices_to_enumerate; | 165 MediaDevicesManager::BoolDeviceTypes devices_to_enumerate; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 MEDIA_DEVICE_VIDEO_CAPTURE, device_id, &formats); | 411 MEDIA_DEVICE_VIDEO_CAPTURE, device_id, &formats); |
| 412 if (!formats.empty()) | 412 if (!formats.empty()) |
| 413 return formats; | 413 return formats; |
| 414 | 414 |
| 415 media_stream_manager_->video_capture_manager()->GetDeviceSupportedFormats( | 415 media_stream_manager_->video_capture_manager()->GetDeviceSupportedFormats( |
| 416 device_id, &formats); | 416 device_id, &formats); |
| 417 return formats; | 417 return formats; |
| 418 } | 418 } |
| 419 | 419 |
| 420 } // namespace content | 420 } // namespace content |
| OLD | NEW |