Chromium Code Reviews| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 friend class StackSamplingConfiguration; | 108 friend class StackSamplingConfiguration; |
| 108 friend class system_logs::ChromeInternalLogSource; | 109 friend class system_logs::ChromeInternalLogSource; |
| 109 friend class UmaSessionStats; | 110 friend class UmaSessionStats; |
| 110 friend class safe_browsing::SRTFetcher; | 111 friend class safe_browsing::SRTFetcher; |
| 111 friend class safe_browsing::SRTGlobalError; | 112 friend class safe_browsing::SRTGlobalError; |
| 112 friend class safe_browsing::DownloadSBClient; | 113 friend class safe_browsing::DownloadSBClient; |
| 113 friend class safe_browsing::SafeBrowsingService; | 114 friend class safe_browsing::SafeBrowsingService; |
| 114 friend class safe_browsing::SafeBrowsingUIManager; | 115 friend class safe_browsing::SafeBrowsingUIManager; |
| 115 friend void SyzyASANRegisterExperiment(const char*, const char*); | 116 friend void SyzyASANRegisterExperiment(const char*, const char*); |
| 116 friend class ChromeMetricsServiceClient; | 117 friend class ChromeMetricsServiceClient; |
| 118 friend class ChromePasswordManagerClient; | |
| 117 | 119 |
| 118 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, | 120 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, |
| 119 MetricsReportingEnabled); | 121 MetricsReportingEnabled); |
| 122 FRIEND_TEST_ALL_PREFIXES(ChromePasswordManagerClientTest, | |
| 123 ShouldAnnotateNavigationEntry); | |
| 124 | |
| 120 | 125 |
| 121 // Returns true if metrics reporting is enabled. | 126 // Returns true if metrics reporting is enabled. |
| 122 // TODO(gayane): Consolidate metric prefs on all platforms. | 127 // TODO(gayane): Consolidate metric prefs on all platforms. |
| 123 // http://crbug.com/362192, http://crbug.com/532084 | 128 // http://crbug.com/362192, http://crbug.com/532084 |
| 124 static bool IsMetricsAndCrashReportingEnabled(); | 129 static bool IsMetricsAndCrashReportingEnabled(); |
| 125 | 130 |
| 131 | |
| 132 // If poiner is non-null, the value will be returned from | |
| 133 // IsMetricsAndCrashReportingEnabled(). Pointer must be valid until | |
| 134 // it is reset to null. | |
| 135 static void SetMetricsAndCrashReportingForTesting(const bool* value); | |
|
Alexei Svitkine (slow)
2016/09/02 18:05:45
I'm OK with this being public so that further test
Nathan Parker
2016/09/02 22:42:36
Done.
| |
| 136 | |
| 126 // Calls metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrial() with | 137 // Calls metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrial() with |
| 127 // g_browser_process->metrics_service(). See that function's declaration for | 138 // g_browser_process->metrics_service(). See that function's declaration for |
| 128 // details. | 139 // details. |
| 129 static bool RegisterSyntheticFieldTrial(const std::string& trial_name, | 140 static bool RegisterSyntheticFieldTrial(const std::string& trial_name, |
| 130 const std::string& group_name); | 141 const std::string& group_name); |
| 131 | 142 |
| 132 // Calls MetricsServiceAccessor::RegisterSyntheticMultiGroupFieldTrial() with | 143 // Calls MetricsServiceAccessor::RegisterSyntheticMultiGroupFieldTrial() with |
| 133 // g_browser_process->metrics_service(). See that function's declaration for | 144 // g_browser_process->metrics_service(). See that function's declaration for |
| 134 // details. | 145 // details. |
| 135 static bool RegisterSyntheticMultiGroupFieldTrial( | 146 static bool RegisterSyntheticMultiGroupFieldTrial( |
| 136 const std::string& trial_name, | 147 const std::string& trial_name, |
| 137 const std::vector<uint32_t>& group_name_hashes); | 148 const std::vector<uint32_t>& group_name_hashes); |
| 138 | 149 |
| 139 // Calls | 150 // Calls |
| 140 // metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrialWithNameHash() | 151 // metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrialWithNameHash() |
| 141 // with g_browser_process->metrics_service(). See that function's declaration | 152 // with g_browser_process->metrics_service(). See that function's declaration |
| 142 // for details. | 153 // for details. |
| 143 static bool RegisterSyntheticFieldTrialWithNameHash( | 154 static bool RegisterSyntheticFieldTrialWithNameHash( |
| 144 uint32_t trial_name_hash, | 155 uint32_t trial_name_hash, |
| 145 const std::string& group_name); | 156 const std::string& group_name); |
| 146 | 157 |
| 147 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor); | 158 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor); |
| 148 }; | 159 }; |
| 149 | 160 |
| 150 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | 161 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ |
| OLD | NEW |