| Index: content/browser/resource_context_impl.cc
|
| diff --git a/content/browser/resource_context_impl.cc b/content/browser/resource_context_impl.cc
|
| index e7aa29b9570d5706018be8032db33507b15392f9..f09ac807f7834fdd03d080643cbb5a5aab4e02fe 100644
|
| --- a/content/browser/resource_context_impl.cc
|
| +++ b/content/browser/resource_context_impl.cc
|
| @@ -6,9 +6,13 @@
|
|
|
| #include <stdint.h>
|
|
|
| +#include <string>
|
| +
|
| +#include "base/base64.h"
|
| #include "base/bind.h"
|
| #include "base/logging.h"
|
| #include "base/memory/ptr_util.h"
|
| +#include "base/rand_util.h"
|
| #include "content/browser/blob_storage/chrome_blob_storage_context.h"
|
| #include "content/browser/loader/resource_dispatcher_host_impl.h"
|
| #include "content/browser/loader/resource_request_info_impl.h"
|
| @@ -30,15 +34,14 @@ const char kBlobStorageContextKeyName[] = "content_blob_storage_context";
|
| const char kStreamContextKeyName[] = "content_stream_context";
|
| const char kURLDataManagerBackendKeyName[] = "url_data_manager_backend";
|
|
|
| -// Used by the default implementation of GetMediaDeviceIDSalt, below.
|
| -std::string ReturnEmptySalt() {
|
| - return std::string();
|
| +std::string GetSalt(const std::string& salt) {
|
| + return salt;
|
| }
|
|
|
| } // namespace
|
|
|
| -
|
| -ResourceContext::ResourceContext() {
|
| +ResourceContext::ResourceContext()
|
| + : media_device_id_salt_(CreateRandomMediaDeviceIDSalt()) {
|
| ResourceDispatcherHostImpl* rdhi = ResourceDispatcherHostImpl::Get();
|
| if (rdhi) {
|
| BrowserThread::PostTask(
|
| @@ -60,7 +63,7 @@ ResourceContext::~ResourceContext() {
|
| }
|
|
|
| ResourceContext::SaltCallback ResourceContext::GetMediaDeviceIDSalt() {
|
| - return base::Bind(&ReturnEmptySalt);
|
| + return base::Bind(GetSalt, media_device_id_salt_);
|
| }
|
|
|
| std::unique_ptr<net::ClientCertStore> ResourceContext::CreateClientCertStore() {
|
| @@ -76,6 +79,14 @@ void ResourceContext::CreateKeygenHandler(
|
| new net::KeygenHandler(key_size_in_bits, challenge_string, url)));
|
| }
|
|
|
| +// static
|
| +std::string ResourceContext::CreateRandomMediaDeviceIDSalt() {
|
| + std::string salt;
|
| + base::Base64Encode(base::RandBytesAsString(16), &salt);
|
| + DCHECK(!salt.empty());
|
| + return salt;
|
| +}
|
| +
|
| ChromeBlobStorageContext* GetChromeBlobStorageContextForResourceContext(
|
| const ResourceContext* resource_context) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
|
|