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 770c03252d3fa53e7eda383af0d9bab6a3379df8..9acf691a89ce04bd204ae6f0919592cb7fdca6d2 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" |
@@ -17,6 +20,8 @@ |
#include "net/proxy/proxy_config.h" |
#include "net/proxy/proxy_retry_info.h" |
+class GURL; |
+ |
namespace base { |
class SingleThreadTaskRunner; |
class TimeDelta; |
@@ -25,6 +30,7 @@ class TimeDelta; |
namespace net { |
class HostPortPair; |
class NetLog; |
+class URLFetcher; |
class URLRequest; |
class URLRequestContextGetter; |
class URLRequestStatus; |
@@ -32,10 +38,14 @@ 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. |
@@ -75,16 +85,12 @@ class DataReductionProxyConfig |
// which this instance will own. |
DataReductionProxyConfig( |
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
- scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
net::NetLog* net_log, |
scoped_ptr<DataReductionProxyConfigValues> config_values, |
DataReductionProxyConfigurator* configurator, |
DataReductionProxyEventStore* event_store); |
~DataReductionProxyConfig() override; |
- void SetDataReductionProxyService( |
- base::WeakPtr<DataReductionProxyService> data_reduction_proxy_service); |
- |
// Performs initialization on the IO thread. |
void InitializeOnIOThread( |
net::URLRequestContextGetter* url_request_context_getter); |
@@ -215,16 +221,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(); |
@@ -246,6 +252,8 @@ class DataReductionProxyConfig |
bool is_https, |
base::TimeDelta* min_retry_delay) const; |
+ scoped_ptr<SecureProxyChecker> secure_proxy_checker_; |
+ |
bool restricted_by_carrier_; |
bool disabled_on_vpn_; |
bool unreachable_; |
@@ -259,10 +267,6 @@ class DataReductionProxyConfig |
// IO thread. |
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
- // |ui_task_runner_| should be the task runner for running operations on the |
- // UI thread. |
- scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
- |
// The caller must ensure that the |net_log_|, if set, outlives this instance. |
// It is used to create new instances of |bound_net_log_| on secure proxy |
// checks. |bound_net_log_| permits the correlation of the begin and end |
@@ -283,11 +287,6 @@ class DataReductionProxyConfig |
// Enforce usage on the IO thread. |
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); |
}; |