OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | |
6 #define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | |
7 | |
8 #include "base/gtest_prod_util.h" | |
9 #include "chrome/browser/metrics/metrics_service_observer.h" | |
Ilya Sherman
2014/05/20 15:18:11
nit: This file has moved; you'll need to update th
Ilya Sherman
2014/05/20 15:18:11
nit: Can this class be forward-declared, and the #
motek.
2014/05/20 15:54:39
Done.
motek.
2014/05/20 15:54:39
It would appear that it cannot on the account of D
Ilya Sherman
2014/05/20 15:56:44
For that macro, you can "#include base/macros.h" i
| |
10 | |
11 class ChromeBrowserMetricsServiceObserver; | |
12 class Profile; | |
13 | |
14 namespace { | |
15 class CrashesDOMHandler; | |
16 class FlashDOMHandler; | |
17 } | |
18 | |
19 namespace extensions { | |
20 class ExtensionDownloader; | |
21 class ManifestFetchData; | |
22 class MetricsPrivateGetIsCrashReportingEnabledFunction; | |
23 } | |
24 | |
25 namespace prerender { | |
26 bool IsOmniboxEnabled(Profile* profile); | |
27 } | |
28 | |
29 namespace system_logs { | |
30 class ChromeInternalLogSource; | |
31 } | |
32 | |
33 // This class limits and documents access to metrics service helper methods. | |
34 // Since these methods are private, each user has to be explicitly declared | |
35 // as a 'friend' below. | |
36 class ChromeMetricsServiceAccessor { | |
37 private: | |
38 friend bool prerender::IsOmniboxEnabled(Profile* profile); | |
39 friend class ::ChromeBrowserMetricsServiceObserver; | |
40 friend class ChromeRenderMessageFilter; | |
41 friend class ::CrashesDOMHandler; | |
42 friend class extensions::ExtensionDownloader; | |
43 friend class extensions::ManifestFetchData; | |
44 friend class extensions::MetricsPrivateGetIsCrashReportingEnabledFunction; | |
45 friend class ::FlashDOMHandler; | |
46 friend class system_logs::ChromeInternalLogSource; | |
47 | |
48 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, | |
49 MetricsReportingEnabled); | |
50 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, | |
51 CrashReportingEnabled); | |
52 | |
53 // Returns true if prefs::kMetricsReportingEnabled is set. | |
54 // TODO(asvitkine): Consolidate the method in MetricsStateManager. | |
55 // TODO(asvitkine): This function does not report the correct value on | |
56 // Android and ChromeOS, see http://crbug.com/362192. | |
57 static bool IsMetricsReportingEnabled(); | |
58 | |
59 // Returns true if crash reporting is enabled. This is set at the platform | |
60 // level for Android and ChromeOS, and otherwise is the same as | |
61 // IsMetricsReportingEnabled for desktop Chrome. | |
62 static bool IsCrashReportingEnabled(); | |
63 | |
64 // Registers/unregisters |observer| to receive MetricsLog notifications | |
65 // from metrics service. | |
66 static void AddMetricsServiceObserver(MetricsServiceObserver* observer); | |
67 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer); | |
68 | |
69 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor); | |
70 }; | |
71 | |
72 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ | |
OLD | NEW |