OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG
_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG
_H_ |
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG
_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG
_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // Returns true if the Data Reduction Proxy promo may be shown. This is not | 184 // Returns true if the Data Reduction Proxy promo may be shown. This is not |
185 // tied to whether the Data Reduction Proxy is enabled. | 185 // tied to whether the Data Reduction Proxy is enabled. |
186 bool promo_allowed() const; | 186 bool promo_allowed() const; |
187 | 187 |
188 // Sets |lofi_off_| to true. | 188 // Sets |lofi_off_| to true. |
189 void SetLoFiModeOff(); | 189 void SetLoFiModeOff(); |
190 | 190 |
191 // Returns |lofi_off_|. | 191 // Returns |lofi_off_|. |
192 bool lofi_off() const { return lofi_off_; } | 192 bool lofi_off() const { return lofi_off_; } |
193 | 193 |
194 // Returns true when Lo-Fi mode should be activated. Records metrics for Lo-Fi | 194 // Returns true when Lo-Fi Previews should be activated. Records metrics for |
195 // state changes. |request| is used to get the network quality estimator from | 195 // Lo-Fi state changes. |request| is used to get the network quality estimator |
196 // the URLRequestContext. | 196 // from the URLRequestContext. |
197 bool ShouldEnableLoFiMode(const net::URLRequest& request); | 197 bool ShouldEnableLoFi(const net::URLRequest& request); |
| 198 |
| 199 // Returns true when Lite Page Previews should be activated. |request| is used |
| 200 // to get the network quality estimator from the URLRequestContext. |
| 201 bool ShouldEnableLitePages(const net::URLRequest& request); |
198 | 202 |
199 // Returns true if the data saver has been enabled by the user, and the data | 203 // Returns true if the data saver has been enabled by the user, and the data |
200 // saver proxy is reachable. | 204 // saver proxy is reachable. |
201 bool enabled_by_user_and_reachable() const; | 205 bool enabled_by_user_and_reachable() const; |
202 | 206 |
203 // Gets the ProxyConfig that would be used ignoring the holdback experiment. | 207 // Gets the ProxyConfig that would be used ignoring the holdback experiment. |
204 // This should only be used for logging purposes. | 208 // This should only be used for logging purposes. |
205 net::ProxyConfig ProxyConfigIgnoringHoldback() const; | 209 net::ProxyConfig ProxyConfigIgnoringHoldback() const; |
206 | 210 |
207 bool secure_proxy_allowed() const; | 211 bool secure_proxy_allowed() const; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // proxies are bypassed, returns the minimum retry delay of the bypassed data | 288 // proxies are bypassed, returns the minimum retry delay of the bypassed data |
285 // reduction proxies in min_retry_delay (if not NULL). If there are no | 289 // reduction proxies in min_retry_delay (if not NULL). If there are no |
286 // bypassed data reduction proxies for the request scheme, returns false and | 290 // bypassed data reduction proxies for the request scheme, returns false and |
287 // does not assign min_retry_delay. | 291 // does not assign min_retry_delay. |
288 bool AreProxiesBypassed( | 292 bool AreProxiesBypassed( |
289 const net::ProxyRetryInfoMap& retry_map, | 293 const net::ProxyRetryInfoMap& retry_map, |
290 const net::ProxyConfig::ProxyRules& proxy_rules, | 294 const net::ProxyConfig::ProxyRules& proxy_rules, |
291 bool is_https, | 295 bool is_https, |
292 base::TimeDelta* min_retry_delay) const; | 296 base::TimeDelta* min_retry_delay) const; |
293 | 297 |
294 // Returns true when Lo-Fi mode should be activated. Determines if Lo-Fi mode | 298 // Returns true when Lo-Fi Previews should be activated. Determines if Lo-Fi |
295 // should be activated by checking the Lo-Fi flags and if the network quality | 299 // Previews should be activated by checking the Lo-Fi flags and if the network |
296 // is prohibitively slow. |network_quality_estimator| may be NULL. | 300 // quality is prohibitively slow. |network_quality_estimator| may be NULL. |
297 bool ShouldEnableLoFiModeInternal( | 301 bool ShouldEnableLoFiInternal( |
| 302 const net::NetworkQualityEstimator* network_quality_estimator); |
| 303 |
| 304 // Returns true when Lite Page Previews should be activated. Determines if |
| 305 // Lite Page Previewsmode should be activated by checking the Lite Page |
| 306 // Previews flags and if the network quality is prohibitively slow. |
| 307 // |network_quality_estimator| may be NULL. |
| 308 bool ShouldEnableLitePagesInternal( |
298 const net::NetworkQualityEstimator* network_quality_estimator); | 309 const net::NetworkQualityEstimator* network_quality_estimator); |
299 | 310 |
300 // Returns true if the network quality is at least as poor as the one | 311 // Returns true if the network quality is at least as poor as the one |
301 // specified in the Auto Lo-Fi field trial parameters. | 312 // specified in the Auto Lo-Fi field trial parameters. |
302 // |network_quality_estimator| may be NULL. Virtualized for unit testing. | 313 // |network_quality_estimator| may be NULL. Virtualized for unit testing. |
303 virtual bool IsNetworkQualityProhibitivelySlow( | 314 virtual bool IsNetworkQualityProhibitivelySlow( |
304 const net::NetworkQualityEstimator* network_quality_estimator); | 315 const net::NetworkQualityEstimator* network_quality_estimator); |
305 | 316 |
306 // Records Lo-Fi accuracy metric. |measuring_duration| should belong to the | 317 // Records Lo-Fi accuracy metric. |measuring_duration| should belong to the |
307 // vector returned by LofiAccuracyRecordingIntervals(). | 318 // vector returned by LofiAccuracyRecordingIntervals(). |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 bool is_captive_portal_; | 426 bool is_captive_portal_; |
416 | 427 |
417 base::WeakPtrFactory<DataReductionProxyConfig> weak_factory_; | 428 base::WeakPtrFactory<DataReductionProxyConfig> weak_factory_; |
418 | 429 |
419 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyConfig); | 430 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyConfig); |
420 }; | 431 }; |
421 | 432 |
422 } // namespace data_reduction_proxy | 433 } // namespace data_reduction_proxy |
423 | 434 |
424 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CON
FIG_H_ | 435 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CON
FIG_H_ |
OLD | NEW |