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 type == MEDIA_DEVICE_AUDIO_OUTPUT); | 185 bool have_permission = type == MEDIA_DEVICE_AUDIO_CAPTURE ? |
186 bool have_permission = | 186 resource_context_->AllowMicAccess(security_origin) : |
187 type == MEDIA_DEVICE_AUDIO_CAPTURE || type == MEDIA_DEVICE_AUDIO_OUTPUT ? | 187 resource_context_->AllowCameraAccess(security_origin); |
188 resource_context_->AllowMicAccess(security_origin) : | |
189 resource_context_->AllowCameraAccess(security_origin); | |
190 | 188 |
191 media_stream_manager_->EnumerateDevices( | 189 media_stream_manager_->EnumerateDevices( |
192 this, render_process_id_, render_view_id, salt_callback_, | 190 this, render_process_id_, render_view_id, salt_callback_, |
193 page_request_id, type, security_origin, have_permission); | 191 page_request_id, type, security_origin, have_permission); |
194 } | 192 } |
195 | 193 |
196 void MediaStreamDispatcherHost::OnCancelEnumerateDevices( | 194 void MediaStreamDispatcherHost::OnCancelEnumerateDevices( |
197 int render_view_id, | 195 int render_view_id, |
198 int page_request_id) { | 196 int page_request_id) { |
199 DVLOG(1) << "MediaStreamDispatcherHost::OnCancelEnumerateDevices(" | 197 DVLOG(1) << "MediaStreamDispatcherHost::OnCancelEnumerateDevices(" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( | 236 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( |
239 render_process_id_, url)) { | 237 render_process_id_, url)) { |
240 LOG(ERROR) << "MSDH: Renderer requested a URL it's not allowed to use."; | 238 LOG(ERROR) << "MSDH: Renderer requested a URL it's not allowed to use."; |
241 return false; | 239 return false; |
242 } | 240 } |
243 | 241 |
244 return true; | 242 return true; |
245 } | 243 } |
246 | 244 |
247 } // namespace content | 245 } // namespace content |
OLD | NEW |