Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h

Issue 1735203002: Revert of Moving proxy resolution logic out of NetworkDelegate and into ProxyDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h
index 37831b9e5f0991461f25b21cd889878af68e1c4f..4611e5e091122cec494b8d65d0dc03ae6b1ff377 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h
@@ -25,6 +25,7 @@
namespace net {
class HttpResponseHeaders;
class HttpRequestHeaders;
+class NetLog;
class NetworkDelegate;
class ProxyConfig;
class ProxyInfo;
@@ -38,7 +39,7 @@
class DataReductionProxyBypassStats;
class DataReductionProxyConfig;
class DataReductionProxyConfigurator;
-class DataReductionProxyExperimentsStats;
+class DataReductionProxyEventCreator;
class DataReductionProxyIOData;
class DataReductionProxyRequestOptions;
@@ -61,17 +62,19 @@
// to the OnResolveProxyHandler and RecordBytesHistograms.
typedef base::Callback<const net::ProxyConfig&()> ProxyConfigGetter;
- // Constructs a DataReductionProxyNetworkDelegate object with the given
- // |network_delegate|, |config|, |handler|, |configurator|, and
- // |experiments_stats|. Takes ownership of
- // and wraps the |network_delegate|, calling an internal implementation for
- // each delegate method. For example, the implementation of
- // OnHeadersReceived() calls OnHeadersReceivedInternal().
+ // Constructs a DataReductionProxyNetworkdelegate object with the given
+ // |network_delegate|, |config|, |handler|, |configurator|,
+ // |net_log|, and |event_creator|. Takes ownership of and wraps the
+ // |network_delegate|, calling an internal implementation for each delegate
+ // method. For example, the implementation of OnHeadersReceived() calls
+ // OnHeadersReceivedInternal().
DataReductionProxyNetworkDelegate(
scoped_ptr<net::NetworkDelegate> network_delegate,
DataReductionProxyConfig* config,
DataReductionProxyRequestOptions* handler,
- const DataReductionProxyConfigurator* configurator);
+ const DataReductionProxyConfigurator* configurator,
+ net::NetLog* net_log,
+ DataReductionProxyEventCreator* event_creator);
~DataReductionProxyNetworkDelegate() override;
// Initializes member variables to record data reduction proxy prefs and
@@ -85,6 +88,21 @@
base::Value* SessionNetworkStatsInfoToValue() const;
private:
+ // Called as the proxy is being resolved for |url|. Allows the delegate to
+ // override the proxy resolution decision made by ProxyService. The delegate
+ // may override the decision by modifying the ProxyInfo |result|.
+ void OnResolveProxyInternal(const GURL& url,
+ int load_flags,
+ const net::ProxyService& proxy_service,
+ net::ProxyInfo* result) override;
+
+ // Called when use of |bad_proxy| fails due to |net_error|. |net_error| is
+ // the network error encountered, if any, and OK if the fallback was
+ // for a reason other than a network error (e.g. the proxy service was
+ // explicitly directed to skip a proxy).
+ void OnProxyFallbackInternal(const net::ProxyServer& bad_proxy,
+ int net_error) override;
+
// Called after a proxy connection. Allows the delegate to read/write
// |headers| before they get sent out. |headers| is valid only until
// OnCompleted or OnURLRequestDestroyed is called for this request.
@@ -145,8 +163,26 @@
const DataReductionProxyConfigurator* configurator_;
+ net::NetLog* net_log_;
+
+ DataReductionProxyEventCreator* event_creator_;
+
DISALLOW_COPY_AND_ASSIGN(DataReductionProxyNetworkDelegate);
};
+
+// Adds data reduction proxies to |result|, where applicable, if result
+// otherwise uses a direct connection for |url|, and the data reduction proxy is
+// not bypassed. Also, configures |result| to proceed directly to the origin if
+// |result|'s current proxy is the data reduction proxy, the
+// |net::LOAD_BYPASS_DATA_REDUCTION_PROXY| |load_flag| is set, and the
+// DataCompressionProxyCriticalBypass Finch trial is set.
+void OnResolveProxyHandler(const GURL& url,
+ int load_flags,
+ const net::ProxyConfig& data_reduction_proxy_config,
+ const net::ProxyRetryInfoMap& proxy_retry_info,
+ const DataReductionProxyConfig* config,
+ net::ProxyInfo* result);
+
} // namespace data_reduction_proxy
#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_NETWORK_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698