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/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h
" | 9 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h
" |
10 #include "net/proxy/proxy_info.h" | 10 #include "net/proxy/proxy_info.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 "DataCompressionProxyPreconnectHints") == kEnabled; | 45 "DataCompressionProxyPreconnectHints") == kEnabled; |
46 } | 46 } |
47 | 47 |
48 // static | 48 // static |
49 bool DataReductionProxyParams::IsIncludedInCriticalPathBypassFieldTrial() { | 49 bool DataReductionProxyParams::IsIncludedInCriticalPathBypassFieldTrial() { |
50 return IsIncludedInFieldTrial() && | 50 return IsIncludedInFieldTrial() && |
51 FieldTrialList::FindFullName( | 51 FieldTrialList::FindFullName( |
52 "DataCompressionProxyCriticalBypass") == kEnabled; | 52 "DataCompressionProxyCriticalBypass") == kEnabled; |
53 } | 53 } |
54 | 54 |
| 55 bool DataReductionProxyParams::IsIncludedInHoldbackFieldTrial() { |
| 56 return FieldTrialList::FindFullName( |
| 57 "DataCompressionProxyHoldback") == kEnabled; |
| 58 } |
| 59 |
55 DataReductionProxyParams::DataReductionProxyParams(int flags) | 60 DataReductionProxyParams::DataReductionProxyParams(int flags) |
56 : allowed_((flags & kAllowed) == kAllowed), | 61 : allowed_((flags & kAllowed) == kAllowed), |
57 fallback_allowed_((flags & kFallbackAllowed) == kFallbackAllowed), | 62 fallback_allowed_((flags & kFallbackAllowed) == kFallbackAllowed), |
58 alt_allowed_((flags & kAlternativeAllowed) == kAlternativeAllowed), | 63 alt_allowed_((flags & kAlternativeAllowed) == kAlternativeAllowed), |
59 promo_allowed_((flags & kPromoAllowed) == kPromoAllowed), | 64 promo_allowed_((flags & kPromoAllowed) == kPromoAllowed), |
| 65 holdback_((flags & kHoldback) == kHoldback), |
60 configured_on_command_line_(false) { | 66 configured_on_command_line_(false) { |
61 bool result = Init(allowed_, fallback_allowed_, alt_allowed_); | 67 bool result = Init(allowed_, fallback_allowed_, alt_allowed_); |
62 DCHECK(result); | 68 DCHECK(result); |
63 } | 69 } |
64 | 70 |
65 DataReductionProxyParams::~DataReductionProxyParams() { | 71 DataReductionProxyParams::~DataReductionProxyParams() { |
66 } | 72 } |
67 | 73 |
68 DataReductionProxyParams::DataReductionProxyList | 74 DataReductionProxyParams::DataReductionProxyList |
69 DataReductionProxyParams::GetAllowedProxies() const { | 75 DataReductionProxyParams::GetAllowedProxies() const { |
(...skipping 15 matching lines...) Expand all Loading... |
85 list.push_back(alt_fallback_origin_); | 91 list.push_back(alt_fallback_origin_); |
86 return list; | 92 return list; |
87 } | 93 } |
88 | 94 |
89 DataReductionProxyParams::DataReductionProxyParams(int flags, | 95 DataReductionProxyParams::DataReductionProxyParams(int flags, |
90 bool should_call_init) | 96 bool should_call_init) |
91 : allowed_((flags & kAllowed) == kAllowed), | 97 : allowed_((flags & kAllowed) == kAllowed), |
92 fallback_allowed_((flags & kFallbackAllowed) == kFallbackAllowed), | 98 fallback_allowed_((flags & kFallbackAllowed) == kFallbackAllowed), |
93 alt_allowed_((flags & kAlternativeAllowed) == kAlternativeAllowed), | 99 alt_allowed_((flags & kAlternativeAllowed) == kAlternativeAllowed), |
94 promo_allowed_((flags & kPromoAllowed) == kPromoAllowed), | 100 promo_allowed_((flags & kPromoAllowed) == kPromoAllowed), |
| 101 holdback_((flags & kHoldback) == kHoldback), |
95 configured_on_command_line_(false) { | 102 configured_on_command_line_(false) { |
96 if (should_call_init) { | 103 if (should_call_init) { |
97 bool result = Init(allowed_, fallback_allowed_, alt_allowed_); | 104 bool result = Init(allowed_, fallback_allowed_, alt_allowed_); |
98 DCHECK(result); | 105 DCHECK(result); |
99 } | 106 } |
100 } | 107 } |
101 | 108 |
102 bool DataReductionProxyParams::Init( | 109 bool DataReductionProxyParams::Init( |
103 bool allowed, bool fallback_allowed, bool alt_allowed) { | 110 bool allowed, bool fallback_allowed, bool alt_allowed) { |
104 InitWithoutChecks(); | 111 InitWithoutChecks(); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 379 } |
373 | 380 |
374 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { | 381 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { |
375 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) | 382 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) |
376 return DATA_REDUCTION_PROXY_WARMUP_URL; | 383 return DATA_REDUCTION_PROXY_WARMUP_URL; |
377 #endif | 384 #endif |
378 return std::string(); | 385 return std::string(); |
379 } | 386 } |
380 | 387 |
381 } // namespace data_reduction_proxy | 388 } // namespace data_reduction_proxy |
OLD | NEW |