Index: components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h |
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h |
index ca913c62df380d0bcae3c20a6545f9bc3102dc1a..b3deb1211360ca96bae7c3f2c56b694ad61531c2 100644 |
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h |
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h |
@@ -11,6 +11,10 @@ |
#include "base/time/time.h" |
#include "url/gurl.h" |
+namespace base { |
+class SingleThreadTaskRunner; |
+} |
+ |
namespace net { |
class HttpRequestHeaders; |
class HttpResponseHeaders; |
@@ -33,14 +37,15 @@ class DataReductionProxyAuthRequestHandler { |
static bool IsKeySetOnCommandLine(); |
// Constructs an authentication request handler. |
- explicit DataReductionProxyAuthRequestHandler( |
- DataReductionProxyParams* params); |
+ DataReductionProxyAuthRequestHandler( |
+ DataReductionProxyParams* params, |
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner); |
virtual ~DataReductionProxyAuthRequestHandler(); |
// Adds a 'Chrome-Proxy' header to |request_headers| with the data reduction |
// proxy authentication credentials. Only adds this header if the provided |
- // |proxy_server| is a data reduction proxy. |
+ // |proxy_server| is a data reduction proxy. Must be called on the IO thread. |
void MaybeAddRequestHeader(net::URLRequest* request, |
const net::ProxyServer& proxy_server, |
net::HttpRequestHeaders* request_headers); |
@@ -51,14 +56,16 @@ class DataReductionProxyAuthRequestHandler { |
// should be defined in this file as one of |kClient...|. Version is the |
// authentication protocol version that the client uses, which should be |
// |kProtocolVersion| unless the client expects to be handled differently from |
- // the standard behavior. |
- void SetKey(const std::string& key, |
- const std::string& client, |
- const std::string& version); |
+ // the standard behavior. Must be called on the UI Thread. |
+ void SetKeyOnUI(const std::string& key, |
+ const std::string& client, |
+ const std::string& version); |
protected: |
void Init(); |
- void InitAuthentication(const std::string& key); |
+ void InitAuthenticationOnUI(const std::string& key, |
+ const std::string& client, |
+ const std::string& version); |
void AddAuthorizationHeader(net::HttpRequestHeaders* headers); |
@@ -80,17 +87,28 @@ class DataReductionProxyAuthRequestHandler { |
FRIEND_TEST_ALL_PREFIXES(DataReductionProxyAuthRequestHandlerTest, |
AuthHashForSalt); |
+ void InitAuthentication( |
+ const std::string& session, |
+ const std::string& credentials, |
+ const std::string& client, |
+ const std::string& version); |
+ |
// Authentication state. |
std::string key_; |
+ |
+ // Lives on the IO thread. |
std::string session_; |
std::string credentials_; |
// Name of the client and version of the data reduction proxy protocol to use. |
+ // Both live on the IO thread. |
std::string client_; |
std::string version_; |
DataReductionProxyParams* data_reduction_proxy_params_; |
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
+ |
DISALLOW_COPY_AND_ASSIGN(DataReductionProxyAuthRequestHandler); |
}; |