1 // Copyright 2022 The Chromium Authors 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 COMPONENTS_METRICS_STRUCTURED_EVENTS_PROCESSOR_INTERFACE_H_ 6 #define COMPONENTS_METRICS_STRUCTURED_EVENTS_PROCESSOR_INTERFACE_H_ 7 8 #include "components/metrics/structured/event.h" 9 10 namespace metrics::structured { 11 12 // An interface allowing different classes to add fields to events after the 13 // events are recorded by a client. 14 class EventsProcessorInterface { 15 public: 16 EventsProcessorInterface() = default; 17 18 EventsProcessorInterface(const EventsProcessorInterface& events_processor) = 19 delete; 20 EventsProcessorInterface& operator=( 21 const EventsProcessorInterface& events_processor) = delete; 22 23 virtual ~EventsProcessorInterface() = default; 24 25 // Returns true if |event| should be processed by |this|. 26 virtual bool ShouldProcessOnEventRecord(const Event& event) = 0; 27 28 // Processes |event|. Note that this function may mutate |event|. 29 virtual void OnEventsRecord(Event* event) = 0; 30 }; 31 32 } // namespace metrics::structured 33 34 #endif // COMPONENTS_METRICS_STRUCTURED_EVENTS_PROCESSOR_INTERFACE_H_ 35