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

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: Factored blacklist and lofi_off_ check (and comment verbage) into helper 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
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..91f6fbff913b2c21ca4cb14d372b6eb29d21c91f 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"
@@ -213,6 +214,11 @@ class DataReductionProxyConfig
// 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(const net::URLRequest& request,
+ 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,11 +309,31 @@ 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 a non-null object that determines eligibility of the
+ // showing the preview based on past opt outs.
+ // Should only be used if the kDataReductionProxyDecidesTransform feature is
+ // enabled.
+ bool ShouldAcceptServerLoFi(const net::URLRequest& request,
+ 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 a non-null object that determines eligibility of the
+ // showing the preview based on past opt outs.
+ // Should only be used if the kDataReductionProxyDecidesTransform feature is
+ // enabled.
+ bool ShouldAcceptLitePages(const net::URLRequest& request,
+ 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.
+ // Should NOT be used if the kDataReductionProxyDecidesTransform feature is
+ // enabled.
bool ShouldEnableLoFiInternal(const net::URLRequest& request,
previews::PreviewsDecider* previews_decider);
@@ -314,6 +343,8 @@ 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);

Powered by Google App Engine
This is Rietveld 408576698