| 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 | 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 "chrome/browser/metrics/metrics_reporting_state.h" | 13 #include "chrome/browser/metrics/metrics_reporting_state.h" |
| 14 #include "components/metrics/metrics_service_accessor.h" | 14 #include "components/metrics/metrics_service_accessor.h" |
| 15 | 15 |
| 16 class BrowserProcessImpl; | 16 class BrowserProcessImpl; |
| 17 class Profile; | 17 class Profile; |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 class CrashesDOMHandler; | 20 class CrashesDOMHandler; |
| 21 class FlashDOMHandler; | 21 class FlashDOMHandler; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace chrome { |
| 25 void AttemptRestart(); |
| 26 } |
| 27 |
| 24 namespace chrome_browser { | 28 namespace chrome_browser { |
| 25 void SetupPreReadFieldTrial(); | 29 void SetupPreReadFieldTrial(); |
| 26 } | 30 } |
| 27 | 31 |
| 28 namespace component_updater { | 32 namespace component_updater { |
| 29 class ComponentUpdateService; | 33 class ComponentUpdateService; |
| 30 } | 34 } |
| 31 | 35 |
| 32 namespace domain_reliability { | 36 namespace domain_reliability { |
| 33 class DomainReliabilityServiceFactory; | 37 class DomainReliabilityServiceFactory; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 48 } | 52 } |
| 49 | 53 |
| 50 namespace safe_browsing { | 54 namespace safe_browsing { |
| 51 class DownloadSBClient; | 55 class DownloadSBClient; |
| 52 class IncidentReportingService; | 56 class IncidentReportingService; |
| 53 class SafeBrowsingService; | 57 class SafeBrowsingService; |
| 54 class SafeBrowsingUIManager; | 58 class SafeBrowsingUIManager; |
| 55 class SRTFetcher; | 59 class SRTFetcher; |
| 56 } | 60 } |
| 57 | 61 |
| 58 namespace settings { | |
| 59 class SystemHandler; | |
| 60 } | |
| 61 | |
| 62 namespace speech { | 62 namespace speech { |
| 63 class ChromeSpeechRecognitionManagerDelegate; | 63 class ChromeSpeechRecognitionManagerDelegate; |
| 64 } | 64 } |
| 65 | 65 |
| 66 namespace system_logs { | 66 namespace system_logs { |
| 67 class ChromeInternalLogSource; | 67 class ChromeInternalLogSource; |
| 68 } | 68 } |
| 69 | 69 |
| 70 // This class limits and documents access to metrics service helper methods. | 70 // This class limits and documents access to metrics service helper methods. |
| 71 // Since these methods are private, each user has to be explicitly declared | 71 // Since these methods are private, each user has to be explicitly declared |
| 72 // as a 'friend' below. | 72 // as a 'friend' below. |
| 73 class ChromeMetricsServiceAccessor : public metrics::MetricsServiceAccessor { | 73 class ChromeMetricsServiceAccessor : public metrics::MetricsServiceAccessor { |
| 74 private: | 74 private: |
| 75 friend class ::CrashesDOMHandler; | 75 friend class ::CrashesDOMHandler; |
| 76 friend class ::FlashDOMHandler; | 76 friend class ::FlashDOMHandler; |
| 77 friend class ArcSupportHost; | 77 friend class ArcSupportHost; |
| 78 friend class BrowserProcessImpl; | 78 friend class BrowserProcessImpl; |
| 79 friend void chrome::AttemptRestart(); |
| 79 friend void chrome_browser::SetupPreReadFieldTrial(); | 80 friend void chrome_browser::SetupPreReadFieldTrial(); |
| 80 friend class ChromeMetricsServicesManagerClient; | 81 friend class ChromeMetricsServicesManagerClient; |
| 81 friend class ChromeRenderMessageFilter; | 82 friend class ChromeRenderMessageFilter; |
| 82 friend class DataReductionProxyChromeSettings; | 83 friend class DataReductionProxyChromeSettings; |
| 83 friend class domain_reliability::DomainReliabilityServiceFactory; | 84 friend class domain_reliability::DomainReliabilityServiceFactory; |
| 84 friend class extensions::ChromeExtensionWebContentsObserver; | 85 friend class extensions::ChromeExtensionWebContentsObserver; |
| 85 friend class extensions::FileManagerPrivateIsUMAEnabledFunction; | 86 friend class extensions::FileManagerPrivateIsUMAEnabledFunction; |
| 86 friend class extensions::MetricsPrivateGetIsCrashReportingEnabledFunction; | 87 friend class extensions::MetricsPrivateGetIsCrashReportingEnabledFunction; |
| 87 friend void InitiateMetricsReportingChange( | 88 friend void InitiateMetricsReportingChange( |
| 88 bool, const OnMetricsReportingCallbackType&); | 89 bool, const OnMetricsReportingCallbackType&); |
| 89 friend class options::BrowserOptionsHandler; | 90 friend class options::BrowserOptionsHandler; |
| 90 friend bool prerender::IsOmniboxEnabled(Profile* profile); | 91 friend bool prerender::IsOmniboxEnabled(Profile* profile); |
| 91 friend class safe_browsing::IncidentReportingService; | 92 friend class safe_browsing::IncidentReportingService; |
| 92 friend class speech::ChromeSpeechRecognitionManagerDelegate; | 93 friend class speech::ChromeSpeechRecognitionManagerDelegate; |
| 93 friend class StackSamplingConfiguration; | 94 friend class StackSamplingConfiguration; |
| 94 friend class system_logs::ChromeInternalLogSource; | 95 friend class system_logs::ChromeInternalLogSource; |
| 95 friend class UmaSessionStats; | 96 friend class UmaSessionStats; |
| 96 friend class safe_browsing::SRTFetcher; | 97 friend class safe_browsing::SRTFetcher; |
| 97 friend class safe_browsing::DownloadSBClient; | 98 friend class safe_browsing::DownloadSBClient; |
| 98 friend class safe_browsing::SafeBrowsingService; | 99 friend class safe_browsing::SafeBrowsingService; |
| 99 friend class safe_browsing::SafeBrowsingUIManager; | 100 friend class safe_browsing::SafeBrowsingUIManager; |
| 100 friend class settings::SystemHandler; | |
| 101 friend void SyzyASANRegisterExperiment(const char*, const char*); | 101 friend void SyzyASANRegisterExperiment(const char*, const char*); |
| 102 | 102 |
| 103 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, | 103 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, |
| 104 MetricsReportingEnabled); | 104 MetricsReportingEnabled); |
| 105 | 105 |
| 106 // Returns true if metrics reporting is enabled. | 106 // Returns true if metrics reporting is enabled. |
| 107 // TODO(gayane): Consolidate metric prefs on all platforms. | 107 // TODO(gayane): Consolidate metric prefs on all platforms. |
| 108 // http://crbug.com/362192, http://crbug.com/532084 | 108 // http://crbug.com/362192, http://crbug.com/532084 |
| 109 static bool IsMetricsAndCrashReportingEnabled(); | 109 static bool IsMetricsAndCrashReportingEnabled(); |
| 110 | 110 |
| 111 // Calls metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrial() with | 111 // Calls metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrial() with |
| 112 // g_browser_process->metrics_service(). See that function's declaration for | 112 // g_browser_process->metrics_service(). See that function's declaration for |
| 113 // details. | 113 // details. |
| 114 static bool RegisterSyntheticFieldTrial(const std::string& trial_name, | 114 static bool RegisterSyntheticFieldTrial(const std::string& trial_name, |
| 115 const std::string& group_name); | 115 const std::string& group_name); |
| 116 | 116 |
| 117 // Calls | 117 // Calls |
| 118 // metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrialWithNameHash() | 118 // metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrialWithNameHash() |
| 119 // with g_browser_process->metrics_service(). See that function's declaration | 119 // with g_browser_process->metrics_service(). See that function's declaration |
| 120 // for details. | 120 // for details. |
| 121 static bool RegisterSyntheticFieldTrialWithNameHash( | 121 static bool RegisterSyntheticFieldTrialWithNameHash( |
| 122 uint32_t trial_name_hash, | 122 uint32_t trial_name_hash, |
| 123 const std::string& group_name); | 123 const std::string& group_name); |
| 124 | 124 |
| 125 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor); | 125 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | 128 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ |
| OLD | NEW |