#include "components/attribution_reporting/aggregatable_debug_reporting_config.h"
#include <stdint.h>
#include <optional>
#include <set>
#include <string>
#include <string_view>
#include <utility>
#include "base/check.h"
#include "base/check_op.h"
#include "base/containers/enum_set.h"
#include "base/feature_list.h"
#include "base/functional/function_ref.h"
#include "base/metrics/histogram_functions.h"
#include "base/numerics/safe_conversions.h"
#include "base/ranges/algorithm.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "base/values.h"
#include "components/attribution_reporting/aggregatable_utils.h"
#include "components/attribution_reporting/constants.h"
#include "components/attribution_reporting/debug_types.h"
#include "components/attribution_reporting/debug_types.mojom.h"
#include "components/attribution_reporting/features.h"
#include "components/attribution_reporting/parsing_utils.h"
#include "third_party/abseil-cpp/absl/numeric/int128.h"
namespace attribution_reporting {
namespace {
DebugDataType;
constexpr char kAggregatableDebugReporting[] = …;
constexpr char kBudget[] = …;
constexpr char kDebugData[] = …;
constexpr char kTypes[] = …;
ParseDebugDataTypeFunc;
bool IsValueInRange(int value, std::optional<int> max_value) { … }
base::expected<int, ParseError> ParseValue(const base::Value::Dict& dict,
std::optional<int> max_value) { … }
base::expected<int, AggregatableDebugReportingConfigError> ParseBudget(
const base::Value::Dict& dict) { … }
base::expected<absl::uint128, ParseError> ParseKeyPiece(
const base::Value::Dict& dict) { … }
base::expected<void, AggregatableDebugReportingConfigError>
ParseDebugDataElement(base::Value& elem,
AggregatableDebugReportingConfig::DebugData& data,
std::optional<AggregatableDebugReportingContribution>&
unspecified_contribution,
std::set<std::string>& unknown_types,
std::optional<int> max_value,
ParseDebugDataTypeFunc parse_debug_data_type) { … }
base::expected<AggregatableDebugReportingConfig::DebugData,
AggregatableDebugReportingConfigError>
ParseDebugData(base::Value::Dict& dict,
std::optional<int> max_value,
const DebugDataTypes& debug_data_types,
ParseDebugDataTypeFunc parse_debug_data_type) { … }
void SerializeConfig(base::Value::Dict& dict,
const AggregatableDebugReportingConfig& config) { … }
bool IsValid(int budget,
const AggregatableDebugReportingConfig::DebugData& data) { … }
base::expected<AggregatableDebugReportingConfig,
AggregatableDebugReportingConfigError>
ParseConfig(base::Value::Dict& dict,
std::optional<int> max_value,
const DebugDataTypes& debug_data_types,
ParseDebugDataTypeFunc parse_debug_data_type) { … }
base::expected<SourceAggregatableDebugReportingConfig,
AggregatableDebugReportingConfigError>
ParseSourceConfig(base::Value::Dict& dict) { … }
base::expected<AggregatableDebugReportingConfig,
AggregatableDebugReportingConfigError>
ParseTriggerConfig(base::Value::Dict& dict) { … }
}
std::optional<AggregatableDebugReportingContribution>
AggregatableDebugReportingContribution::Create(absl::uint128 key_piece,
uint32_t value) { … }
AggregatableDebugReportingContribution::AggregatableDebugReportingContribution(
absl::uint128 key_piece,
uint32_t value)
: … { … }
bool AggregatableDebugReportingContribution::IsValid() const { … }
absl::uint128 AggregatableDebugReportingContribution::key_piece() const { … }
uint32_t AggregatableDebugReportingContribution::value() const { … }
base::expected<AggregatableDebugReportingConfig,
AggregatableDebugReportingConfigError>
AggregatableDebugReportingConfig::Parse(base::Value::Dict& dict) { … }
AggregatableDebugReportingConfig::AggregatableDebugReportingConfig() = default;
AggregatableDebugReportingConfig::AggregatableDebugReportingConfig(
absl::uint128 key_piece,
DebugData debug_data,
std::optional<SuitableOrigin> aggregation_coordinator_origin)
: … { … }
AggregatableDebugReportingConfig::~AggregatableDebugReportingConfig() = default;
AggregatableDebugReportingConfig::AggregatableDebugReportingConfig(
const AggregatableDebugReportingConfig&) = default;
AggregatableDebugReportingConfig::AggregatableDebugReportingConfig(
AggregatableDebugReportingConfig&&) = default;
AggregatableDebugReportingConfig& AggregatableDebugReportingConfig::operator=(
const AggregatableDebugReportingConfig&) = default;
AggregatableDebugReportingConfig& AggregatableDebugReportingConfig::operator=(
AggregatableDebugReportingConfig&&) = default;
void AggregatableDebugReportingConfig::Serialize(
base::Value::Dict& dict) const { … }
base::expected<SourceAggregatableDebugReportingConfig,
AggregatableDebugReportingConfigError>
SourceAggregatableDebugReportingConfig::Parse(base::Value::Dict& dict) { … }
std::optional<SourceAggregatableDebugReportingConfig>
SourceAggregatableDebugReportingConfig::Create(
int budget,
AggregatableDebugReportingConfig config) { … }
SourceAggregatableDebugReportingConfig::
SourceAggregatableDebugReportingConfig() = default;
SourceAggregatableDebugReportingConfig::SourceAggregatableDebugReportingConfig(
int budget,
AggregatableDebugReportingConfig config)
: … { … }
SourceAggregatableDebugReportingConfig::
~SourceAggregatableDebugReportingConfig() = default;
SourceAggregatableDebugReportingConfig::SourceAggregatableDebugReportingConfig(
const SourceAggregatableDebugReportingConfig&) = default;
SourceAggregatableDebugReportingConfig::SourceAggregatableDebugReportingConfig(
SourceAggregatableDebugReportingConfig&&) = default;
SourceAggregatableDebugReportingConfig&
SourceAggregatableDebugReportingConfig::operator=(
const SourceAggregatableDebugReportingConfig&) = default;
SourceAggregatableDebugReportingConfig&
SourceAggregatableDebugReportingConfig::operator=(
SourceAggregatableDebugReportingConfig&&) = default;
void SourceAggregatableDebugReportingConfig::Serialize(
base::Value::Dict& dict) const { … }
}