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