| // Copyright 2022 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef CONTENT_BROWSER_ATTRIBUTION_REPORTING_ATTRIBUTION_INTEROP_PARSER_H_ |
| #define CONTENT_BROWSER_ATTRIBUTION_REPORTING_ATTRIBUTION_INTEROP_PARSER_H_ |
| |
| #include <string> |
| #include <vector> |
| |
| #include "base/time/time.h" |
| #include "base/types/expected.h" |
| #include "base/values.h" |
| #include "content/browser/attribution_reporting/attribution_trigger.h" |
| #include "content/browser/attribution_reporting/storable_source.h" |
| #include "third_party/abseil-cpp/absl/types/optional.h" |
| #include "third_party/abseil-cpp/absl/types/variant.h" |
| |
| namespace content { |
| |
| struct AttributionConfig; |
| |
| struct AttributionTriggerAndTime { |
| AttributionTrigger trigger; |
| base::Time time; |
| }; |
| |
| struct AttributionSimulationEvent { |
| absl::variant<StorableSource, AttributionTriggerAndTime> event; |
| bool debug_permission; |
| |
| AttributionSimulationEvent( |
| absl::variant<StorableSource, AttributionTriggerAndTime> event, |
| bool debug_permission); |
| |
| ~AttributionSimulationEvent(); |
| |
| AttributionSimulationEvent(const AttributionSimulationEvent&) = delete; |
| AttributionSimulationEvent& operator=(const AttributionSimulationEvent&) = |
| delete; |
| |
| AttributionSimulationEvent(AttributionSimulationEvent&&); |
| AttributionSimulationEvent& operator=(AttributionSimulationEvent&&); |
| }; |
| |
| using AttributionSimulationEvents = std::vector<AttributionSimulationEvent>; |
| |
| // See //content/test/data/attribution_reporting/interop/README.md for the |
| // schema. |
| |
| base::expected<AttributionSimulationEvents, std::string> |
| ParseAttributionInteropInput(base::Value::Dict input, base::Time offset_time); |
| |
| base::expected<AttributionConfig, std::string> ParseAttributionConfig( |
| const base::Value::Dict&); |
| |
| // Returns a non-empty string on failure. |
| [[nodiscard]] std::string MergeAttributionConfig(const base::Value::Dict&, |
| AttributionConfig&); |
| |
| base::Time GetEventTime(const AttributionSimulationEvent&); |
| |
| } // namespace content |
| |
| #endif // CONTENT_BROWSER_ATTRIBUTION_REPORTING_ATTRIBUTION_INTEROP_PARSER_H_ |