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_metrics.h " | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h " |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 DailyContentLengthUpdate original_; | 289 DailyContentLengthUpdate original_; |
290 DailyContentLengthUpdate received_; | 290 DailyContentLengthUpdate received_; |
291 }; | 291 }; |
292 | 292 |
293 // Returns true if the request is bypassed by all configured data reduction | 293 // Returns true if the request is bypassed by all configured data reduction |
294 // proxies. It returns the bypass delay in delay_seconds (if not NULL). If | 294 // proxies. It returns the bypass delay in delay_seconds (if not NULL). If |
295 // the request is bypassed by more than one proxy, delay_seconds returns | 295 // the request is bypassed by more than one proxy, delay_seconds returns |
296 // shortest delay. | 296 // shortest delay. |
297 bool IsBypassRequest(const net::URLRequest* request, int64* delay_seconds) { | 297 bool IsBypassRequest(const net::URLRequest* request, int64* delay_seconds) { |
298 // TODO(bengr): Add support for other data reduction proxy configurations. | 298 // TODO(bengr): Add support for other data reduction proxy configurations. |
299 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
300 DataReductionProxyParams params( | 299 DataReductionProxyParams params( |
bengr
2014/07/11 20:42:53
These params should be the same params that are pa
Not at Google. Contact bengr
2014/07/16 22:41:33
Add a TODO and an entry in the sheet.
| |
301 DataReductionProxyParams::kAllowed | | 300 DataReductionProxyParams::kAllowed | |
302 DataReductionProxyParams::kFallbackAllowed | | 301 DataReductionProxyParams::kFallbackAllowed | |
303 DataReductionProxyParams::kPromoAllowed); | 302 DataReductionProxyParams::kPromoAllowed); |
304 DataReductionProxyParams::DataReductionProxyList proxies = | 303 DataReductionProxyParams::DataReductionProxyList proxies = |
305 params.GetAllowedProxies(); | 304 params.GetAllowedProxies(); |
306 if (proxies.size() == 0) | 305 if (proxies.size() == 0) |
307 return false; | 306 return false; |
308 | 307 |
309 if (request == NULL || request->context() == NULL || | 308 if (request == NULL || request->context() == NULL || |
310 request->context()->proxy_service() == NULL) { | 309 request->context()->proxy_service() == NULL) { |
(...skipping 17 matching lines...) Expand all Loading... | |
328 if (found == retry_map.end()) | 327 if (found == retry_map.end()) |
329 return false; | 328 return false; |
330 if (shortest_delay == 0 || | 329 if (shortest_delay == 0 || |
331 shortest_delay > found->second.current_delay.InSeconds()) { | 330 shortest_delay > found->second.current_delay.InSeconds()) { |
332 shortest_delay = found->second.current_delay.InSeconds(); | 331 shortest_delay = found->second.current_delay.InSeconds(); |
333 } | 332 } |
334 } | 333 } |
335 if (delay_seconds != NULL) | 334 if (delay_seconds != NULL) |
336 *delay_seconds = shortest_delay; | 335 *delay_seconds = shortest_delay; |
337 return true; | 336 return true; |
338 #else | |
339 return false; | |
340 #endif | |
341 } | 337 } |
342 | 338 |
343 } // namespace | 339 } // namespace |
344 | 340 |
345 DataReductionProxyRequestType GetDataReductionProxyRequestType( | 341 DataReductionProxyRequestType GetDataReductionProxyRequestType( |
346 const net::URLRequest* request) { | 342 const net::URLRequest* request) { |
347 if (request->url().SchemeIs("https")) | 343 if (request->url().SchemeIs("https")) |
348 return HTTPS; | 344 return HTTPS; |
349 if (!request->url().SchemeIs("http")) { | 345 if (!request->url().SchemeIs("http")) { |
350 NOTREACHED(); | 346 NOTREACHED(); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 UpdateContentLengthPrefsForDataReductionProxy( | 530 UpdateContentLengthPrefsForDataReductionProxy( |
535 received_content_length, | 531 received_content_length, |
536 original_content_length, | 532 original_content_length, |
537 with_data_reduction_proxy_enabled, | 533 with_data_reduction_proxy_enabled, |
538 request_type, | 534 request_type, |
539 base::Time::Now(), | 535 base::Time::Now(), |
540 prefs); | 536 prefs); |
541 } | 537 } |
542 | 538 |
543 } // namespace data_reduction_proxy | 539 } // namespace data_reduction_proxy |
OLD | NEW |