-
- if (IsMetricsReportingEnabled())
- metrics->Start();
-}
-
-bool ChromeBrowserMainParts::IsMetricsReportingEnabled() {
- // If the user permits metrics reporting with the checkbox in the
- // prefs, we turn on recording. We disable metrics completely for
- // non-official builds. This can be forced with a flag.
- const CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kEnableMetricsReportingForTesting))
- return true;
-
- bool enabled = false;
- // The debug build doesn't send UMA logs when FieldTrials are forced.
- if (command_line->HasSwitch(switches::kForceFieldTrials))
- return false;
-
-#if defined(GOOGLE_CHROME_BUILD)
-#if defined(OS_CHROMEOS)
- chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
- &enabled);
-#else
- enabled = local_state_->GetBoolean(prefs::kMetricsReportingEnabled);
-#endif // #if defined(OS_CHROMEOS)
-#endif // defined(GOOGLE_CHROME_BUILD)
- return enabled;
+ const bool metrics_enabled = metrics->StartIfMetricsReportingEnabled();
+ if (metrics_enabled) {
+ // TODO(asvitkine): Since this function is not run on Android, RAPPOR is
+ // currently disabled there. http://crbug.com/370041
+ browser_process_->rappor_service()->Start(
+ browser_process_->local_state(),
+ browser_process_->system_request_context());
+ }