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

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

Issue 2803813003: Adding a data saver page id to requests and reports (Closed)
Patch Set: bengr nits 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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h
index b18dee444721063cb4a29b2909deddbdc33d3b14..08700fd2d18ea38cf1f6d9dbb77dd631e9f9d542 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h
@@ -13,6 +13,7 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
+#include "base/optional.h"
#include "base/strings/string16.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
@@ -56,8 +57,10 @@ class DataReductionProxyRequestOptions {
void Init();
// Adds a 'Chrome-Proxy' header to |request_headers| with the data reduction
- // proxy authentication credentials.
- void AddRequestHeader(net::HttpRequestHeaders* request_headers);
+ // proxy authentication credentials. |page_id| should only be non-empty for
+ // main frame requests.
+ void AddRequestHeader(net::HttpRequestHeaders* request_headers,
+ base::Optional<uint64_t> page_id);
// Stores the supplied key and sets up credentials suitable for authenticating
// with the data reduction proxy.
@@ -81,6 +84,9 @@ class DataReductionProxyRequestOptions {
std::string GetSessionKeyFromRequestHeaders(
const net::HttpRequestHeaders& request_headers) const;
+ // Creates and returns a new unique page ID (unique per session).
+ uint64_t GeneratePageId();
+
protected:
// Returns a UTF16 string that's the hash of the configured authentication
// |key| and |salt|. Returns an empty UTF16 string if no key is configured or
@@ -106,6 +112,11 @@ class DataReductionProxyRequestOptions {
FRIEND_TEST_ALL_PREFIXES(DataReductionProxyRequestOptionsTest,
AuthHashForSalt);
+ // Resets the page ID for a new session.
+ // TODO(ryansturm): Create a session object to store this and other data saver
+ // session info. crbug.com/709624
+ void ResetPageId();
+
// Updates the value of the experiments to be run and regenerate the header if
// necessary.
void UpdateExperiments();
@@ -152,6 +163,9 @@ class DataReductionProxyRequestOptions {
// Must outlive |this|.
DataReductionProxyConfig* data_reduction_proxy_config_;
+ // The page identifier that was last generated for data saver proxy server.
+ uint64_t current_page_id_;
+
// Enforce usage on the IO thread.
base::ThreadChecker thread_checker_;

Powered by Google App Engine
This is Rietveld 408576698