| 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_PUBLIC_UKM_RECORDER_H_ | 5 #ifndef COMPONENTS_UKM_PUBLIC_UKM_RECORDER_H_ |
| 6 #define COMPONENTS_UKM_PUBLIC_UKM_RECORDER_H_ | 6 #define COMPONENTS_UKM_PUBLIC_UKM_RECORDER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/callback.h" | 12 #include "base/callback.h" |
| 11 #include "base/feature_list.h" | 13 #include "base/feature_list.h" |
| 12 #include "base/macros.h" | 14 #include "base/macros.h" |
| 13 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 14 #include "components/ukm/public/interfaces/ukm_interface.mojom.h" | 16 #include "components/ukm/public/interfaces/ukm_interface.mojom.h" |
| 15 #include "components/ukm/public/ukm_entry_builder.h" | 17 #include "components/ukm/public/ukm_entry_builder.h" |
| 16 #include "components/ukm/public/ukm_export.h" | 18 #include "components/ukm/public/ukm_export.h" |
| 17 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 18 | 20 |
| 19 class ContextualSearchRankerLoggerImpl; | 21 class ContextualSearchRankerLoggerImpl; |
| 20 class PluginInfoMessageFilter; | 22 class PluginInfoMessageFilter; |
| 21 class UkmPageLoadMetricsObserver; | 23 class UkmPageLoadMetricsObserver; |
| 22 | 24 |
| 23 namespace autofill { | 25 namespace autofill { |
| 24 class AutofillMetrics; | 26 class AutofillMetrics; |
| 25 } | 27 } |
| 26 | 28 |
| 27 namespace content { | 29 namespace content { |
| 28 class MediaInternals; | 30 class MediaInternals; |
| 29 class RenderFrameImpl; | 31 class RenderFrameImpl; |
| 30 class RenderWidgetHostLatencyTracker; | 32 class RenderWidgetHostLatencyTracker; |
| 31 } | 33 } |
| 32 | 34 |
| 35 namespace resource_coordinator { |
| 36 class CoordinationUnitManager; |
| 37 } |
| 38 |
| 33 namespace translate { | 39 namespace translate { |
| 34 class TranslateRankerImpl; | 40 class TranslateRankerImpl; |
| 35 } | 41 } |
| 36 | 42 |
| 37 namespace payments { | 43 namespace payments { |
| 38 class JourneyLogger; | 44 class JourneyLogger; |
| 39 } | 45 } |
| 40 | 46 |
| 41 namespace password_manager { | 47 namespace password_manager { |
| 42 class PasswordFormMetricsRecorder; | 48 class PasswordFormMetricsRecorder; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 friend ContextualSearchRankerLoggerImpl; | 84 friend ContextualSearchRankerLoggerImpl; |
| 79 friend PluginInfoMessageFilter; | 85 friend PluginInfoMessageFilter; |
| 80 friend UkmPageLoadMetricsObserver; | 86 friend UkmPageLoadMetricsObserver; |
| 81 friend translate::TranslateRankerImpl; | 87 friend translate::TranslateRankerImpl; |
| 82 friend TestRecordingHelper; | 88 friend TestRecordingHelper; |
| 83 friend UkmInterface; | 89 friend UkmInterface; |
| 84 friend content::MediaInternals; | 90 friend content::MediaInternals; |
| 85 friend content::RenderFrameImpl; | 91 friend content::RenderFrameImpl; |
| 86 friend content::RenderWidgetHostLatencyTracker; | 92 friend content::RenderWidgetHostLatencyTracker; |
| 87 friend password_manager::PasswordFormMetricsRecorder; | 93 friend password_manager::PasswordFormMetricsRecorder; |
| 94 friend resource_coordinator::CoordinationUnitManager; |
| 88 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, AddEntryWithEmptyMetrics); | 95 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, AddEntryWithEmptyMetrics); |
| 89 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, EntryBuilderAndSerialization); | 96 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, EntryBuilderAndSerialization); |
| 90 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, | 97 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, |
| 91 LogsUploadedOnlyWhenHavingSourcesOrEntries); | 98 LogsUploadedOnlyWhenHavingSourcesOrEntries); |
| 92 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, MetricsProviderTest); | 99 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, MetricsProviderTest); |
| 93 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, PersistAndPurge); | 100 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, PersistAndPurge); |
| 94 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, WhitelistEntryTest); | 101 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, WhitelistEntryTest); |
| 95 | 102 |
| 96 // Get a new UkmEntryBuilder object for the specified source ID and event, | 103 // Get a new UkmEntryBuilder object for the specified source ID and event, |
| 97 // which can get metrics added to. | 104 // which can get metrics added to. |
| 98 // | 105 // |
| 99 // This API being private is intentional. Any client using UKM needs to | 106 // This API being private is intentional. Any client using UKM needs to |
| 100 // declare itself to be a friend of UkmService and go through code review | 107 // declare itself to be a friend of UkmService and go through code review |
| 101 // process. | 108 // process. |
| 102 std::unique_ptr<UkmEntryBuilder> GetEntryBuilder(SourceId source_id, | 109 std::unique_ptr<UkmEntryBuilder> GetEntryBuilder(SourceId source_id, |
| 103 const char* event_name); | 110 const char* event_name); |
| 104 | 111 |
| 105 private: | 112 private: |
| 106 // Add an entry to the UkmEntry list. | 113 // Add an entry to the UkmEntry list. |
| 107 virtual void AddEntry(mojom::UkmEntryPtr entry) = 0; | 114 virtual void AddEntry(mojom::UkmEntryPtr entry) = 0; |
| 108 | 115 |
| 109 DISALLOW_COPY_AND_ASSIGN(UkmRecorder); | 116 DISALLOW_COPY_AND_ASSIGN(UkmRecorder); |
| 110 }; | 117 }; |
| 111 | 118 |
| 112 } // namespace ukm | 119 } // namespace ukm |
| 113 | 120 |
| 114 #endif // COMPONENTS_UKM_PUBLIC_UKM_RECORDER_H_ | 121 #endif // COMPONENTS_UKM_PUBLIC_UKM_RECORDER_H_ |
| OLD | NEW |