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 61305e51405c9d692c1f0cb769a4348da4ad5009..825c5c2bbf21ebf9515c52895002ede44150cf4c 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,9 @@ |
#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 <string> |
+ |
+#include "base/callback.h" |
#include "base/gtest_prod_util.h" |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
@@ -13,10 +16,13 @@ |
#include "net/base/net_errors.h" |
#include "net/base/net_util.h" |
#include "net/base/network_change_notifier.h" |
+#include "net/http/http_network_layer.h" |
#include "net/log/net_log.h" |
#include "net/proxy/proxy_config.h" |
#include "net/proxy/proxy_retry_info.h" |
+class GURL; |
+ |
namespace base { |
class SingleThreadTaskRunner; |
class TimeDelta; |
@@ -25,16 +31,21 @@ class TimeDelta; |
namespace net { |
class HostPortPair; |
class NetLog; |
+class URLFetcher; |
class URLRequest; |
+class URLRequestContextGetter; |
class URLRequestStatus; |
} |
namespace data_reduction_proxy { |
+typedef base::Callback<void(const std::string&, const net::URLRequestStatus&)> |
+ FetcherResponseCallback; |
+ |
class DataReductionProxyConfigValues; |
class DataReductionProxyConfigurator; |
class DataReductionProxyEventStore; |
-class DataReductionProxyService; |
+class SecureProxyChecker; |
struct DataReductionProxyTypeInfo; |
// Values of the UMA DataReductionProxy.ProbeURL histogram. |
@@ -73,6 +84,7 @@ class DataReductionProxyConfig |
// of the |DataReductionProxyConfig| instance, with the exception of |params| |
// which this instance will own. |
DataReductionProxyConfig( |
+ scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
net::NetLog* net_log, |
@@ -81,9 +93,6 @@ class DataReductionProxyConfig |
DataReductionProxyEventStore* event_store); |
~DataReductionProxyConfig() override; |
- void SetDataReductionProxyService( |
- base::WeakPtr<DataReductionProxyService> data_reduction_proxy_service); |
- |
// This method expects to run on the UI thread. It permits the Data Reduction |
// Proxy configuration to change based on changes initiated by the user. |
virtual void SetProxyPrefs(bool enabled, |
@@ -216,16 +225,16 @@ class DataReductionProxyConfig |
bool restricted, |
bool at_startup); |
- // Begins a secure proxy check to determine if the Data Reduction Proxy is |
- // permitted to use the HTTPS proxy servers. |
- void StartSecureProxyCheck(); |
+ // 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); |
// Parses the secure proxy check responses and appropriately configures the |
// 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(); |
@@ -247,6 +256,9 @@ class DataReductionProxyConfig |
bool is_https, |
base::TimeDelta* min_retry_delay) const; |
+ scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
+ scoped_ptr<SecureProxyChecker> secure_proxy_checker_; |
+ |
bool restricted_by_carrier_; |
bool disabled_on_vpn_; |
bool unreachable_; |
@@ -280,11 +292,6 @@ class DataReductionProxyConfig |
base::ThreadChecker thread_checker_; |
- // A weak pointer to a |DataReductionProxyService| to perform secure proxy |
- // checks. The weak pointer is required since the |DataReductionProxyService| |
- // is destroyed before this instance of the |DataReductionProxyConfig|. |
- base::WeakPtr<DataReductionProxyService> data_reduction_proxy_service_; |
- |
DISALLOW_COPY_AND_ASSIGN(DataReductionProxyConfig); |
}; |