1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_ATTRIBUTION_REPORTING_REGISTRATION_HEADER_ERROR_H_
#define COMPONENTS_ATTRIBUTION_REPORTING_REGISTRATION_HEADER_ERROR_H_
#include <string>
#include <string_view>
#include <utility>
#include <variant>
#include "base/component_export.h"
#include "base/types/strong_alias.h"
#include "components/attribution_reporting/os_registration_error.mojom-forward.h"
#include "components/attribution_reporting/source_registration_error.mojom-forward.h"
#include "components/attribution_reporting/trigger_registration_error.mojom-forward.h"
namespace attribution_reporting {
using OsSourceRegistrationError =
base::StrongAlias<struct OsSourceRegistrationErrorTag,
mojom::OsRegistrationError>;
using OsTriggerRegistrationError =
base::StrongAlias<struct OsTriggerRegistrationErrorTag,
mojom::OsRegistrationError>;
using RegistrationHeaderErrorDetails =
std::variant<mojom::SourceRegistrationError,
mojom::TriggerRegistrationError,
OsSourceRegistrationError,
OsTriggerRegistrationError>;
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING) RegistrationHeaderError {
std::string header_value;
RegistrationHeaderErrorDetails error_details;
RegistrationHeaderError() = default;
RegistrationHeaderError(std::string header_value,
RegistrationHeaderErrorDetails error_details)
: header_value(std::move(header_value)), error_details(error_details) {}
RegistrationHeaderError(std::string_view header_value,
RegistrationHeaderErrorDetails error_details)
: header_value(header_value), error_details(error_details) {}
RegistrationHeaderError(const char* header_value,
RegistrationHeaderErrorDetails error_details)
: header_value(header_value), error_details(error_details) {}
std::string_view HeaderName() const;
friend bool operator==(const RegistrationHeaderError&,
const RegistrationHeaderError&) = default;
};
} // namespace attribution_reporting
#endif // COMPONENTS_ATTRIBUTION_REPORTING_REGISTRATION_HEADER_ERROR_H_
|