Index: content/browser/renderer_host/media/device_request_message_filter.cc |
diff --git a/content/browser/renderer_host/media/device_request_message_filter.cc b/content/browser/renderer_host/media/device_request_message_filter.cc |
index fd26c6b23c5e2ace4f284579eb813ccaa8e59501..935d37dc2d7b9da6958bc9270a628f11a918f52e 100644 |
--- a/content/browser/renderer_host/media/device_request_message_filter.cc |
+++ b/content/browser/renderer_host/media/device_request_message_filter.cc |
@@ -10,7 +10,6 @@ |
#include "content/browser/renderer_host/media/media_stream_manager.h" |
#include "content/common/media/media_stream_messages.h" |
#include "content/public/browser/resource_context.h" |
-#include "crypto/hmac.h" |
// Clears the MediaStreamDevice.name from all devices in |device_list|. |
static void ClearDeviceLabels(content::StreamDeviceInfoArray* devices) { |
@@ -98,12 +97,12 @@ void DeviceRequestMessageFilter::DevicesEnumerated( |
if (label == request_it->audio_devices_label) { |
request_it->has_audio_returned = true; |
DCHECK(audio_devices->empty()); |
- HmacDeviceIds(request_it->origin, new_devices, audio_devices); |
+ *audio_devices = new_devices; |
} else { |
DCHECK(label == request_it->video_devices_label); |
request_it->has_video_returned = true; |
DCHECK(video_devices->empty()); |
- HmacDeviceIds(request_it->origin, new_devices, video_devices); |
+ *video_devices = new_devices; |
} |
if (!request_it->has_audio_returned || !request_it->has_video_returned) { |
@@ -152,46 +151,6 @@ void DeviceRequestMessageFilter::OnChannelClosing() { |
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) { |
- crypto::HMAC hmac(crypto::HMAC::SHA256); |
- const size_t digest_length = hmac.DigestLength(); |
- std::vector<uint8> digest(digest_length); |
- bool result = hmac.Init(origin.spec()) && |
- hmac.Sign(device_itr->device.id, &digest[0], digest.size()); |
- DCHECK(result); |
- if (result) { |
- StreamDeviceInfo current_device_info = *device_itr; |
- current_device_info.device.id = |
- StringToLowerASCII(base::HexEncode(&digest[0], digest.size())); |
- devices_with_guids->push_back(current_device_info); |
- } |
- } |
-} |
- |
-bool DeviceRequestMessageFilter::DoesRawIdMatchGuid( |
- const GURL& security_origin, |
- const std::string& device_guid, |
- const std::string& raw_device_id) { |
- crypto::HMAC hmac(crypto::HMAC::SHA256); |
- bool result = hmac.Init(security_origin.spec()); |
- DCHECK(result); |
- std::vector<uint8> converted_guid; |
- base::HexStringToBytes(device_guid, &converted_guid); |
- return hmac.Verify( |
- raw_device_id, |
- base::StringPiece(reinterpret_cast<const char*>(&converted_guid[0]), |
- converted_guid.size())); |
-} |
- |
void DeviceRequestMessageFilter::OnGetSources(int request_id, |
const GURL& security_origin) { |
// Make request to get audio devices. |