OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_stream_dispatcher_host.h" | 5 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" |
6 | 6 |
7 #include "content/browser/browser_main_loop.h" | 7 #include "content/browser/browser_main_loop.h" |
8 #include "content/browser/child_process_security_policy_impl.h" | 8 #include "content/browser/child_process_security_policy_impl.h" |
9 #include "content/common/media/media_stream_messages.h" | 9 #include "content/common/media/media_stream_messages.h" |
10 #include "content/common/media/media_stream_options.h" | 10 #include "content/common/media/media_stream_options.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 DVLOG(1) << "MediaStreamDispatcherHost::OnEnumerateDevices(" | 174 DVLOG(1) << "MediaStreamDispatcherHost::OnEnumerateDevices(" |
175 << render_view_id << ", " | 175 << render_view_id << ", " |
176 << page_request_id << ", " | 176 << page_request_id << ", " |
177 << type << ", " | 177 << type << ", " |
178 << security_origin.spec() << ")"; | 178 << security_origin.spec() << ")"; |
179 | 179 |
180 if (!IsURLAllowed(security_origin)) | 180 if (!IsURLAllowed(security_origin)) |
181 return; | 181 return; |
182 | 182 |
183 DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE || | 183 DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE || |
184 type == MEDIA_DEVICE_VIDEO_CAPTURE); | 184 type == MEDIA_DEVICE_VIDEO_CAPTURE || |
185 bool have_permission = type == MEDIA_DEVICE_AUDIO_CAPTURE ? | 185 type == MEDIA_DEVICE_AUDIO_OUTPUT); |
186 resource_context_->AllowMicAccess(security_origin) : | 186 bool have_permission = |
187 resource_context_->AllowCameraAccess(security_origin); | 187 type == MEDIA_DEVICE_AUDIO_CAPTURE || type == MEDIA_DEVICE_AUDIO_OUTPUT ? |
| 188 resource_context_->AllowMicAccess(security_origin) : |
| 189 resource_context_->AllowCameraAccess(security_origin); |
188 | 190 |
189 media_stream_manager_->EnumerateDevices( | 191 media_stream_manager_->EnumerateDevices( |
190 this, render_process_id_, render_view_id, salt_callback_, | 192 this, render_process_id_, render_view_id, salt_callback_, |
191 page_request_id, type, security_origin, have_permission); | 193 page_request_id, type, security_origin, have_permission); |
192 } | 194 } |
193 | 195 |
194 void MediaStreamDispatcherHost::OnCancelEnumerateDevices( | 196 void MediaStreamDispatcherHost::OnCancelEnumerateDevices( |
195 int render_view_id, | 197 int render_view_id, |
196 int page_request_id) { | 198 int page_request_id) { |
197 DVLOG(1) << "MediaStreamDispatcherHost::OnCancelEnumerateDevices(" | 199 DVLOG(1) << "MediaStreamDispatcherHost::OnCancelEnumerateDevices(" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( | 238 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( |
237 render_process_id_, url)) { | 239 render_process_id_, url)) { |
238 LOG(ERROR) << "MSDH: Renderer requested a URL it's not allowed to use."; | 240 LOG(ERROR) << "MSDH: Renderer requested a URL it's not allowed to use."; |
239 return false; | 241 return false; |
240 } | 242 } |
241 | 243 |
242 return true; | 244 return true; |
243 } | 245 } |
244 | 246 |
245 } // namespace content | 247 } // namespace content |
OLD | NEW |