OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | 5 #ifndef IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_ACCESSOR_H_ |
6 #define IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | 6 #define IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_ACCESSOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "components/metrics/metrics_service_accessor.h" | 13 #include "components/metrics/metrics_service_accessor.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 class CrashesDOMHandler; | 16 class CrashesDOMHandler; |
17 } | 17 } |
18 | 18 |
19 // This class limits and documents access to metrics service helper methods. | 19 // This class limits and documents access to metrics service helper methods. |
20 // Since these methods are private, each user has to be explicitly declared | 20 // Since these methods are private, each user has to be explicitly declared |
21 // as a 'friend' below. | 21 // as a 'friend' below. |
22 class IOSChromeMetricsServiceAccessor : public metrics::MetricsServiceAccessor { | 22 class IOSChromeMetricsServiceAccessor : public metrics::MetricsServiceAccessor { |
23 private: | 23 private: |
| 24 friend class IOSChromeMetricsServicesManagerClient; |
| 25 |
24 // TODO(blundell): Remove these //chrome classes as friends once they're no | 26 // TODO(blundell): Remove these //chrome classes as friends once they're no |
25 // longer used by the iOS port. | 27 // longer used by the iOS port. |
26 friend class ::CrashesDOMHandler; | 28 friend class ::CrashesDOMHandler; |
27 friend class DataReductionProxyChromeSettings; | 29 friend class DataReductionProxyChromeSettings; |
28 friend class MetricsServicesManager; | |
29 | 30 |
30 FRIEND_TEST_ALL_PREFIXES(IOSChromeMetricsServiceAccessorTest, | 31 FRIEND_TEST_ALL_PREFIXES(IOSChromeMetricsServiceAccessorTest, |
31 MetricsReportingEnabled); | 32 MetricsReportingEnabled); |
32 | 33 |
33 // Returns true if metrics reporting is enabled. | 34 // Returns true if metrics reporting is enabled. |
34 static bool IsMetricsAndCrashReportingEnabled(); | 35 static bool IsMetricsAndCrashReportingEnabled(); |
35 | 36 |
36 // Calls metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrial() with | 37 // Calls metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrial() with |
37 // ApplicationContext's MetricsService. See that function's declaration for | 38 // ApplicationContext's MetricsService. See that function's declaration for |
38 // details. | 39 // details. |
39 static bool RegisterSyntheticFieldTrial(const std::string& trial_name, | 40 static bool RegisterSyntheticFieldTrial(const std::string& trial_name, |
40 const std::string& group_name); | 41 const std::string& group_name); |
41 | 42 |
42 // Calls | 43 // Calls |
43 // metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrialWithNameHash() | 44 // metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrialWithNameHash() |
44 // with ApplicationContext's MetricsService. See that function's declaration | 45 // with ApplicationContext's MetricsService. See that function's declaration |
45 // for details. | 46 // for details. |
46 static bool RegisterSyntheticFieldTrialWithNameHash( | 47 static bool RegisterSyntheticFieldTrialWithNameHash( |
47 uint32_t trial_name_hash, | 48 uint32_t trial_name_hash, |
48 const std::string& group_name); | 49 const std::string& group_name); |
49 | 50 |
50 DISALLOW_IMPLICIT_CONSTRUCTORS(IOSChromeMetricsServiceAccessor); | 51 DISALLOW_IMPLICIT_CONSTRUCTORS(IOSChromeMetricsServiceAccessor); |
51 }; | 52 }; |
52 | 53 |
53 #endif // IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | 54 #endif // IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_ACCESSOR_H_ |
OLD | NEW |