| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 const url::Origin& security_origin, | 110 const url::Origin& security_origin, |
| 111 const EnumerateDevicesCallback& client_callback) { | 111 const EnumerateDevicesCallback& client_callback) { |
| 112 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 112 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 113 | 113 |
| 114 if (!request_audio_input && !request_video_input && !request_audio_output) { | 114 if (!request_audio_input && !request_video_input && !request_audio_output) { |
| 115 bad_message::ReceivedBadMessage( | 115 bad_message::ReceivedBadMessage( |
| 116 render_process_id_, bad_message::MDDH_INVALID_DEVICE_TYPE_REQUEST); | 116 render_process_id_, bad_message::MDDH_INVALID_DEVICE_TYPE_REQUEST); |
| 117 return; | 117 return; |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Ignore requests from unique origins, but do not crash the renderer. |
| 121 if (security_origin.unique()) |
| 122 return; |
| 123 |
| 120 if (!MediaStreamManager::IsOriginAllowed(render_process_id_, | 124 if (!MediaStreamManager::IsOriginAllowed(render_process_id_, |
| 121 security_origin)) { | 125 security_origin)) { |
| 122 bad_message::ReceivedBadMessage(render_process_id_, | 126 bad_message::ReceivedBadMessage(render_process_id_, |
| 123 bad_message::MDDH_UNAUTHORIZED_ORIGIN); | 127 bad_message::MDDH_UNAUTHORIZED_ORIGIN); |
| 124 return; | 128 return; |
| 125 } | 129 } |
| 126 | 130 |
| 127 MediaDevicesManager::BoolDeviceTypes devices_to_enumerate; | 131 MediaDevicesManager::BoolDeviceTypes devices_to_enumerate; |
| 128 devices_to_enumerate[MEDIA_DEVICE_TYPE_AUDIO_INPUT] = request_audio_input; | 132 devices_to_enumerate[MEDIA_DEVICE_TYPE_AUDIO_INPUT] = request_audio_input; |
| 129 devices_to_enumerate[MEDIA_DEVICE_TYPE_VIDEO_INPUT] = request_video_input; | 133 devices_to_enumerate[MEDIA_DEVICE_TYPE_VIDEO_INPUT] = request_video_input; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 for (const auto& device_info : enumeration[i]) { | 285 for (const auto& device_info : enumeration[i]) { |
| 282 result[i].push_back(TranslateDeviceInfo(has_permissions[i], | 286 result[i].push_back(TranslateDeviceInfo(has_permissions[i], |
| 283 device_id_salt_, group_id_salt_, | 287 device_id_salt_, group_id_salt_, |
| 284 security_origin, device_info)); | 288 security_origin, device_info)); |
| 285 } | 289 } |
| 286 } | 290 } |
| 287 client_callback.Run(result); | 291 client_callback.Run(result); |
| 288 } | 292 } |
| 289 | 293 |
| 290 } // namespace content | 294 } // namespace content |
| OLD | NEW |