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_params.h" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" |
8 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
9 #include "base/time/time.h" | 10 #include "base/time/time.h" |
10 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h
" | 11 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h
" |
11 #include "net/base/host_port_pair.h" | 12 #include "net/base/host_port_pair.h" |
12 #include "net/proxy/proxy_info.h" | 13 #include "net/proxy/proxy_info.h" |
13 #include "net/proxy/proxy_retry_info.h" | 14 #include "net/proxy/proxy_retry_info.h" |
14 #include "net/proxy/proxy_server.h" | 15 #include "net/proxy/proxy_server.h" |
15 #include "net/proxy/proxy_service.h" | 16 #include "net/proxy/proxy_service.h" |
16 #include "net/url_request/url_request.h" | 17 #include "net/url_request/url_request.h" |
17 #include "net/url_request/url_request_context.h" | 18 #include "net/url_request/url_request_context.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 : allowed_((flags & kAllowed) == kAllowed), | 67 : allowed_((flags & kAllowed) == kAllowed), |
67 fallback_allowed_((flags & kFallbackAllowed) == kFallbackAllowed), | 68 fallback_allowed_((flags & kFallbackAllowed) == kFallbackAllowed), |
68 alt_allowed_((flags & kAlternativeAllowed) == kAlternativeAllowed), | 69 alt_allowed_((flags & kAlternativeAllowed) == kAlternativeAllowed), |
69 promo_allowed_((flags & kPromoAllowed) == kPromoAllowed), | 70 promo_allowed_((flags & kPromoAllowed) == kPromoAllowed), |
70 holdback_((flags & kHoldback) == kHoldback), | 71 holdback_((flags & kHoldback) == kHoldback), |
71 configured_on_command_line_(false) { | 72 configured_on_command_line_(false) { |
72 bool result = Init(allowed_, fallback_allowed_, alt_allowed_); | 73 bool result = Init(allowed_, fallback_allowed_, alt_allowed_); |
73 DCHECK(result); | 74 DCHECK(result); |
74 } | 75 } |
75 | 76 |
| 77 scoped_ptr<DataReductionProxyParams> DataReductionProxyParams::Clone() { |
| 78 return scoped_ptr<DataReductionProxyParams>( |
| 79 new DataReductionProxyParams(*this)); |
| 80 } |
| 81 |
| 82 DataReductionProxyParams::DataReductionProxyParams( |
| 83 const DataReductionProxyParams& other) |
| 84 : origin_(other.origin_), |
| 85 fallback_origin_(other.fallback_origin_), |
| 86 ssl_origin_(other.ssl_origin_), |
| 87 alt_origin_(other.alt_origin_), |
| 88 alt_fallback_origin_(other.alt_fallback_origin_), |
| 89 probe_url_(other.probe_url_), |
| 90 warmup_url_(other.warmup_url_), |
| 91 allowed_(other.allowed_), |
| 92 fallback_allowed_(other.fallback_allowed_), |
| 93 alt_allowed_(other.alt_allowed_), |
| 94 promo_allowed_(other.promo_allowed_), |
| 95 holdback_(other.holdback_), |
| 96 configured_on_command_line_(other.configured_on_command_line_) { |
| 97 } |
| 98 |
76 DataReductionProxyParams::~DataReductionProxyParams() { | 99 DataReductionProxyParams::~DataReductionProxyParams() { |
77 } | 100 } |
78 | 101 |
79 DataReductionProxyParams::DataReductionProxyList | 102 DataReductionProxyParams::DataReductionProxyList |
80 DataReductionProxyParams::GetAllowedProxies() const { | 103 DataReductionProxyParams::GetAllowedProxies() const { |
81 DataReductionProxyList list; | 104 DataReductionProxyList list; |
82 if (allowed_) { | 105 if (allowed_) { |
83 list.push_back(origin_); | 106 list.push_back(origin_); |
84 // TODO(bolian): revert this once the proxy PAC fix is ready. | 107 // TODO(bolian): revert this once the proxy PAC fix is ready. |
85 if (GURL(GetDefaultDevOrigin()) == origin()) { | 108 if (GURL(GetDefaultDevOrigin()) == origin()) { |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 } | 479 } |
457 | 480 |
458 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { | 481 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { |
459 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) | 482 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) |
460 return DATA_REDUCTION_PROXY_WARMUP_URL; | 483 return DATA_REDUCTION_PROXY_WARMUP_URL; |
461 #endif | 484 #endif |
462 return std::string(); | 485 return std::string(); |
463 } | 486 } |
464 | 487 |
465 } // namespace data_reduction_proxy | 488 } // namespace data_reduction_proxy |
OLD | NEW |