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

Unified Diff: content/browser/renderer_host/media/device_request_message_filter.cc

Issue 344653003: Revert 274608 "Implement getMediaDevices." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2057/src/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/media/device_request_message_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/device_request_message_filter.cc
===================================================================
--- content/browser/renderer_host/media/device_request_message_filter.cc (revision 278172)
+++ content/browser/renderer_host/media/device_request_message_filter.cc (working copy)
@@ -10,6 +10,15 @@
#include "content/common/media/media_stream_messages.h"
#include "content/public/browser/resource_context.h"
+// Clears the MediaStreamDevice.name from all devices in |device_list|.
+static void ClearDeviceLabels(content::StreamDeviceInfoArray* devices) {
+ for (content::StreamDeviceInfoArray::iterator device_itr = devices->begin();
+ device_itr != devices->end();
+ ++device_itr) {
+ device_itr->device.name.clear();
+ }
+}
+
namespace content {
DeviceRequestMessageFilter::DeviceRequestMessageFilter(
@@ -89,6 +98,12 @@
return;
}
+ // Query for mic and camera permissions.
+ if (!resource_context_->AllowMicAccess(request_it->origin))
+ ClearDeviceLabels(audio_devices);
+ if (!resource_context_->AllowCameraAccess(request_it->origin))
+ ClearDeviceLabels(video_devices);
+
// Both audio and video devices are ready for copying.
StreamDeviceInfoArray all_devices = *audio_devices;
all_devices.insert(
@@ -132,15 +147,13 @@
// Make request to get audio devices.
const std::string& audio_label = media_stream_manager_->EnumerateDevices(
this, -1, -1, resource_context_->GetMediaDeviceIDSalt(), -1,
- MEDIA_DEVICE_AUDIO_CAPTURE, security_origin,
- resource_context_->AllowMicAccess(security_origin));
+ MEDIA_DEVICE_AUDIO_CAPTURE, security_origin);
DCHECK(!audio_label.empty());
// Make request for video devices.
const std::string& video_label = media_stream_manager_->EnumerateDevices(
this, -1, -1, resource_context_->GetMediaDeviceIDSalt(), -1,
- MEDIA_DEVICE_VIDEO_CAPTURE, security_origin,
- resource_context_->AllowCameraAccess(security_origin));
+ MEDIA_DEVICE_VIDEO_CAPTURE, security_origin);
DCHECK(!video_label.empty());
requests_.push_back(DeviceRequest(
« no previous file with comments | « no previous file | content/browser/renderer_host/media/device_request_message_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698