| 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.
|
|
|