Chromium Code Reviews| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h |
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h |
| index 85e8b6ec9676ee3304854a7ec2eee227226cca69..84faed276df205642f7d3189f1f09cf26f966180 100644 |
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h |
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h |
| @@ -5,6 +5,7 @@ |
| #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG_H_ |
| #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG_H_ |
| +#include "base/callback.h" |
| #include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| @@ -14,8 +15,15 @@ |
| #include "net/base/net_log.h" |
| #include "net/base/net_util.h" |
| #include "net/base/network_change_notifier.h" |
| +#include "net/http/http_network_layer.h" |
| #include "net/proxy/proxy_config.h" |
| #include "net/proxy/proxy_retry_info.h" |
| +#include "net/url_request/url_fetcher_delegate.h" |
| +#include "net/url_request/url_request_context_getter.h" |
| + |
| + |
| +class GURL; |
| +class PrefService; |
| namespace base { |
| class SingleThreadTaskRunner; |
| @@ -27,10 +35,15 @@ class HostPortPair; |
| class NetLog; |
| class URLRequest; |
| class URLRequestStatus; |
| +class URLFetcher; |
| +class URLRequestContextGetter; |
| } |
| namespace data_reduction_proxy { |
| +typedef base::Callback<void(const std::string&, const net::URLRequestStatus&)> |
| + FetcherResponseCallback; |
| + |
| class DataReductionProxyConfigurator; |
| class DataReductionProxyEventStore; |
| class DataReductionProxyParams; |
| @@ -67,12 +80,14 @@ enum SecureProxyCheckFetchResult { |
| // This object lives on the IO thread and all of its methods are expected to be |
| // called from there. |
| class DataReductionProxyConfig |
| - : public net::NetworkChangeNotifier::IPAddressObserver { |
| + : public net::NetworkChangeNotifier::IPAddressObserver, |
| + public net::URLFetcherDelegate { |
| public: |
| // The caller must ensure that all parameters remain alive for the lifetime |
| // of the |DataReductionProxyConfig| instance, with the exception of |params| |
| // which this instance will own. |
| DataReductionProxyConfig( |
| + net::URLRequestContextGetter* request_context_getter, |
| scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| net::NetLog* net_log, |
| @@ -186,6 +201,18 @@ class DataReductionProxyConfig |
| virtual void GetNetworkList(net::NetworkInterfaceList* interfaces, |
| int policy); |
| + // Virtualized for testing. Returns a fetcher to check if it is permitted to |
| + // use the secure proxy. |
| + virtual net::URLFetcher* GetURLFetcherForSecureProxyCheck( |
| + const GURL& secure_proxy_check_url); |
| + |
| + // Requests the given |secure_proxy_check_url|. Upon completion, returns the |
| + // results to the caller via the |fetcher_callback|. Virtualized for unit |
| + // testing. |
| + virtual void SecureProxyCheck( |
| + const GURL& secure_proxy_check_url, |
| + FetcherResponseCallback fetcher_callback); |
| + |
| private: |
| friend class DataReductionProxyConfigTest; |
| friend class MockDataReductionProxyConfig; |
| @@ -197,6 +224,19 @@ class DataReductionProxyConfig |
| FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, |
| TestSetProxyConfigsHoldback); |
| + // net::URLFetcherDelegate: |
| + void OnURLFetchComplete(const net::URLFetcher* source) override; |
| + |
| + net::URLRequestContextGetter* url_request_context_getter_; |
| + scoped_ptr<net::HttpNetworkLayer> http_network_layer; |
|
sclittle
2015/03/20 19:28:46
needs a "_" at the end.
tbansal1
2015/04/01 19:58:59
Done.
|
| + scoped_ptr<net::URLRequestContext> url_request_context_; |
| + |
| + // The URLFetcher being used for the secure proxy check. |
| + scoped_ptr<net::URLFetcher> fetcher_; |
| + FetcherResponseCallback fetcher_callback_; |
| + |
| + |
| + |
| // NetworkChangeNotifier::IPAddressObserver: |
| void OnIPAddressChanged() override; |
| @@ -217,8 +257,6 @@ class DataReductionProxyConfig |
| // Data Reduction Proxy rules. |
| virtual void HandleSecureProxyCheckResponse( |
| const std::string& response, const net::URLRequestStatus& status); |
| - virtual void HandleSecureProxyCheckResponseOnIOThread( |
| - const std::string& response, const net::URLRequestStatus& status); |
| // Adds the default proxy bypass rules for the Data Reduction Proxy. |
| void AddDefaultProxyBypassRules(); |