Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h

Issue 2889993004: New CPAT support in DataReductionProxyConfig guarded by feature flag. (Closed)
Patch Set: Updates new code path to accept LoFi when LitePages enabled (to allow fallback) Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e4529cbf34f3eccd1399e9b7a3871f84d3fdbc29 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,17 +198,16 @@ 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,
- 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,
- 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.
@@ -254,6 +254,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 +303,40 @@ class DataReductionProxyConfig
bool is_https,
base::TimeDelta* min_retry_delay) const;
+ // Returns whether the request is blacklisted (or if Lo-Fi is disabled).
+ bool IsBlackListedOrDisabled(
+ const net::URLRequest& request,
+ const previews::PreviewsDecider& previews_decider,
+ previews::PreviewsType previews_type) 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(
+ const net::URLRequest& request,
+ const previews::PreviewsDecider& previews_decider) const;
+
+ // 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,
+ const previews::PreviewsDecider& previews_decider) const;
+
// 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(
+ 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 +344,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(
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.
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698