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_METRICS_SERVICE_ACCESSOR_H_ | 5 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_ACCESSOR_H_ |
6 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_ACCESSOR_H_ | 6 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_ACCESSOR_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 | 11 |
| 12 class MetricsService; |
10 class MetricsServiceObserver; | 13 class MetricsServiceObserver; |
11 | 14 |
12 // This class limits and documents access to metrics service helper methods. | 15 // This class limits and documents access to metrics service helper methods. |
13 // These methods are protected so each user has to inherit own program-specific | 16 // These methods are protected so each user has to inherit own program-specific |
14 // specialization and enable access there by declaring friends. | 17 // specialization and enable access there by declaring friends. |
15 class MetricsServiceAccessor { | 18 class MetricsServiceAccessor { |
16 protected: | 19 protected: |
17 // Constructor declared as protected to enable inheritance. Decendants should | 20 // Constructor declared as protected to enable inheritance. Decendants should |
18 // disallow instantiation. | 21 // disallow instantiation. |
19 MetricsServiceAccessor() {} | 22 MetricsServiceAccessor() {} |
20 | 23 |
21 // Registers/unregisters |observer| to receive MetricsLog notifications | 24 // Registers/unregisters |observer| to receive MetricsLog notifications |
22 // from metrics service. | 25 // from metrics service. |
23 static void AddMetricsServiceObserver(MetricsServiceObserver* observer); | 26 static void AddMetricsServiceObserver(MetricsServiceObserver* observer); |
24 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer); | 27 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer); |
25 | 28 |
| 29 // Registers a field trial name and group to be used to annotate a UMA report |
| 30 // with a particular Chrome configuration state. A UMA report will be |
| 31 // annotated with this trial group if and only if all events in the report |
| 32 // were created after the trial is registered. Only one group name may be |
| 33 // registered at a time for a given trial name. Only the last group name that |
| 34 // is registered for a given trial name will be recorded. The values passed |
| 35 // in must not correspond to any real field trial in the code. |
| 36 static bool RegisterSyntheticFieldTrial(MetricsService* metrics_service, |
| 37 const std::string& trial, |
| 38 const std::string& group); |
| 39 |
26 private: | 40 private: |
27 DISALLOW_COPY_AND_ASSIGN(MetricsServiceAccessor); | 41 DISALLOW_COPY_AND_ASSIGN(MetricsServiceAccessor); |
28 }; | 42 }; |
29 | 43 |
30 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_ACCESSOR_H_ | 44 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_ACCESSOR_H_ |
OLD | NEW |