Chromium Code Reviews| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h |
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h |
| index 51a04b8762af809f5b5d1649ce8f2691a55b7f6f..8b13482e86cafb7751f7fff7651dbf6f63292fe4 100644 |
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h |
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h |
| @@ -19,6 +19,7 @@ |
| #include "base/threading/thread_checker.h" |
| #include "base/time/time.h" |
| #include "components/data_reduction_proxy/core/common/data_reduction_proxy_server.h" |
| +#include "components/previews/core/previews_experiments.h" |
| #include "net/base/net_errors.h" |
| #include "net/base/network_change_notifier.h" |
| #include "net/base/network_interfaces.h" |
| @@ -197,22 +198,27 @@ class DataReductionProxyConfig |
| // Returns true when Lo-Fi Previews should be activated. Records metrics for |
| // Lo-Fi state changes. |request| is used to get the network quality estimator |
| - // from the URLRequestContext. |previews_decider| is a non-null object that |
| - // determines eligibility of showing the preview based on past opt outs. |
| + // from the URLRequestContext. |previews_decider| is used to check if |
| + // |request| is locally blacklisted. |
| bool ShouldEnableLoFi(const net::URLRequest& request, |
|
bengr
2017/05/23 17:51:24
Can this method be const?
dougarnett
2017/05/23 18:27:44
No, *Internal() sets some members.
|
| - previews::PreviewsDecider* previews_decider); |
| + const previews::PreviewsDecider& previews_decider); |
| // Returns true when Lite Page Previews should be activated. |request| is used |
| // to get the network quality estimator from the URLRequestContext. |
| - // |previews_decider| is a non-null object that determines eligibility of |
| - // showing the preview based on past opt outs. |
| + // |previews_decider| is used to check if |request| is locally blacklisted. |
| bool ShouldEnableLitePages(const net::URLRequest& request, |
|
bengr
2017/05/23 17:51:24
Can this method be const?
dougarnett
2017/05/23 18:27:44
No, *Internal() sets some members.
|
| - previews::PreviewsDecider* previews_decider); |
| + const previews::PreviewsDecider& previews_decider); |
| // Returns true if the data saver has been enabled by the user, and the data |
| // saver proxy is reachable. |
| bool enabled_by_user_and_reachable() const; |
| + // Returns whether the request is blacklisted (or if Lo-Fi is disabled). |
| + bool IsBlackListedOrDisabled( |
|
bengr
2017/05/23 17:51:25
Does this need to be public? Does it even need to
dougarnett
2017/05/23 18:27:44
private now. Currently accesses a member.
|
| + const net::URLRequest& request, |
| + const previews::PreviewsDecider& previews_decider, |
| + previews::PreviewsType previews_type); |
| + |
| // Gets the ProxyConfig that would be used ignoring the holdback experiment. |
| // This should only be used for logging purposes. |
| net::ProxyConfig ProxyConfigIgnoringHoldback() const; |
| @@ -254,6 +260,9 @@ class DataReductionProxyConfig |
| FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, |
| LoFiAccuracyNonZeroDelay); |
| FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, WarmupURL); |
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, |
| + ShouldAcceptServerLoFi); |
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, ShouldAcceptLitePages); |
| // Values of the estimated network quality at the beginning of the most |
| // recent query of the Network Quality Estimator. |
| @@ -300,13 +309,33 @@ class DataReductionProxyConfig |
| bool is_https, |
| base::TimeDelta* min_retry_delay) const; |
| + // Returns whether the client should report to the data reduction proxy that |
| + // it is willing to accept the Server Lo-Fi optimization for |request|. |
| + // |previews_decider| is used to check if |request| is locally blacklisted. |
| + // Should only be used if the kDataReductionProxyDecidesTransform feature is |
| + // enabled. |
| + bool ShouldAcceptServerLoFi( |
|
bengr
2017/05/23 17:51:24
Can this method be const?
dougarnett
2017/05/23 18:27:43
Done.
|
| + const net::URLRequest& request, |
| + const previews::PreviewsDecider& previews_decider); |
| + |
| + // Returns whether the client should report to the data reduction proxy that |
| + // it is willing to accept a LitePage optimization for |request|. |
| + // |previews_decider| is used to check if |request| is locally blacklisted. |
| + // Should only be used if the kDataReductionProxyDecidesTransform feature is |
| + // enabled. |
| + bool ShouldAcceptLitePages(const net::URLRequest& request, |
|
bengr
2017/05/23 17:51:24
Const method?
dougarnett
2017/05/23 18:27:43
Done.
|
| + const previews::PreviewsDecider& previews_decider); |
| + |
| // Returns true when Lo-Fi Previews should be activated. Determines if Lo-Fi |
| // Previews should be activated by checking the Lo-Fi flags and if the network |
| // quality is prohibitively slow. |network_quality_estimator| may be NULL. |
| // |previews_decider| is a non-null object that determines eligibility of the |
| // showing the preview based on past opt outs. |
| - bool ShouldEnableLoFiInternal(const net::URLRequest& request, |
| - previews::PreviewsDecider* previews_decider); |
| + // Should NOT be used if the kDataReductionProxyDecidesTransform feature is |
| + // enabled. |
| + bool ShouldEnableLoFiInternal( |
|
bengr
2017/05/23 17:51:24
Const method?
dougarnett
2017/05/23 18:27:43
No, sets some members.
|
| + const net::URLRequest& request, |
| + const previews::PreviewsDecider& previews_decider); |
| // Returns true when Lite Page Previews should be activated. Determines if |
| // Lite Page Previewsmode should be activated by checking the Lite Page |
| @@ -314,9 +343,11 @@ class DataReductionProxyConfig |
| // |network_quality_estimator| may be NULL. |previews_decider| is a non-null |
| // object that determines eligibility of showing the preview based on past opt |
| // outs. |
| + // Should NOT be used if the kDataReductionProxyDecidesTransform feature is |
| + // enabled. |
| bool ShouldEnableLitePagesInternal( |
|
bengr
2017/05/23 17:51:24
Const method?
dougarnett
2017/05/23 18:27:44
No, sets some members.
|
| const net::URLRequest& request, |
| - previews::PreviewsDecider* previews_decider); |
| + const previews::PreviewsDecider& previews_decider); |
| // Returns true if the network quality is at least as poor as the one |
| // specified in the Auto Lo-Fi field trial parameters. |