| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PROTOCOL_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PROTOCOL_H_ |
| 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PROTOCOL_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PROTOCOL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "net/proxy/proxy_service.h" |
| 10 | 11 |
| 11 namespace base { | 12 namespace base { |
| 12 class TimeDelta; | 13 class TimeDelta; |
| 13 } | 14 } |
| 14 | 15 |
| 15 namespace net { | 16 namespace net { |
| 16 class HttpResponseHeaders; | 17 class HttpResponseHeaders; |
| 17 class ProxyInfo; | 18 class ProxyInfo; |
| 18 class ProxyServer; | 19 class ProxyServer; |
| 19 class URLRequest; | 20 class URLRequest; |
| 20 } | 21 } |
| 21 | 22 |
| 22 class GURL; | 23 class GURL; |
| 23 | 24 |
| 24 namespace data_reduction_proxy { | 25 namespace data_reduction_proxy { |
| 25 | 26 |
| 26 class DataReductionProxyParams; | 27 class DataReductionProxyParams; |
| 27 | 28 |
| 28 // Decides whether to mark the data reduction proxy as temporarily bad and | 29 // Decides whether to mark the data reduction proxy as temporarily bad and |
| 29 // put it on the proxy retry list. Returns true if the request should be | 30 // put it on the proxy retry list. Returns true if the request should be |
| 30 // retried. Sets |override_response_headers| to redirect if so. | 31 // retried. Sets |override_response_headers| to redirect if so. Returns |
| 32 // the DataReductionProxyBypassType (if not NULL). |
| 31 bool MaybeBypassProxyAndPrepareToRetry( | 33 bool MaybeBypassProxyAndPrepareToRetry( |
| 32 const DataReductionProxyParams* params, | 34 const DataReductionProxyParams* params, |
| 33 net::URLRequest* request, | 35 net::URLRequest* request, |
| 34 const net::HttpResponseHeaders* original_response_headers, | 36 const net::HttpResponseHeaders* original_response_headers, |
| 35 scoped_refptr<net::HttpResponseHeaders>* override_response_headers); | 37 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, |
| 38 net::ProxyService::DataReductionProxyBypassType* proxy_bypass_type); |
| 36 | 39 |
| 37 // Configure |result| to proceed directly to the origin if |result|'s current | 40 // Configure |result| to proceed directly to the origin if |result|'s current |
| 38 // proxy is the data reduction proxy, the | 41 // proxy is the data reduction proxy, the |
| 39 // |net::LOAD_BYPASS_DATA_REDUCTION_PROXY| |load_flag| is set, and the | 42 // |net::LOAD_BYPASS_DATA_REDUCTION_PROXY| |load_flag| is set, and the |
| 40 // DataCompressionProxyCriticalBypass Finch trial is set. | 43 // DataCompressionProxyCriticalBypass Finch trial is set. |
| 41 // This handler is intended to be invoked only by | 44 // This handler is intended to be invoked only by |
| 42 // |ChromeNetworkDelegate.NotifyResolveProxy|. | 45 // |ChromeNetworkDelegate.NotifyResolveProxy|. |
| 43 void OnResolveProxyHandler(const GURL& url, | 46 void OnResolveProxyHandler(const GURL& url, |
| 44 int load_flags, | 47 int load_flags, |
| 45 const DataReductionProxyParams* params, | 48 const DataReductionProxyParams* params, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 62 // maintained by the proxy service of the request. Adds | 65 // maintained by the proxy service of the request. Adds |
| 63 // |data_reduction_proxies.second| to the retry list only if |bypass_all| is | 66 // |data_reduction_proxies.second| to the retry list only if |bypass_all| is |
| 64 // true. Visible as part of the public API for testing. | 67 // true. Visible as part of the public API for testing. |
| 65 void MarkProxiesAsBadUntil(net::URLRequest* request, | 68 void MarkProxiesAsBadUntil(net::URLRequest* request, |
| 66 base::TimeDelta& bypass_duration, | 69 base::TimeDelta& bypass_duration, |
| 67 bool bypass_all, | 70 bool bypass_all, |
| 68 const std::pair<GURL, GURL>& data_reduction_proxies); | 71 const std::pair<GURL, GURL>& data_reduction_proxies); |
| 69 | 72 |
| 70 } // namespace data_reduction_proxy | 73 } // namespace data_reduction_proxy |
| 71 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PROTOCOL
_H_ | 74 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PROTOCOL
_H_ |
| OLD | NEW |