| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/metrics/metrics_services_manager.h" | 5 #include "chrome/browser/metrics/metrics_services_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 return metrics_state_manager_.get(); | 83 return metrics_state_manager_.get(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 // TODO(asvitkine): This function does not report the correct value on Android, | 86 // TODO(asvitkine): This function does not report the correct value on Android, |
| 87 // see http://crbug.com/362192. | 87 // see http://crbug.com/362192. |
| 88 bool MetricsServicesManager::IsMetricsReportingEnabled() const { | 88 bool MetricsServicesManager::IsMetricsReportingEnabled() const { |
| 89 // If the user permits metrics reporting with the checkbox in the | 89 // If the user permits metrics reporting with the checkbox in the |
| 90 // prefs, we turn on recording. We disable metrics completely for | 90 // prefs, we turn on recording. We disable metrics completely for |
| 91 // non-official builds, or when field trials are forced. | 91 // non-official builds, or when field trials are forced. |
| 92 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kForceFieldTrials)) | 92 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 93 switches::kForceFieldTrials)) |
| 93 return false; | 94 return false; |
| 94 | 95 |
| 95 bool enabled = false; | 96 bool enabled = false; |
| 96 #if defined(GOOGLE_CHROME_BUILD) | 97 #if defined(GOOGLE_CHROME_BUILD) |
| 97 #if defined(OS_CHROMEOS) | 98 #if defined(OS_CHROMEOS) |
| 98 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, | 99 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
| 99 &enabled); | 100 &enabled); |
| 100 #else | 101 #else |
| 101 enabled = local_state_->GetBoolean(prefs::kMetricsReportingEnabled); | 102 enabled = local_state_->GetBoolean(prefs::kMetricsReportingEnabled); |
| 102 #endif // #if defined(OS_CHROMEOS) | 103 #endif // #if defined(OS_CHROMEOS) |
| 103 #endif // defined(GOOGLE_CHROME_BUILD) | 104 #endif // defined(GOOGLE_CHROME_BUILD) |
| 104 return enabled; | 105 return enabled; |
| 105 } | 106 } |
| OLD | NEW |