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 21 matching lines...) Expand all Loading... |
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 } |
49 | 50 |
50 // static | 51 // static |
51 bool ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( | 52 bool ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( |
52 const std::string& trial, const std::string& group) { | 53 const std::string& trial_name, |
| 54 const std::string& group_name) { |
| 55 return RegisterSyntheticFieldTrialWithNameHash(metrics::HashName(trial_name), |
| 56 group_name); |
| 57 } |
| 58 |
| 59 // static |
| 60 bool ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrialWithNameHash( |
| 61 uint32_t trial_name_hash, |
| 62 const std::string& group_name) { |
53 return MetricsServiceAccessor::RegisterSyntheticFieldTrial( | 63 return MetricsServiceAccessor::RegisterSyntheticFieldTrial( |
54 g_browser_process->metrics_service(), | 64 g_browser_process->metrics_service(), |
55 trial, | 65 trial_name_hash, |
56 group); | 66 metrics::HashName(group_name)); |
57 } | 67 } |
OLD | NEW |