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