Chromium Code Reviews| 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/chrome_metrics_service_accessor.h" | 5 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
| 10 #include "components/metrics/metrics_service.h" | 10 #include "components/metrics/metrics_service.h" |
| 11 #include "components/variations/metrics_util.h" | |
| 11 | 12 |
| 12 #if defined(OS_CHROMEOS) | 13 #if defined(OS_CHROMEOS) |
| 13 #include "chrome/browser/chromeos/settings/cros_settings.h" | 14 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 14 #endif | 15 #endif |
| 15 | 16 |
| 16 // static | 17 // static |
| 17 bool ChromeMetricsServiceAccessor::IsMetricsReportingEnabled() { | 18 bool ChromeMetricsServiceAccessor::IsMetricsReportingEnabled() { |
| 18 bool result = false; | 19 bool result = false; |
| 19 const PrefService* local_state = g_browser_process->local_state(); | 20 const PrefService* local_state = g_browser_process->local_state(); |
| 20 if (local_state) { | 21 if (local_state) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 39 // Android has its own settings for metrics / crash uploading. | 40 // Android has its own settings for metrics / crash uploading. |
| 40 const PrefService* prefs = g_browser_process->local_state(); | 41 const PrefService* prefs = g_browser_process->local_state(); |
| 41 return prefs->GetBoolean(prefs::kCrashReportingEnabled); | 42 return prefs->GetBoolean(prefs::kCrashReportingEnabled); |
| 42 #else | 43 #else |
| 43 return ChromeMetricsServiceAccessor::IsMetricsReportingEnabled(); | 44 return ChromeMetricsServiceAccessor::IsMetricsReportingEnabled(); |
| 44 #endif | 45 #endif |
| 45 #else | 46 #else |
| 46 return false; | 47 return false; |
| 47 #endif | 48 #endif |
| 48 } | 49 } |
| 50 | |
| 51 // static | |
| 52 void ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( | |
| 53 std::string trial, std::string group) { | |
| 54 if (g_browser_process->metrics_service()) { | |
|
bengr
2014/07/30 19:08:22
Would we ever not have a metrics_service? It would
megjablon
2014/07/30 21:27:07
g_browser_process->metrics_service() may return nu
| |
| 55 SyntheticTrialGroup trial_group(metrics::HashName(trial), | |
| 56 metrics::HashName(group)); | |
| 57 g_browser_process->metrics_service()->RegisterSyntheticFieldTrial( | |
| 58 trial_group); | |
| 59 } | |
| 60 } | |
| OLD | NEW |