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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc

Issue 2940163002: Randomizing seed page id for DRP (Closed)
Patch Set: tbansal comments Created 3 years, 6 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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
index ff0f58c48ec56ba9facabb813b9b242fea618559..d2f0b5dd03efe35a6459cf357813ece1519e0b54 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
@@ -4,8 +4,11 @@
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h"
+#include <stdint.h>
+
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/rand_util.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/safe_sprintf.h"
#include "base/strings/string_piece.h"
@@ -78,7 +81,7 @@ DataReductionProxyRequestOptions::DataReductionProxyRequestOptions(
: client_(util::GetStringForClient(client)),
use_assigned_credentials_(false),
data_reduction_proxy_config_(config),
- current_page_id_(0u) {
+ current_page_id_(base::RandUint64()) {
DCHECK(data_reduction_proxy_config_);
util::GetChromiumBuildAndPatch(version, &build_, &patch_);
}
@@ -230,6 +233,7 @@ void DataReductionProxyRequestOptions::SetSecureSession(
session_.clear();
credentials_.clear();
secure_session_ = secure_session;
+ // Reset Page ID, so users can't be tracked across sessions.
ResetPageId();
// Force skipping of credential regeneration. It should be handled by the
// caller.
@@ -326,8 +330,7 @@ uint64_t DataReductionProxyRequestOptions::GeneratePageId() {
}
void DataReductionProxyRequestOptions::ResetPageId() {
- // Caller should not depend on reset setting the page ID to 0.
- current_page_id_ = 0;
+ current_page_id_ = base::RandUint64();
}
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698