OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 COMPONENTS_UKM_UKM_SERVICE_H_ | 5 #ifndef COMPONENTS_UKM_UKM_SERVICE_H_ |
6 #define COMPONENTS_UKM_UKM_SERVICE_H_ | 6 #define COMPONENTS_UKM_UKM_SERVICE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/feature_list.h" | 13 #include "base/feature_list.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "components/metrics/metrics_provider.h" | 18 #include "components/metrics/metrics_provider.h" |
19 #include "components/metrics/metrics_reporting_scheduler.h" | 19 #include "components/metrics/metrics_reporting_scheduler.h" |
20 #include "components/metrics/persisted_logs.h" | 20 #include "components/metrics/persisted_logs.h" |
21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
22 | 22 |
23 class PrefRegistrySimple; | 23 class PrefRegistrySimple; |
24 class PrefService; | 24 class PrefService; |
25 class UkmPageLoadMetricsObserver; | 25 class UkmPageLoadMetricsObserver; |
26 | 26 |
| 27 namespace autofill { |
| 28 class AutofillMetrics; |
| 29 } // namespace autofill |
| 30 |
27 namespace metrics { | 31 namespace metrics { |
28 class MetricsLogUploader; | 32 class MetricsLogUploader; |
29 class MetricsServiceClient; | 33 class MetricsServiceClient; |
30 } | 34 } |
31 | 35 |
32 namespace ukm { | 36 namespace ukm { |
33 | 37 |
34 class UkmEntry; | 38 class UkmEntry; |
35 class UkmEntryBuilder; | 39 class UkmEntryBuilder; |
36 class UkmSource; | 40 class UkmSource; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 const std::vector<std::unique_ptr<UkmSource>>& sources_for_testing() const { | 102 const std::vector<std::unique_ptr<UkmSource>>& sources_for_testing() const { |
99 return sources_; | 103 return sources_; |
100 } | 104 } |
101 | 105 |
102 const std::vector<std::unique_ptr<UkmEntry>>& entries_for_testing() const { | 106 const std::vector<std::unique_ptr<UkmEntry>>& entries_for_testing() const { |
103 return entries_; | 107 return entries_; |
104 } | 108 } |
105 | 109 |
106 private: | 110 private: |
107 friend UkmPageLoadMetricsObserver; | 111 friend UkmPageLoadMetricsObserver; |
| 112 friend autofill::AutofillMetrics; |
108 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, AddEntryOnlyWithNonEmptyMetrics); | 113 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, AddEntryOnlyWithNonEmptyMetrics); |
109 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, EntryBuilderAndSerialization); | 114 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, EntryBuilderAndSerialization); |
110 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, | 115 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, |
111 LogsUploadedOnlyWhenHavingSourcesOrEntries); | 116 LogsUploadedOnlyWhenHavingSourcesOrEntries); |
112 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, MetricsProviderTest); | 117 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, MetricsProviderTest); |
113 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, PersistAndPurge); | 118 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, PersistAndPurge); |
114 | 119 |
115 // Get a new UkmEntryBuilder object for the specified source ID and event, | 120 // Get a new UkmEntryBuilder object for the specified source ID and event, |
116 // which can get metrics added to. | 121 // which can get metrics added to. |
117 // | 122 // |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Weak pointers factory used to post task on different threads. All weak | 197 // Weak pointers factory used to post task on different threads. All weak |
193 // pointers managed by this factory have the same lifetime as UkmService. | 198 // pointers managed by this factory have the same lifetime as UkmService. |
194 base::WeakPtrFactory<UkmService> self_ptr_factory_; | 199 base::WeakPtrFactory<UkmService> self_ptr_factory_; |
195 | 200 |
196 DISALLOW_COPY_AND_ASSIGN(UkmService); | 201 DISALLOW_COPY_AND_ASSIGN(UkmService); |
197 }; | 202 }; |
198 | 203 |
199 } // namespace ukm | 204 } // namespace ukm |
200 | 205 |
201 #endif // COMPONENTS_UKM_UKM_SERVICE_H_ | 206 #endif // COMPONENTS_UKM_UKM_SERVICE_H_ |
OLD | NEW |