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 CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | 5 #ifndef CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ |
6 #define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | 6 #define CHROME_BROWSER_METRICS_CHROME_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> |
11 | 11 |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "chrome/browser/metrics/metrics_reporting_state.h" | 14 #include "chrome/browser/metrics/metrics_reporting_state.h" |
15 #include "components/metrics/metrics_service_accessor.h" | 15 #include "components/metrics/metrics_service_accessor.h" |
16 | 16 |
17 class BrowserProcessImpl; | 17 class BrowserProcessImpl; |
18 class Profile; | 18 class Profile; |
19 class ChromeMetricsServiceClient; | 19 class ChromeMetricsServiceClient; |
| 20 class ChromePasswordManagerClient; |
20 | 21 |
21 namespace { | 22 namespace { |
22 class CrashesDOMHandler; | 23 class CrashesDOMHandler; |
23 class FlashDOMHandler; | 24 class FlashDOMHandler; |
24 } | 25 } |
25 | 26 |
26 namespace chrome { | 27 namespace chrome { |
27 void AttemptRestart(); | 28 void AttemptRestart(); |
28 namespace android { | 29 namespace android { |
29 class ExternalDataUseObserverBridge; | 30 class ExternalDataUseObserverBridge; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 75 } |
75 | 76 |
76 namespace system_logs { | 77 namespace system_logs { |
77 class ChromeInternalLogSource; | 78 class ChromeInternalLogSource; |
78 } | 79 } |
79 | 80 |
80 // This class limits and documents access to metrics service helper methods. | 81 // This class limits and documents access to metrics service helper methods. |
81 // Since these methods are private, each user has to be explicitly declared | 82 // Since these methods are private, each user has to be explicitly declared |
82 // as a 'friend' below. | 83 // as a 'friend' below. |
83 class ChromeMetricsServiceAccessor : public metrics::MetricsServiceAccessor { | 84 class ChromeMetricsServiceAccessor : public metrics::MetricsServiceAccessor { |
| 85 public: |
| 86 // This test method is public so tests don't need to befriend this class. |
| 87 |
| 88 // If arg is non-null, the value will be returned from future calls to |
| 89 // IsMetricsAndCrashReportingEnabled(). Pointer must be valid until |
| 90 // it is reset to null here. |
| 91 static void SetMetricsAndCrashReportingForTesting(const bool* value); |
| 92 |
84 private: | 93 private: |
85 friend class ::CrashesDOMHandler; | 94 friend class ::CrashesDOMHandler; |
86 friend class ::FlashDOMHandler; | 95 friend class ::FlashDOMHandler; |
87 friend class ArcSupportHost; | 96 friend class ArcSupportHost; |
88 friend class BrowserProcessImpl; | 97 friend class BrowserProcessImpl; |
89 friend void chrome::AttemptRestart(); | 98 friend void chrome::AttemptRestart(); |
90 friend void chrome_browser::SetupPreReadFieldTrial(); | 99 friend void chrome_browser::SetupPreReadFieldTrial(); |
91 friend class chrome::android::ExternalDataUseObserverBridge; | 100 friend class chrome::android::ExternalDataUseObserverBridge; |
92 friend class ChromeMetricsServicesManagerClient; | 101 friend class ChromeMetricsServicesManagerClient; |
93 friend class ChromeRenderMessageFilter; | 102 friend class ChromeRenderMessageFilter; |
(...skipping 13 matching lines...) Expand all Loading... |
107 friend class StackSamplingConfiguration; | 116 friend class StackSamplingConfiguration; |
108 friend class system_logs::ChromeInternalLogSource; | 117 friend class system_logs::ChromeInternalLogSource; |
109 friend class UmaSessionStats; | 118 friend class UmaSessionStats; |
110 friend class safe_browsing::SRTFetcher; | 119 friend class safe_browsing::SRTFetcher; |
111 friend class safe_browsing::SRTGlobalError; | 120 friend class safe_browsing::SRTGlobalError; |
112 friend class safe_browsing::DownloadSBClient; | 121 friend class safe_browsing::DownloadSBClient; |
113 friend class safe_browsing::SafeBrowsingService; | 122 friend class safe_browsing::SafeBrowsingService; |
114 friend class safe_browsing::SafeBrowsingUIManager; | 123 friend class safe_browsing::SafeBrowsingUIManager; |
115 friend void SyzyASANRegisterExperiment(const char*, const char*); | 124 friend void SyzyASANRegisterExperiment(const char*, const char*); |
116 friend class ChromeMetricsServiceClient; | 125 friend class ChromeMetricsServiceClient; |
| 126 friend class ChromePasswordManagerClient; |
117 | 127 |
118 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, | 128 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, |
119 MetricsReportingEnabled); | 129 MetricsReportingEnabled); |
120 | 130 |
121 // Returns true if metrics reporting is enabled. | 131 // Returns true if metrics reporting is enabled. |
122 // TODO(gayane): Consolidate metric prefs on all platforms. | 132 // TODO(gayane): Consolidate metric prefs on all platforms. |
123 // http://crbug.com/362192, http://crbug.com/532084 | 133 // http://crbug.com/362192, http://crbug.com/532084 |
124 static bool IsMetricsAndCrashReportingEnabled(); | 134 static bool IsMetricsAndCrashReportingEnabled(); |
125 | 135 |
126 // Calls metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrial() with | 136 // Calls metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrial() with |
(...skipping 14 matching lines...) Expand all Loading... |
141 // with g_browser_process->metrics_service(). See that function's declaration | 151 // with g_browser_process->metrics_service(). See that function's declaration |
142 // for details. | 152 // for details. |
143 static bool RegisterSyntheticFieldTrialWithNameHash( | 153 static bool RegisterSyntheticFieldTrialWithNameHash( |
144 uint32_t trial_name_hash, | 154 uint32_t trial_name_hash, |
145 const std::string& group_name); | 155 const std::string& group_name); |
146 | 156 |
147 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor); | 157 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor); |
148 }; | 158 }; |
149 | 159 |
150 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | 160 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ |
OLD | NEW |