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(); |