// third_party/blink/public/mojom/background_fetch/background_fetch.mojom-send-validation.h is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_PUBLIC_MOJOM_BACKGROUND_FETCH_BACKGROUND_FETCH_MOJOM_SEND_VALIDATION_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_BACKGROUND_FETCH_BACKGROUND_FETCH_MOJOM_SEND_VALIDATION_H_

#include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom-shared-internal.h"
#include "skia/public/mojom/bitmap.mojom-shared.h"
#include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom-shared.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-shared.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_response.mojom-shared.h"
#include "third_party/blink/public/mojom/manifest/manifest.mojom-shared.h"
#include "ui/gfx/geometry/mojom/geometry.mojom-shared.h"

#include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom-data-view.h"

#include "mojo/public/cpp/bindings/lib/send_validation_type.h"
#include "mojo/public/cpp/bindings/lib/send_validation.h"
#include "mojo/public/cpp/bindings/lib/interface_serialization_send_validation.h"
#include "mojo/public/cpp/bindings/lib/has_send_validation_helper.h"

namespace mojo::internal {
template <typename MaybeConstUserType>
struct HasSendValidationSerialize<::blink::mojom::BackgroundFetchError, MaybeConstUserType>
    : std::false_type {};
template <typename MaybeConstUserType>
struct HasSendValidationSerialize<::blink::mojom::BackgroundFetchResult, MaybeConstUserType>
    : std::false_type {};
template <typename MaybeConstUserType>
struct HasSendValidationSerialize<::blink::mojom::BackgroundFetchFailureReason, MaybeConstUserType>
    : std::false_type {};

template <typename MaybeConstUserType, mojo::internal::SendValidation send_validation>
struct SendValidationSerializer<::blink::mojom::BackgroundFetchSettledFetchDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::blink::mojom::BackgroundFetchSettledFetchDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::blink::mojom::internal::BackgroundFetchSettledFetch_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

      decltype(Traits::request(input)) in_request = Traits::request(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->request)::BaseType> request_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::blink::mojom::FetchAPIRequestDataView, send_validation>(
        in_request,
        request_fragment);

      fragment->request.Set(
          request_fragment.is_null() ? nullptr : request_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->request.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null request in BackgroundFetchSettledFetch struct");

      decltype(Traits::response(input)) in_response = Traits::response(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->response)::BaseType> response_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::blink::mojom::FetchAPIResponseDataView, send_validation>(
        in_response,
        response_fragment);

      fragment->response.Set(
          response_fragment.is_null() ? nullptr : response_fragment.data());
  }
};

template <typename MaybeConstUserType, mojo::internal::SendValidation send_validation>
struct SendValidationSerializer<::blink::mojom::BackgroundFetchOptionsDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::blink::mojom::BackgroundFetchOptionsDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::blink::mojom::internal::BackgroundFetchOptions_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

      decltype(Traits::icons(input)) in_icons = Traits::icons(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->icons)::BaseType>
          icons_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& icons_validate_params =
          mojo::internal::GetArrayValidator<0, false, nullptr>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<::blink::mojom::ManifestImageResourceDataView>, send_validation>(
        in_icons,
        icons_fragment,
        &icons_validate_params);

      fragment->icons.Set(
          icons_fragment.is_null() ? nullptr : icons_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->icons.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null icons in BackgroundFetchOptions struct");

      fragment->download_total = Traits::download_total(input);

      decltype(Traits::title(input)) in_title = Traits::title(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->title)::BaseType> title_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_title,
        title_fragment);

      fragment->title.Set(
          title_fragment.is_null() ? nullptr : title_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->title.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null title in BackgroundFetchOptions struct");
  }
};

template <typename MaybeConstUserType, mojo::internal::SendValidation send_validation>
struct SendValidationSerializer<::blink::mojom::BackgroundFetchRegistrationDataDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::blink::mojom::BackgroundFetchRegistrationDataDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::blink::mojom::internal::BackgroundFetchRegistrationData_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

      decltype(Traits::developer_id(input)) in_developer_id = Traits::developer_id(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->developer_id)::BaseType> developer_id_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_developer_id,
        developer_id_fragment);

      fragment->developer_id.Set(
          developer_id_fragment.is_null() ? nullptr : developer_id_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->developer_id.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null developer_id in BackgroundFetchRegistrationData struct");

      fragment->upload_total = Traits::upload_total(input);

      fragment->uploaded = Traits::uploaded(input);

      fragment->download_total = Traits::download_total(input);

      fragment->downloaded = Traits::downloaded(input);

      
      mojo::internal::Serialize<::blink::mojom::BackgroundFetchResult>(
        Traits::result(input),
        &fragment->result);

      
      mojo::internal::Serialize<::blink::mojom::BackgroundFetchFailureReason>(
        Traits::failure_reason(input),
        &fragment->failure_reason);
  }
};

template <typename MaybeConstUserType, mojo::internal::SendValidation send_validation>
struct SendValidationSerializer<::blink::mojom::BackgroundFetchRegistrationDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::blink::mojom::BackgroundFetchRegistrationDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::blink::mojom::internal::BackgroundFetchRegistration_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

      decltype(Traits::registration_data(input)) in_registration_data = Traits::registration_data(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->registration_data)::BaseType> registration_data_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::blink::mojom::BackgroundFetchRegistrationDataDataView, send_validation>(
        in_registration_data,
        registration_data_fragment);

      fragment->registration_data.Set(
          registration_data_fragment.is_null() ? nullptr : registration_data_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->registration_data.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null registration_data in BackgroundFetchRegistration struct");

      decltype(Traits::registration_interface(input)) in_registration_interface = Traits::registration_interface(input);

      
      mojo::internal::Serialize<mojo::InterfacePtrDataView<::blink::mojom::BackgroundFetchRegistrationServiceInterfaceBase>>(
        in_registration_interface,
        &fragment->registration_interface,
        &fragment.message());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(!mojo::internal::IsHandleOrInterfaceValid(fragment->registration_interface)),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
        "invalid registration_interface in BackgroundFetchRegistration struct");
  }
};

template <typename MaybeConstUserType, mojo::internal::SendValidation send_validation>
struct SendValidationSerializer<::blink::mojom::BackgroundFetchUkmDataDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::blink::mojom::BackgroundFetchUkmDataDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::blink::mojom::internal::BackgroundFetchUkmData_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

      fragment->ideal_to_chosen_icon_size = Traits::ideal_to_chosen_icon_size(input);
  }
};

}  // namespace mojo::internal

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_BACKGROUND_FETCH_BACKGROUND_FETCH_MOJOM_SEND_VALIDATION_H_