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 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_ACCESSOR_H_ | 5 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_ACCESSOR_H_ |
6 #define COMPONENTS_METRICS_METRICS_SERVICE_ACCESSOR_H_ | 6 #define COMPONENTS_METRICS_METRICS_SERVICE_ACCESSOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 11 matching lines...) Expand all Loading... |
22 // specialization and enable access there by declaring friends. | 22 // specialization and enable access there by declaring friends. |
23 class MetricsServiceAccessor { | 23 class MetricsServiceAccessor { |
24 protected: | 24 protected: |
25 // Constructor declared as protected to enable inheritance. Descendants should | 25 // Constructor declared as protected to enable inheritance. Descendants should |
26 // disallow instantiation. | 26 // disallow instantiation. |
27 MetricsServiceAccessor() {} | 27 MetricsServiceAccessor() {} |
28 | 28 |
29 // Returns whether metrics reporting is enabled, using the value of the | 29 // Returns whether metrics reporting is enabled, using the value of the |
30 // kMetricsReportingEnabled pref in |pref_service| to determine whether user | 30 // kMetricsReportingEnabled pref in |pref_service| to determine whether user |
31 // has enabled reporting. | 31 // has enabled reporting. |
32 // NOTE: This method currently does not return the correct value on ChromeOS | |
33 // and Android due to http://crbug.com/362192 and http://crbug.com/532084. See | |
34 // ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled(). | |
35 static bool IsMetricsReportingEnabled(PrefService* pref_service); | 32 static bool IsMetricsReportingEnabled(PrefService* pref_service); |
36 | 33 |
37 // Returns whether metrics reporting is enabled, using the value of | |
38 // |enabled_in_prefs| to determine whether the user has enabled reporting. | |
39 // Exists because kMetricsReportingEnabled is currently not used on all | |
40 // platforms. | |
41 // TODO(gayane): Consolidate metric prefs on all platforms and eliminate this | |
42 // method. http://crbug.com/362192, http://crbug.com/532084 | |
43 static bool IsMetricsReportingEnabledWithPrefValue(bool enabled_in_prefs); | |
44 | 34 |
45 // Registers a field trial name and group with |metrics_service| (if not | 35 // Registers a field trial name and group with |metrics_service| (if not |
46 // null), to be used to annotate a UMA report with a particular configuration | 36 // null), to be used to annotate a UMA report with a particular configuration |
47 // state. Returns true on success. | 37 // state. Returns true on success. |
48 // See the comment on MetricsService::RegisterSyntheticFieldTrial() for | 38 // See the comment on MetricsService::RegisterSyntheticFieldTrial() for |
49 // details. | 39 // details. |
50 static bool RegisterSyntheticFieldTrial(MetricsService* metrics_service, | 40 static bool RegisterSyntheticFieldTrial(MetricsService* metrics_service, |
51 const std::string& trial_name, | 41 const std::string& trial_name, |
52 const std::string& group_name); | 42 const std::string& group_name); |
53 | 43 |
(...skipping 21 matching lines...) Expand all Loading... |
75 uint32_t trial_name_hash, | 65 uint32_t trial_name_hash, |
76 uint32_t group_name_hash); | 66 uint32_t group_name_hash); |
77 | 67 |
78 private: | 68 private: |
79 DISALLOW_COPY_AND_ASSIGN(MetricsServiceAccessor); | 69 DISALLOW_COPY_AND_ASSIGN(MetricsServiceAccessor); |
80 }; | 70 }; |
81 | 71 |
82 } // namespace metrics | 72 } // namespace metrics |
83 | 73 |
84 #endif // COMPONENTS_METRICS_METRICS_SERVICE_ACCESSOR_H_ | 74 #endif // COMPONENTS_METRICS_METRICS_SERVICE_ACCESSOR_H_ |
OLD | NEW |