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

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

Issue 323313003: Add flag in device enumeration request to control label clearing and don't clear for pepper. (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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 << render_view_id << ", " 163 << render_view_id << ", "
164 << device_id << ")"; 164 << device_id << ")";
165 media_stream_manager_->StopStreamDevice(render_process_id_, render_view_id, 165 media_stream_manager_->StopStreamDevice(render_process_id_, render_view_id,
166 device_id); 166 device_id);
167 } 167 }
168 168
169 void MediaStreamDispatcherHost::OnEnumerateDevices( 169 void MediaStreamDispatcherHost::OnEnumerateDevices(
170 int render_view_id, 170 int render_view_id,
171 int page_request_id, 171 int page_request_id,
172 MediaStreamType type, 172 MediaStreamType type,
173 const GURL& security_origin) { 173 const GURL& security_origin,
174 bool hide_labels_if_no_access) {
174 DVLOG(1) << "MediaStreamDispatcherHost::OnEnumerateDevices(" 175 DVLOG(1) << "MediaStreamDispatcherHost::OnEnumerateDevices("
175 << render_view_id << ", " 176 << render_view_id << ", "
176 << page_request_id << ", " 177 << page_request_id << ", "
177 << type << ", " 178 << type << ", "
178 << security_origin.spec() << ")"; 179 << security_origin.spec() << ")";
179 180
180 if (!IsURLAllowed(security_origin)) 181 if (!IsURLAllowed(security_origin))
181 return; 182 return;
182 183
183 DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE || 184 DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE ||
184 type == MEDIA_DEVICE_VIDEO_CAPTURE || 185 type == MEDIA_DEVICE_VIDEO_CAPTURE ||
185 type == MEDIA_DEVICE_AUDIO_OUTPUT); 186 type == MEDIA_DEVICE_AUDIO_OUTPUT);
186 bool have_permission = 187 bool have_permission = true;
187 type == MEDIA_DEVICE_AUDIO_CAPTURE || type == MEDIA_DEVICE_AUDIO_OUTPUT ? 188 if (hide_labels_if_no_access) {
188 resource_context_->AllowMicAccess(security_origin) : 189 bool audio_type = type == MEDIA_DEVICE_AUDIO_CAPTURE ||
189 resource_context_->AllowCameraAccess(security_origin); 190 type == MEDIA_DEVICE_AUDIO_OUTPUT;
191 have_permission = audio_type ?
192 resource_context_->AllowMicAccess(security_origin) :
193 resource_context_->AllowCameraAccess(security_origin);
194 }
190 195
191 media_stream_manager_->EnumerateDevices( 196 media_stream_manager_->EnumerateDevices(
192 this, render_process_id_, render_view_id, salt_callback_, 197 this, render_process_id_, render_view_id, salt_callback_,
193 page_request_id, type, security_origin, have_permission); 198 page_request_id, type, security_origin, have_permission);
194 } 199 }
195 200
196 void MediaStreamDispatcherHost::OnCancelEnumerateDevices( 201 void MediaStreamDispatcherHost::OnCancelEnumerateDevices(
197 int render_view_id, 202 int render_view_id,
198 int page_request_id) { 203 int page_request_id) {
199 DVLOG(1) << "MediaStreamDispatcherHost::OnCancelEnumerateDevices(" 204 DVLOG(1) << "MediaStreamDispatcherHost::OnCancelEnumerateDevices("
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( 243 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL(
239 render_process_id_, url)) { 244 render_process_id_, url)) {
240 LOG(ERROR) << "MSDH: Renderer requested a URL it's not allowed to use."; 245 LOG(ERROR) << "MSDH: Renderer requested a URL it's not allowed to use.";
241 return false; 246 return false;
242 } 247 }
243 248
244 return true; 249 return true;
245 } 250 }
246 251
247 } // namespace content 252 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698