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

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

Issue 2010253003: Sending a data saver Pageload metrics pingback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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/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;

Powered by Google App Engine
This is Rietveld 408576698