Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 10830241: Inform GetEntropySource of whether or not metrics reporting will be enabled. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: thakis nit Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/metrics/metrics_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 84a6a510644adb096528bc9aec9626c23a70a138..712489da54fe81b72459e8ecf8133cb0105bd683 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -540,10 +540,12 @@ void ChromeBrowserMainParts::SetupMetricsAndFieldTrials() {
// Initialize FieldTrialList to support FieldTrials that use one-time
// randomization.
MetricsService* metrics = browser_process_->metrics_service();
- if (IsMetricsReportingEnabled())
+ bool metrics_reporting_enabled = IsMetricsReportingEnabled();
+ if (metrics_reporting_enabled)
metrics->ForceClientIdCreation(); // Needed below.
field_trial_list_.reset(
- new base::FieldTrialList(metrics->GetEntropySource()));
+ new base::FieldTrialList(
+ metrics->GetEntropySource(metrics_reporting_enabled)));
// Ensure any field trials specified on the command line are initialized.
// Also stop the metrics service so that we don't pollute UMA.
@@ -593,11 +595,14 @@ void ChromeBrowserMainParts::StartMetricsRecording() {
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.
+ // 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;
#ifndef NDEBUG
// The debug build doesn't send UMA logs when FieldTrials are forced.
- const CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kForceFieldTrials))
return false;
#endif // #ifndef NDEBUG
« no previous file with comments | « no previous file | chrome/browser/metrics/metrics_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698