Commit f861eca6 authored by holte@chromium.org's avatar holte@chromium.org

Create variations param for RapporRollout to non-UMA users.

BUG=400861

Review URL: https://codereview.chromium.org/430703002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288127 0039d316-1c4b-4281-b951-d872f2087c98
parent 22aa4f5f
...@@ -636,13 +636,12 @@ void ChromeBrowserMainParts::StartMetricsRecording() { ...@@ -636,13 +636,12 @@ void ChromeBrowserMainParts::StartMetricsRecording() {
metrics->CheckForClonedInstall( metrics->CheckForClonedInstall(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
const bool metrics_enabled = metrics->StartIfMetricsReportingEnabled(); const bool metrics_enabled = metrics->StartIfMetricsReportingEnabled();
if (metrics_enabled) { // TODO(asvitkine): Since this function is not run on Android, RAPPOR is
// TODO(asvitkine): Since this function is not run on Android, RAPPOR is // currently disabled there. http://crbug.com/370041
// currently disabled there. http://crbug.com/370041 browser_process_->rappor_service()->Start(
browser_process_->rappor_service()->Start( browser_process_->local_state(),
browser_process_->local_state(), browser_process_->system_request_context(),
browser_process_->system_request_context()); metrics_enabled);
}
} }
void ChromeBrowserMainParts::RecordBrowserStartupTime() { void ChromeBrowserMainParts::RecordBrowserStartupTime() {
......
...@@ -35,10 +35,18 @@ const char kRapporRolloutFieldTrialName[] = "RapporRollout"; ...@@ -35,10 +35,18 @@ const char kRapporRolloutFieldTrialName[] = "RapporRollout";
// Constant for the finch parameter name for the server URL // Constant for the finch parameter name for the server URL
const char kRapporRolloutServerUrlParam[] = "ServerUrl"; const char kRapporRolloutServerUrlParam[] = "ServerUrl";
// Constant for the finch parameter name for the server URL
const char kRapporRolloutRequireUmaParam[] = "RequireUma";
// The rappor server's URL. // The rappor server's URL.
const char kDefaultServerUrl[] = "https://clients4.google.com/rappor"; const char kDefaultServerUrl[] = "https://clients4.google.com/rappor";
GURL GetServerUrl() { GURL GetServerUrl(bool metrics_enabled) {
bool require_uma = variations::GetVariationParamValue(
kRapporRolloutFieldTrialName,
kRapporRolloutRequireUmaParam) != "False";
if (!metrics_enabled && require_uma)
return GURL(); // Invalid URL disables Rappor.
std::string server_url = variations::GetVariationParamValue( std::string server_url = variations::GetVariationParamValue(
kRapporRolloutFieldTrialName, kRapporRolloutFieldTrialName,
kRapporRolloutServerUrlParam); kRapporRolloutServerUrlParam);
...@@ -68,11 +76,12 @@ RapporService::~RapporService() { ...@@ -68,11 +76,12 @@ RapporService::~RapporService() {
} }
void RapporService::Start(PrefService* pref_service, void RapporService::Start(PrefService* pref_service,
net::URLRequestContextGetter* request_context) { net::URLRequestContextGetter* request_context,
const GURL server_url = GetServerUrl(); bool metrics_enabled) {
const GURL server_url = GetServerUrl(metrics_enabled);
if (!server_url.is_valid()) { if (!server_url.is_valid()) {
DVLOG(1) << "RapporService not started: " DVLOG(1) << server_url.spec() << " is invalid. "
<< server_url.spec() << " is invalid."; << "RapporService not started.";
return; return;
} }
DVLOG(1) << "RapporService started. Reporting to " << server_url.spec(); DVLOG(1) << "RapporService started. Reporting to " << server_url.spec();
......
...@@ -42,7 +42,9 @@ class RapporService { ...@@ -42,7 +42,9 @@ class RapporService {
virtual ~RapporService(); virtual ~RapporService();
// Starts the periodic generation of reports and upload attempts. // Starts the periodic generation of reports and upload attempts.
void Start(PrefService* pref_service, net::URLRequestContextGetter* context); void Start(PrefService* pref_service,
net::URLRequestContextGetter* context,
bool metrics_enabled);
// Records a sample of the rappor metric specified by |metric_name|. // Records a sample of the rappor metric specified by |metric_name|.
// Creates and initializes the metric, if it doesn't yet exist. // Creates and initializes the metric, if it doesn't yet exist.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment