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 c66a27ca27bb6f0c8a486616aa4b0cfb1d9147a8..c176f87bac28329ed8ea0f083e2ddf17463b5ec1 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 |
@@ -41,20 +41,24 @@ const char kQuicFieldTrial[] = "DataReductionProxyUseQuic"; |
const char kLoFiFieldTrial[] = "DataCompressionProxyLoFi"; |
const char kLoFiFlagFieldTrial[] = "DataCompressionProxyLoFiFlag"; |
const char kTrustedSpdyProxyFieldTrialName[] = "DataReductionTrustedSpdyProxy"; |
// Default URL for retrieving the Data Reduction Proxy configuration. |
const char kClientConfigURL[] = |
"https://datasaver.googleapis.com/v1/clientConfigs"; |
+// Default URL for sending pageload metrics. |
+const char kPingbackURL[] = |
+ "https://datasaver.googleapis.com/v1/metrics:recordPageloadMetrics"; |
+ |
// The name of the server side experiment field trial. |
const char kServerExperimentsFieldTrial[] = |
"DataReductionProxyServerExperiments"; |
} // namespace |
namespace data_reduction_proxy { |
namespace params { |
bool IsIncludedInPromoFieldTrial() { |
@@ -152,20 +156,25 @@ bool IsLoFiDisabledViaFlags() { |
data_reduction_proxy::switches::kDataReductionProxyLoFi); |
return lo_fi_value == |
data_reduction_proxy::switches::kDataReductionProxyLoFiValueDisabled; |
} |
bool AreLoFiPreviewsEnabledViaFlags() { |
return base::CommandLine::ForCurrentProcess()->HasSwitch( |
data_reduction_proxy::switches::kEnableDataReductionProxyLoFiPreview); |
} |
+bool IsForcePingbackEnabledViaFlags() { |
+ return base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ data_reduction_proxy::switches::kEnableDataReductionProxyForcePingback); |
+} |
+ |
bool WarnIfNoDataReductionProxy() { |
if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
data_reduction_proxy::switches:: |
kEnableDataReductionProxyBypassWarning)) { |
return true; |
} |
return false; |
} |
bool IsIncludedInQuicFieldTrial() { |
@@ -197,20 +206,40 @@ GURL GetConfigServiceURL() { |
GURL result(url); |
if (result.is_valid()) |
return result; |
LOG(WARNING) << "The following client config URL specified at the " |
<< "command-line or variation is invalid: " << url; |
return GURL(kClientConfigURL); |
} |
+GURL GetPingbackURL() { |
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
+ std::string url; |
+ if (command_line->HasSwitch(switches::kDataReductionPingbackURL)) { |
+ url = |
+ command_line->GetSwitchValueASCII(switches::kDataReductionPingbackURL); |
+ } |
+ |
+ if (url.empty()) |
+ return GURL(kPingbackURL); |
+ |
+ GURL result(url); |
+ if (result.is_valid()) |
+ return result; |
+ |
+ LOG(WARNING) << "The following page load metrics URL specified at the " |
+ << "command-line or variation is invalid: " << url; |
+ return GURL(kPingbackURL); |
+} |
+ |
bool ShouldForceEnableDataReductionProxy() { |
return base::CommandLine::ForCurrentProcess()->HasSwitch( |
data_reduction_proxy::switches::kEnableDataReductionProxy); |
} |
bool ShouldUseSecureProxyByDefault() { |
if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
data_reduction_proxy::switches:: |
kDataReductionProxyStartSecureDisabled)) |
return false; |