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

Unified Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc

Issue 1455333004: Add "q=preview" directive on main frame requests on poor networks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@deciderAddLoFiHeader
Patch Set: tbansal comments Created 5 years, 1 month 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/common/data_reduction_proxy_params.cc
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc
index 9530b2966159b39d01b15b422425acb3dd7192c0..d84bf983ba13a1b05b851e33f5fe7d65d5fc61f3 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc
@@ -27,6 +27,7 @@ namespace {
const char kEnabled[] = "Enabled";
const char kControl[] = "Control";
+const char kPreview[] = "Enabled_Preview";
const char kDefaultSpdyOrigin[] = "https://proxy.googlezip.net:443";
const char kDefaultQuicOrigin[] = "quic://proxy.googlezip.net:443";
// A one-off change, until the Data Reduction Proxy configuration service is
@@ -83,13 +84,18 @@ std::string GetLoFiFlagFieldTrialName() {
}
bool IsIncludedInLoFiEnabledFieldTrial() {
- return FieldTrialList::FindFullName(GetLoFiFieldTrialName()) == kEnabled;
+ return FieldTrialList::FindFullName(GetLoFiFieldTrialName())
Lei Zhang 2015/11/24 02:08:35 Is the following more readable? std::string name
megjablon 2015/11/24 18:41:58 Yes, I like this much better. Thanks!
+ .compare(0, strlen(kEnabled), kEnabled) == 0;
}
bool IsIncludedInLoFiControlFieldTrial() {
return FieldTrialList::FindFullName(GetLoFiFieldTrialName()) == kControl;
}
+bool IsIncludedInLoFiPreviewFieldTrial() {
+ return FieldTrialList::FindFullName(GetLoFiFieldTrialName()) == kPreview;
+}
+
bool IsLoFiOnViaFlags() {
return IsLoFiAlwaysOnViaFlags() || IsLoFiCellularOnlyViaFlags() ||
IsLoFiSlowConnectionsOnlyViaFlags();
@@ -127,6 +133,11 @@ bool IsLoFiDisabledViaFlags() {
data_reduction_proxy::switches::kDataReductionProxyLoFiValueDisabled;
}
+bool AreLoFiPreviewsEnabledViaFlags() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(
+ data_reduction_proxy::switches::kEnableDataReductionProxyLoFiPreview);
+}
+
bool WarnIfNoDataReductionProxy() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
data_reduction_proxy::switches::

Powered by Google App Engine
This is Rietveld 408576698