Chromium Code Reviews| Index: components/rappor/rappor_service.cc |
| diff --git a/components/rappor/rappor_service.cc b/components/rappor/rappor_service.cc |
| index 0f79d8e39833bb0e3e6ac76e199d893fa78b850c..ca473cdde24fa90907dc5aed712e35d2b4a27713 100644 |
| --- a/components/rappor/rappor_service.cc |
| +++ b/components/rappor/rappor_service.cc |
| @@ -35,13 +35,21 @@ 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"; |
| -GURL GetServerUrl() { |
| +GURL GetServerUrl(bool metrics_enabled) { |
| std::string server_url = variations::GetVariationParamValue( |
|
Alexei Svitkine (slow)
2014/08/05 13:26:15
Nit: Move this after the require_uma check to avoi
Steven Holte
2014/08/05 21:21:09
Done.
|
| kRapporRolloutFieldTrialName, |
| kRapporRolloutServerUrlParam); |
| + bool require_uma = variations::GetVariationParamValue( |
| + kRapporRolloutFieldTrialName, |
| + kRapporRolloutRequireUmaParam) != "False"; |
| + if (!metrics_enabled && require_uma) |
| + return GURL(); // Invalid URL disables Rappor. |
| if (!server_url.empty()) |
| return GURL(server_url); |
| else |
| @@ -68,11 +76,12 @@ RapporService::~RapporService() { |
| } |
| void RapporService::Start(PrefService* pref_service, |
| - net::URLRequestContextGetter* request_context) { |
| - const GURL server_url = GetServerUrl(); |
| + net::URLRequestContextGetter* request_context, |
| + bool metrics_enabled) { |
| + const GURL server_url = GetServerUrl(metrics_enabled); |
| if (!server_url.is_valid()) { |
| - DVLOG(1) << "RapporService not started: " |
| - << server_url.spec() << " is invalid."; |
| + DVLOG(1) << server_url.spec() << " is invalid. " |
| + << "RapporService not started."; |
| return; |
| } |
| DVLOG(1) << "RapporService started. Reporting to " << server_url.spec(); |