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 <string> | |
| 9 | |
| 8 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "chrome/browser/metrics/metrics_service_accessor.h" | 12 #include "chrome/browser/metrics/metrics_service_accessor.h" |
| 11 | 13 |
| 12 class ChromeBrowserMetricsServiceObserver; | 14 class ChromeBrowserMetricsServiceObserver; |
| 13 class Profile; | 15 class Profile; |
| 14 | 16 |
| 15 namespace { | 17 namespace { |
| 16 class CrashesDOMHandler; | 18 class CrashesDOMHandler; |
| 17 class FlashDOMHandler; | 19 class FlashDOMHandler; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 33 | 35 |
| 34 // This class limits and documents access to metrics service helper methods. | 36 // This class limits and documents access to metrics service helper methods. |
| 35 // Since these methods are private, each user has to be explicitly declared | 37 // Since these methods are private, each user has to be explicitly declared |
| 36 // as a 'friend' below. | 38 // as a 'friend' below. |
| 37 class ChromeMetricsServiceAccessor : public MetricsServiceAccessor { | 39 class ChromeMetricsServiceAccessor : public MetricsServiceAccessor { |
| 38 private: | 40 private: |
| 39 friend bool prerender::IsOmniboxEnabled(Profile* profile); | 41 friend bool prerender::IsOmniboxEnabled(Profile* profile); |
| 40 friend class ::ChromeBrowserMetricsServiceObserver; | 42 friend class ::ChromeBrowserMetricsServiceObserver; |
| 41 friend class ChromeRenderMessageFilter; | 43 friend class ChromeRenderMessageFilter; |
| 42 friend class ::CrashesDOMHandler; | 44 friend class ::CrashesDOMHandler; |
| 45 friend class DataReductionProxyChromeSettings; | |
| 43 friend class extensions::ExtensionDownloader; | 46 friend class extensions::ExtensionDownloader; |
| 44 friend class extensions::ManifestFetchData; | 47 friend class extensions::ManifestFetchData; |
| 45 friend class extensions::MetricsPrivateGetIsCrashReportingEnabledFunction; | 48 friend class extensions::MetricsPrivateGetIsCrashReportingEnabledFunction; |
| 46 friend class ::FlashDOMHandler; | 49 friend class ::FlashDOMHandler; |
| 47 friend class system_logs::ChromeInternalLogSource; | 50 friend class system_logs::ChromeInternalLogSource; |
| 48 | 51 |
| 49 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, | 52 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, |
| 50 MetricsReportingEnabled); | 53 MetricsReportingEnabled); |
| 51 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, | 54 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, |
| 52 CrashReportingEnabled); | 55 CrashReportingEnabled); |
| 53 | 56 |
| 54 // Returns true if prefs::kMetricsReportingEnabled is set. | 57 // Returns true if prefs::kMetricsReportingEnabled is set. |
| 55 // TODO(asvitkine): Consolidate the method in MetricsStateManager. | 58 // TODO(asvitkine): Consolidate the method in MetricsStateManager. |
| 56 // TODO(asvitkine): This function does not report the correct value on | 59 // TODO(asvitkine): This function does not report the correct value on |
| 57 // Android and ChromeOS, see http://crbug.com/362192. | 60 // Android and ChromeOS, see http://crbug.com/362192. |
| 58 static bool IsMetricsReportingEnabled(); | 61 static bool IsMetricsReportingEnabled(); |
| 59 | 62 |
| 60 // Returns true if crash reporting is enabled. This is set at the platform | 63 // Returns true if crash reporting is enabled. This is set at the platform |
| 61 // level for Android and ChromeOS, and otherwise is the same as | 64 // level for Android and ChromeOS, and otherwise is the same as |
| 62 // IsMetricsReportingEnabled for desktop Chrome. | 65 // IsMetricsReportingEnabled for desktop Chrome. |
| 63 static bool IsCrashReportingEnabled(); | 66 static bool IsCrashReportingEnabled(); |
| 64 | 67 |
| 68 // Registers a field trial name and group to be used to annotate a UMA report | |
| 69 // with a particular Chrome configuration state. A UMA report will be | |
| 70 // annotated with this trial group if and only if all events in the report | |
| 71 // were created after the trial is registered. Only one group name may be | |
| 72 // registered at a time for a given trial_name. Only the last group name that | |
| 73 // is registered for a given trial name will be recorded. The values passed | |
| 74 // in must not correspond to any real field trial in the code. | |
| 75 static void RegisterSyntheticFieldTrial(std::string trial, std::string group); | |
|
bengr
2014/07/30 19:08:22
Can these be const std::string&?
megjablon
2014/07/30 21:27:07
Yes. Done.
| |
| 76 | |
| 65 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor); | 77 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor); |
| 66 }; | 78 }; |
| 67 | 79 |
| 68 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | 80 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ |
| OLD | NEW |