Chromium Code Reviews| Index: chrome/browser/chrome_browser_main.cc |
| =================================================================== |
| --- chrome/browser/chrome_browser_main.cc (revision 268177) |
| +++ chrome/browser/chrome_browser_main.cc (working copy) |
| @@ -562,14 +562,8 @@ |
| // Initialize FieldTrialList to support FieldTrials that use one-time |
| // randomization. |
| MetricsService* metrics = browser_process_->metrics_service(); |
| - MetricsService::ReportingState reporting_state = |
| - IsMetricsReportingEnabled() ? MetricsService::REPORTING_ENABLED : |
| - MetricsService::REPORTING_DISABLED; |
| - if (reporting_state == MetricsService::REPORTING_ENABLED) |
| - metrics->ForceClientIdCreation(); // Needed below. |
| field_trial_list_.reset( |
| - new base::FieldTrialList( |
| - metrics->CreateEntropyProvider(reporting_state).release())); |
| + new base::FieldTrialList(metrics->CreateEntropyProvider().release())); |
| const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| if (command_line->HasSwitch(switches::kEnableBenchmarking)) |
| @@ -617,7 +611,7 @@ |
| field_trial_synchronizer_ = new FieldTrialSynchronizer(); |
| // Now that field trials have been created, initializes metrics recording. |
| - metrics->InitializeMetricsRecordingState(reporting_state); |
| + metrics->InitializeMetricsRecordingState(); |
| } |
| // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- |
| @@ -637,35 +631,16 @@ |
| } |
| metrics->CheckForClonedInstall(); |
| - |
| - if (IsMetricsReportingEnabled()) |
| - metrics->Start(); |
| + const bool metrics_enabled = metrics->StartIfMetricsReportingEnabled(); |
| + if (metrics_enabled) { |
| + // TODO(asvitkine): Since this function is not run on Android, RAPPOR is |
| + // currently disabled there. |
|
Nico
2014/05/05 15:59:12
Is there a bug for this? Else, people will git bla
Alexei Svitkine (slow)
2014/05/05 16:30:25
Done. Added crbug link.
|
| + browser_process_->rappor_service()->Start( |
| + browser_process_->local_state(), |
| + browser_process_->system_request_context()); |
| + } |
| } |
| -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; |
| -} |
| - |
| void ChromeBrowserMainParts::RecordBrowserStartupTime() { |
| // Don't record any metrics if UI was displayed before this point e.g. |
| // warning dialogs. |
| @@ -1094,12 +1069,6 @@ |
| StartMetricsRecording(); |
| #endif |
| - if (IsMetricsReportingEnabled()) { |
| - browser_process_->rappor_service()->Start( |
| - browser_process_->local_state(), |
| - browser_process_->system_request_context()); |
| - } |
| - |
| // Create watchdog thread after creating all other threads because it will |
| // watch the other threads and they must be running. |
| browser_process_->watchdog_thread(); |