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

Unified Diff: components/rappor/rappor_service.cc

Issue 430703002: Create variations param for RapporRollout to non-UMA users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 | « components/rappor/rappor_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/rappor/rappor_service.cc
diff --git a/components/rappor/rappor_service.cc b/components/rappor/rappor_service.cc
index 530909e35cfb20967c69d86aa9395206f3381a6b..c09e6edb102f498f0d8de03abf97466e80ad4c9b 100644
--- a/components/rappor/rappor_service.cc
+++ b/components/rappor/rappor_service.cc
@@ -35,6 +35,9 @@ const char kRapporRolloutFieldTrialName[] = "RapporRollout";
// Constant for the finch parameter name for the server URL
const char kRapporRolloutServerUrlParam[] = "ServerUrl";
+// Constant for the finch parameter name for the server URL
+const char kRapporRolloutRequireUmaParam[] = "RequireUma";
+
// The rappor server's URL.
const char kDefaultServerUrl[] = "https://clients4.google.com/rappor";
@@ -59,6 +62,19 @@ const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = {
rappor::PROBABILITY_25 /* Zero coin probability */},
};
+bool IsRapporEnabled(const GURL& server_url, bool metrics_enabled) {
Alexei Svitkine (slow) 2014/07/30 16:52:51 Can this be part of GetServerUrl() given that alre
Steven Holte 2014/08/05 03:09:36 Done.
+ if (!server_url.is_valid()) {
+ DVLOG(1) << server_url.spec() << " is invalid.";
+ return false;
+ }
+ if (metrics_enabled) {
Alexei Svitkine (slow) 2014/07/30 16:52:51 Nit: No {}'s.
Steven Holte 2014/08/05 03:09:37 Done.
+ return true;
+ }
+ return chrome_variations::GetVariationParamValue(
Alexei Svitkine (slow) 2014/07/30 16:52:51 Nit: Please rebase, this is now in namespace varia
Steven Holte 2014/08/05 03:09:37 Done.
+ kRapporRolloutFieldTrialName,
+ kRapporRolloutRequireUmaParam) == "False";
+}
+
} // namespace
RapporService::RapporService() : cohort_(-1) {}
@@ -68,11 +84,11 @@ RapporService::~RapporService() {
}
void RapporService::Start(PrefService* pref_service,
- net::URLRequestContextGetter* request_context) {
+ net::URLRequestContextGetter* request_context,
+ bool metrics_enabled) {
const GURL server_url = GetServerUrl();
- if (!server_url.is_valid()) {
- DVLOG(1) << "RapporService not started: "
- << server_url.spec() << " is invalid.";
+ if (!IsRapporEnabled(server_url, metrics_enabled)) {
+ DVLOG(1) << "RapporService not started.";
return;
}
DVLOG(1) << "RapporService started. Reporting to " << server_url.spec();
« no previous file with comments | « components/rappor/rappor_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698