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> |
| 9 #include <string> |
| 10 |
8 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
9 #include "base/macros.h" | 12 #include "base/macros.h" |
10 #include "chrome/browser/metrics/metrics_service_accessor.h" | 13 #include "chrome/browser/metrics/metrics_service_accessor.h" |
11 | 14 |
12 class ChromeBrowserMetricsServiceObserver; | 15 class ChromeBrowserMetricsServiceObserver; |
13 class Profile; | 16 class Profile; |
14 | 17 |
15 namespace { | 18 namespace { |
16 class CrashesDOMHandler; | 19 class CrashesDOMHandler; |
17 class FlashDOMHandler; | 20 class FlashDOMHandler; |
(...skipping 21 matching lines...) Expand all Loading... |
39 friend bool prerender::IsOmniboxEnabled(Profile* profile); | 42 friend bool prerender::IsOmniboxEnabled(Profile* profile); |
40 friend class ::ChromeBrowserMetricsServiceObserver; | 43 friend class ::ChromeBrowserMetricsServiceObserver; |
41 friend class ChromeRenderMessageFilter; | 44 friend class ChromeRenderMessageFilter; |
42 friend class ::CrashesDOMHandler; | 45 friend class ::CrashesDOMHandler; |
43 friend class DataReductionProxyChromeSettings; | 46 friend class DataReductionProxyChromeSettings; |
44 friend class extensions::ExtensionDownloader; | 47 friend class extensions::ExtensionDownloader; |
45 friend class extensions::ManifestFetchData; | 48 friend class extensions::ManifestFetchData; |
46 friend class extensions::MetricsPrivateGetIsCrashReportingEnabledFunction; | 49 friend class extensions::MetricsPrivateGetIsCrashReportingEnabledFunction; |
47 friend class ::FlashDOMHandler; | 50 friend class ::FlashDOMHandler; |
48 friend class system_logs::ChromeInternalLogSource; | 51 friend class system_logs::ChromeInternalLogSource; |
| 52 friend class UmaSessionStats; |
49 | 53 |
50 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, | 54 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, |
51 MetricsReportingEnabled); | 55 MetricsReportingEnabled); |
52 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, | 56 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, |
53 CrashReportingEnabled); | 57 CrashReportingEnabled); |
54 | 58 |
55 // Returns true if prefs::kMetricsReportingEnabled is set. | 59 // Returns true if prefs::kMetricsReportingEnabled is set. |
56 // TODO(asvitkine): Consolidate the method in MetricsStateManager. | 60 // TODO(asvitkine): Consolidate the method in MetricsStateManager. |
57 // TODO(asvitkine): This function does not report the correct value on | 61 // TODO(asvitkine): This function does not report the correct value on |
58 // Android and ChromeOS, see http://crbug.com/362192. | 62 // Android and ChromeOS, see http://crbug.com/362192. |
59 static bool IsMetricsReportingEnabled(); | 63 static bool IsMetricsReportingEnabled(); |
60 | 64 |
61 // Returns true if crash reporting is enabled. This is set at the platform | 65 // Returns true if crash reporting is enabled. This is set at the platform |
62 // level for Android and ChromeOS, and otherwise is the same as | 66 // level for Android and ChromeOS, and otherwise is the same as |
63 // IsMetricsReportingEnabled for desktop Chrome. | 67 // IsMetricsReportingEnabled for desktop Chrome. |
64 static bool IsCrashReportingEnabled(); | 68 static bool IsCrashReportingEnabled(); |
65 | 69 |
66 // Registers a field trial name and group to be used to annotate a UMA report | 70 // Registers a field trial name and group to be used to annotate a UMA report |
67 // with a particular Chrome configuration state. A UMA report will be | 71 // with a particular Chrome configuration state. A UMA report will be |
68 // annotated with this trial group if and only if all events in the report | 72 // annotated with this trial group if and only if all events in the report |
69 // were created after the trial is registered. Only one group name may be | 73 // were created after the trial is registered. Only one group name may be |
70 // registered at a time for a given trial name. Only the last group name that | 74 // registered at a time for a given trial name. Only the last group name that |
71 // is registered for a given trial name will be recorded. The values passed | 75 // is registered for a given trial name will be recorded. The values passed |
72 // in must not correspond to any real field trial in the code. | 76 // in must not correspond to any real field trial in the code. |
73 static bool RegisterSyntheticFieldTrial(const std::string& trial, | 77 static bool RegisterSyntheticFieldTrial(const std::string& trial_name, |
74 const std::string& group); | 78 const std::string& group_name); |
| 79 |
| 80 // Same as RegisterSyntheticFieldTrial above, but takes a hash for the trial |
| 81 // name, rather than computing it from the string. |
| 82 static bool RegisterSyntheticFieldTrialWithNameHash( |
| 83 uint32_t trial_name_hash, |
| 84 const std::string& group_name); |
75 | 85 |
76 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor); | 86 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor); |
77 }; | 87 }; |
78 | 88 |
79 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | 89 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ |
OLD | NEW |