chromium/services/network/public/cpp/structured_headers_mojom_traits.h

// 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 SERVICES_NETWORK_PUBLIC_CPP_STRUCTURED_HEADERS_MOJOM_TRAITS_H_
#define SERVICES_NETWORK_PUBLIC_CPP_STRUCTURED_HEADERS_MOJOM_TRAITS_H_

#include <stdint.h>

#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include "base/component_export.h"
#include "mojo/public/cpp/base/byte_string_mojom_traits.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "mojo/public/cpp/bindings/union_traits.h"
#include "net/http/structured_headers.h"
#include "services/network/public/mojom/structured_headers.mojom-shared.h"

namespace mojo {

template <>
struct COMPONENT_EXPORT(NETWORK_CPP_STRUCTURED_HEADERS)
    UnionTraits<network::mojom::StructuredHeadersItemDataView,
                net::structured_headers::Item> {};

template <>
struct COMPONENT_EXPORT(NETWORK_CPP_STRUCTURED_HEADERS)
    StructTraits<network::mojom::StructuredHeadersParameterDataView,
                 std::pair<std::string, net::structured_headers::Item>> {};

template <>
struct COMPONENT_EXPORT(NETWORK_CPP_STRUCTURED_HEADERS)
    StructTraits<network::mojom::StructuredHeadersParameterizedItemDataView,
                 net::structured_headers::ParameterizedItem> {};

template <>
struct COMPONENT_EXPORT(NETWORK_CPP_STRUCTURED_HEADERS)
    StructTraits<network::mojom::StructuredHeadersParameterizedMemberDataView,
                 net::structured_headers::ParameterizedMember> {};

template <>
struct COMPONENT_EXPORT(NETWORK_CPP_STRUCTURED_HEADERS)
    StructTraits<network::mojom::StructuredHeadersDictionaryMemberDataView,
                 net::structured_headers::DictionaryMember> {};

template <>
struct COMPONENT_EXPORT(NETWORK_CPP_STRUCTURED_HEADERS)
    StructTraits<network::mojom::StructuredHeadersDictionaryDataView,
                 net::structured_headers::Dictionary> {};

}  // namespace mojo

#endif  // SERVICES_NETWORK_PUBLIC_CPP_STRUCTURED_HEADERS_MOJOM_TRAITS_H_