Chromium Code Reviews| 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); |