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 "components/metrics/metrics_service_accessor.h" | 5 #include "components/metrics/metrics_service_accessor.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "components/metrics/metrics_pref_names.h" | 10 #include "components/metrics/metrics_pref_names.h" |
11 #include "components/metrics/metrics_service.h" | 11 #include "components/metrics/metrics_service.h" |
12 #include "components/variations/metrics_util.h" | 12 #include "components/variations/metrics_util.h" |
13 | 13 |
14 namespace metrics { | 14 namespace metrics { |
15 | 15 |
16 // static | 16 // static |
17 bool MetricsServiceAccessor::IsMetricsReportingEnabled( | 17 bool MetricsServiceAccessor::IsMetricsReportingEnabled( |
18 PrefService* pref_service) { | 18 PrefService* pref_service) { |
19 return IsMetricsReportingEnabledWithPrefValue( | 19 // Testing Metrics -- DO NOT COMMIT |
Alexei Svitkine (slow)
2016/01/18 19:25:36
Remove. This is also responsible for a few red bot
bcwhite
2016/01/22 15:24:53
Done.
| |
20 return true || IsMetricsReportingEnabledWithPrefValue( | |
20 pref_service->GetBoolean(prefs::kMetricsReportingEnabled)); | 21 pref_service->GetBoolean(prefs::kMetricsReportingEnabled)); |
21 } | 22 } |
22 | 23 |
23 // static | 24 // static |
24 bool MetricsServiceAccessor::IsMetricsReportingEnabledWithPrefValue( | 25 bool MetricsServiceAccessor::IsMetricsReportingEnabledWithPrefValue( |
25 bool enabled_in_prefs) { | 26 bool enabled_in_prefs) { |
26 #if defined(GOOGLE_CHROME_BUILD) | 27 #if defined(GOOGLE_CHROME_BUILD) |
27 // In official builds, disable metrics when reporting field trials are | 28 // In official builds, disable metrics when reporting field trials are |
28 // forced; otherwise, use the value of the user's preference to determine | 29 // forced; otherwise, use the value of the user's preference to determine |
29 // whether to enable metrics reporting. | 30 // whether to enable metrics reporting. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 uint32_t group_name_hash) { | 62 uint32_t group_name_hash) { |
62 if (!metrics_service) | 63 if (!metrics_service) |
63 return false; | 64 return false; |
64 | 65 |
65 variations::SyntheticTrialGroup trial_group(trial_name_hash, group_name_hash); | 66 variations::SyntheticTrialGroup trial_group(trial_name_hash, group_name_hash); |
66 metrics_service->RegisterSyntheticFieldTrial(trial_group); | 67 metrics_service->RegisterSyntheticFieldTrial(trial_group); |
67 return true; | 68 return true; |
68 } | 69 } |
69 | 70 |
70 } // namespace metrics | 71 } // namespace metrics |
OLD | NEW |