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

Unified Diff: content/public/browser/media_device_id.cc

Issue 1369723003: Do not hash default and communications media device ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « content/browser/renderer_host/media/audio_renderer_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/media_device_id.cc
diff --git a/content/public/browser/media_device_id.cc b/content/public/browser/media_device_id.cc
index aefe67af541c120d993ca14d657794ee1d4d9d92..0d4971dce42762c32f10e92be9219b783ed3bd43 100644
--- a/content/public/browser/media_device_id.cc
+++ b/content/public/browser/media_device_id.cc
@@ -12,9 +12,24 @@
namespace content {
+namespace {
+
+const char kDefaultDeviceId[] = "default";
tommi (sloooow) - chröme 2015/09/26 09:27:23 Can we use the constants from media/ instead? http
Guido Urdaneta 2015/09/26 09:48:58 I originally tried that, but, unfortunaetly, it is
tommi (sloooow) - chröme 2015/09/26 10:13:47 Ah right. I didn't realize we're in public/. Hmm.
+const char kCommunicationsDeviceId[] = "communications";
+
+bool IsDefaultMediaDeviceID(const std::string& source_id) {
+ return (source_id == kDefaultDeviceId) ||
tommi (sloooow) - chröme 2015/09/26 09:27:24 nit: () not necessary
Guido Urdaneta 2015/09/26 09:48:58 Done.
+ (source_id == kCommunicationsDeviceId);
+}
+
+} // namespace
+
std::string GetHMACForMediaDeviceID(const ResourceContext::SaltCallback& sc,
const GURL& security_origin,
const std::string& raw_unique_id) {
+ if (IsDefaultMediaDeviceID(raw_unique_id))
+ return raw_unique_id;
+
DCHECK(security_origin.is_valid());
DCHECK(!raw_unique_id.empty());
crypto::HMAC hmac(crypto::HMAC::SHA256);
« no previous file with comments | « content/browser/renderer_host/media/audio_renderer_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698