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

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

Issue 60193002: Revert 232766 "Refactor MediaStreamManager to never output real ..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1700/src/
Patch Set: Created 7 years, 1 month 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
Index: content/browser/renderer_host/media/device_request_message_filter.cc
===================================================================
--- content/browser/renderer_host/media/device_request_message_filter.cc (revision 232998)
+++ content/browser/renderer_host/media/device_request_message_filter.cc (working copy)
@@ -7,6 +7,7 @@
#include "content/browser/browser_main_loop.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/common/media/media_stream_messages.h"
+#include "content/public/browser/media_device_id.h"
#include "content/public/browser/resource_context.h"
// Clears the MediaStreamDevice.name from all devices in |device_list|.
@@ -95,12 +96,12 @@
if (label == request_it->audio_devices_label) {
request_it->has_audio_returned = true;
DCHECK(audio_devices->empty());
- *audio_devices = new_devices;
+ HmacDeviceIds(request_it->origin, new_devices, audio_devices);
} else {
DCHECK(label == request_it->video_devices_label);
request_it->has_video_returned = true;
DCHECK(video_devices->empty());
- *video_devices = new_devices;
+ HmacDeviceIds(request_it->origin, new_devices, video_devices);
}
if (!request_it->has_audio_returned || !request_it->has_video_returned) {
@@ -149,6 +150,23 @@
requests_.clear();
}
+void DeviceRequestMessageFilter::HmacDeviceIds(
+ const GURL& origin,
+ const StreamDeviceInfoArray& raw_devices,
+ StreamDeviceInfoArray* devices_with_guids) {
+ DCHECK(devices_with_guids);
+
+ // Replace raw ids with hmac'd ids before returning to renderer process.
+ for (StreamDeviceInfoArray::const_iterator device_itr = raw_devices.begin();
+ device_itr != raw_devices.end();
+ ++device_itr) {
+ StreamDeviceInfo current_device_info = *device_itr;
+ current_device_info.device.id =
+ content::GetHMACForMediaDeviceID(origin, device_itr->device.id);
+ devices_with_guids->push_back(current_device_info);
+ }
+}
+
void DeviceRequestMessageFilter::OnGetSources(int request_id,
const GURL& security_origin) {
// Make request to get audio devices.

Powered by Google App Engine
This is Rietveld 408576698