Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Side by Side Diff: content/browser/renderer_host/media/media_stream_dispatcher_host.cc

Issue 312773002: Support for audio output devices for getMediaDevices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698