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_auth_request_handler.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h |
similarity index 83% |
rename from components/data_reduction_proxy/core/browser/data_reduction_proxy_auth_request_handler.h |
rename to components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h |
index 4d270d385b5270fc575ad64f2129fbee95c9ad9d..4e380d0552ebb242580ca07c77a2dab6115c957e 100644 |
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_auth_request_handler.h |
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h |
@@ -5,6 +5,9 @@ |
#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_AUTH_REQUEST_HANDLER_H_ |
#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_AUTH_REQUEST_HANDLER_H_ |
+#include <map> |
+#include <string> |
+ |
#include "base/gtest_prod_util.h" |
#include "base/memory/ref_counted.h" |
#include "base/strings/string16.h" |
@@ -51,18 +54,18 @@ typedef enum { |
class DataReductionProxyParams; |
-class DataReductionProxyAuthRequestHandler { |
+class DataReductionProxyRequestOptions { |
public: |
static bool IsKeySetOnCommandLine(); |
- // Constructs a DataReductionProxyAuthRequestHandler object with the given |
+ // Constructs a DataReductionProxyRequestOptions object with the given |
// client type, params, and network task runner. |
- DataReductionProxyAuthRequestHandler( |
+ DataReductionProxyRequestOptions( |
Client client, |
DataReductionProxyParams* params, |
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner); |
- virtual ~DataReductionProxyAuthRequestHandler(); |
+ virtual ~DataReductionProxyRequestOptions(); |
// Adds a 'Chrome-Proxy' header to |request_headers| with the data reduction |
// proxy authentication credentials. Only adds this header if the provided |
@@ -107,21 +110,23 @@ class DataReductionProxyAuthRequestHandler { |
virtual std::string GetDefaultKey() const; |
// Visible for testing. |
- DataReductionProxyAuthRequestHandler( |
+ DataReductionProxyRequestOptions( |
Client client, |
const std::string& version, |
DataReductionProxyParams* params, |
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner); |
private: |
- FRIEND_TEST_ALL_PREFIXES(DataReductionProxyAuthRequestHandlerTest, |
+ FRIEND_TEST_ALL_PREFIXES(DataReductionProxyRequestOptionsTest, |
AuthorizationOnIOThread); |
- FRIEND_TEST_ALL_PREFIXES(DataReductionProxyAuthRequestHandlerTest, |
+ FRIEND_TEST_ALL_PREFIXES(DataReductionProxyRequestOptionsTest, |
AuthorizationIgnoresEmptyKey); |
- FRIEND_TEST_ALL_PREFIXES(DataReductionProxyAuthRequestHandlerTest, |
+ FRIEND_TEST_ALL_PREFIXES(DataReductionProxyRequestOptionsTest, |
AuthorizationBogusVersion); |
- FRIEND_TEST_ALL_PREFIXES(DataReductionProxyAuthRequestHandlerTest, |
+ FRIEND_TEST_ALL_PREFIXES(DataReductionProxyRequestOptionsTest, |
AuthHashForSalt); |
+ FRIEND_TEST_ALL_PREFIXES(DataReductionProxyRequestOptionsTest, |
+ AuthorizationLoFi); |
// Returns the version of Chromium that is being used. |
std::string ChromiumVersion() const; |
@@ -146,6 +151,17 @@ class DataReductionProxyAuthRequestHandler { |
bool expect_ssl, |
net::HttpRequestHeaders* request_headers); |
+ // Takes a map of request header options and adds them to |header_options_|. |
+ void SetRequestHeaderOptions( |
+ std::map<std::string, std::string> header_options); |
+ // Regenerates the |header_value_| string which is concatenated to the |
+ // Chrome-proxy header. |
+ void RegenerateRequestHeaderValue(); |
+ |
+ // Map and string of the request options to be added to the header. |
+ std::map<std::string, std::string> header_options_; |
+ std::string header_value_; |
+ |
// Authentication state. |
std::string key_; |
@@ -167,7 +183,7 @@ class DataReductionProxyAuthRequestHandler { |
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
- DISALLOW_COPY_AND_ASSIGN(DataReductionProxyAuthRequestHandler); |
+ DISALLOW_COPY_AND_ASSIGN(DataReductionProxyRequestOptions); |
}; |
} // namespace data_reduction_proxy |