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

Unified Diff: content/browser/browser_context.cc

Issue 2820163002: Move MediaDeviceIDSalt from ProfileIOData to ProfileImpl. (Closed)
Patch Set: merge Created 3 years, 8 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 | « chrome/browser/profiles/profile_io_data.cc ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_context.cc
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc
index b7a99d57813eadc0f76a539635140e6ba15cb509..c5410b5d1d3ab860ae7d5161c5c5e1ba6e474db2 100644
--- a/content/browser/browser_context.cc
+++ b/content/browser/browser_context.cc
@@ -12,9 +12,11 @@
#include <utility>
#include <vector>
+#include "base/base64.h"
#include "base/command_line.h"
#include "base/guid.h"
#include "base/lazy_instance.h"
+#include "base/logging.h"
#include "base/macros.h"
#include "base/rand_util.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -505,6 +507,9 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor(
: nullptr;
}
+BrowserContext::BrowserContext()
+ : media_device_id_salt_(CreateRandomMediaDeviceIDSalt()) {}
+
BrowserContext::~BrowserContext() {
CHECK(GetUserData(kMojoWasInitialized))
<< "Attempting to destroy a BrowserContext that never called "
@@ -524,4 +529,16 @@ void BrowserContext::ShutdownStoragePartitions() {
RemoveUserData(kStoragePartitionMapKeyName);
}
+std::string BrowserContext::GetMediaDeviceIDSalt() {
+ return media_device_id_salt_;
+}
+
+// static
+std::string BrowserContext::CreateRandomMediaDeviceIDSalt() {
+ std::string salt;
+ base::Base64Encode(base::RandBytesAsString(16), &salt);
+ DCHECK(!salt.empty());
+ return salt;
+}
+
} // namespace content
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698