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 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 9 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
10 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" | 10 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 } | 50 } |
51 | 51 |
52 // Empty implies either that the request was served from cache or that | 52 // Empty implies either that the request was served from cache or that |
53 // request was served directly from the origin. | 53 // request was served directly from the origin. |
54 if (request->proxy_server().IsEmpty()) | 54 if (request->proxy_server().IsEmpty()) |
55 return false; | 55 return false; |
56 | 56 |
57 if (data_reduction_proxies.first.is_empty()) | 57 if (data_reduction_proxies.first.is_empty()) |
58 return false; | 58 return false; |
59 | 59 |
60 | |
bengr
2014/07/17 00:11:08
remove blank line.
Not at Google. Contact bengr
2014/07/17 18:10:21
Done.
| |
60 DataReductionProxyInfo data_reduction_proxy_info; | 61 DataReductionProxyInfo data_reduction_proxy_info; |
61 net::ProxyService::DataReductionProxyBypassType bypass_type = | 62 net::ProxyService::DataReductionProxyBypassType bypass_type = |
62 GetDataReductionProxyBypassType( | 63 GetDataReductionProxyBypassType( |
63 original_response_headers, &data_reduction_proxy_info); | 64 original_response_headers, &data_reduction_proxy_info); |
64 if (bypass_type == net::ProxyService::BYPASS_EVENT_TYPE_MAX) { | 65 if (bypass_type == net::ProxyService::BYPASS_EVENT_TYPE_MAX) { |
65 return false; | 66 return false; |
66 } | 67 } |
67 | 68 |
68 DCHECK(request->context()); | 69 DCHECK(request->context()); |
69 DCHECK(request->context()->proxy_service()); | 70 DCHECK(request->context()->proxy_service()); |
(...skipping 17 matching lines...) Expand all Loading... | |
87 OverrideResponseAsRedirect(request, | 88 OverrideResponseAsRedirect(request, |
88 original_response_headers, | 89 original_response_headers, |
89 override_response_headers); | 90 override_response_headers); |
90 return true; | 91 return true; |
91 } | 92 } |
92 | 93 |
93 void OnResolveProxyHandler(const GURL& url, | 94 void OnResolveProxyHandler(const GURL& url, |
94 int load_flags, | 95 int load_flags, |
95 const DataReductionProxyParams* params, | 96 const DataReductionProxyParams* params, |
96 net::ProxyInfo* result) { | 97 net::ProxyInfo* result) { |
98 | |
bengr
2014/07/17 00:11:08
remove blank line
Not at Google. Contact bengr
2014/07/17 18:10:21
Done.
| |
97 if ((load_flags & net::LOAD_BYPASS_DATA_REDUCTION_PROXY) && | 99 if ((load_flags & net::LOAD_BYPASS_DATA_REDUCTION_PROXY) && |
98 DataReductionProxyParams::IsIncludedInCriticalPathBypassFieldTrial() && | 100 DataReductionProxyParams::IsIncludedInCriticalPathBypassFieldTrial() && |
99 !result->is_empty() && | 101 !result->is_empty() && |
100 !result->is_direct() && | 102 !result->is_direct() && |
101 params && | 103 params && |
102 params->IsDataReductionProxy( | 104 params->IsDataReductionProxy( |
103 result->proxy_server().host_port_pair(), NULL)) { | 105 result->proxy_server().host_port_pair(), NULL)) { |
104 result->UseDirect(); | 106 result->UseDirect(); |
105 } | 107 } |
106 } | 108 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 net::ProxyService* proxy_service = request->context()->proxy_service(); | 166 net::ProxyService* proxy_service = request->context()->proxy_service(); |
165 DCHECK(proxy_service); | 167 DCHECK(proxy_service); |
166 | 168 |
167 proxy_service->MarkProxiesAsBadUntil(proxy_info, | 169 proxy_service->MarkProxiesAsBadUntil(proxy_info, |
168 bypass_duration, | 170 bypass_duration, |
169 fallback, | 171 fallback, |
170 request->net_log()); | 172 request->net_log()); |
171 } | 173 } |
172 | 174 |
173 } // namespace data_reduction_proxy | 175 } // namespace data_reduction_proxy |
OLD | NEW |