// third_party/blink/public/mojom/input/ime_host.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_INPUT_IME_HOST_MOJOM_SEND_VALIDATION_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_INPUT_IME_HOST_MOJOM_SEND_VALIDATION_H_

#include "third_party/blink/public/mojom/input/ime_host.mojom-shared-internal.h"
#include "skia/public/mojom/skcolor.mojom-shared.h"
#include "ui/gfx/geometry/mojom/geometry.mojom-shared.h"

#include "third_party/blink/public/mojom/input/ime_host.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"

namespace mojo::internal {

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

      decltype(Traits::editor_bounds(input)) in_editor_bounds = Traits::editor_bounds(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->editor_bounds)::BaseType> editor_bounds_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::gfx::mojom::RectFDataView, send_validation>(
        in_editor_bounds,
        editor_bounds_fragment);

      fragment->editor_bounds.Set(
          editor_bounds_fragment.is_null() ? nullptr : editor_bounds_fragment.data());

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

      decltype(Traits::handwriting_bounds(input)) in_handwriting_bounds = Traits::handwriting_bounds(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->handwriting_bounds)::BaseType> handwriting_bounds_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::gfx::mojom::RectFDataView, send_validation>(
        in_handwriting_bounds,
        handwriting_bounds_fragment);

      fragment->handwriting_bounds.Set(
          handwriting_bounds_fragment.is_null() ? nullptr : handwriting_bounds_fragment.data());

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

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

      decltype(Traits::text_color(input)) in_text_color = Traits::text_color(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->text_color)::BaseType> text_color_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::skia::mojom::SkColorDataView, send_validation>(
        in_text_color,
        text_color_fragment);

      fragment->text_color.Set(
          text_color_fragment.is_null() ? nullptr : text_color_fragment.data());

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

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

      decltype(Traits::character_bounds(input)) in_character_bounds = Traits::character_bounds(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->character_bounds)::BaseType>
          character_bounds_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& character_bounds_validate_params =
          mojo::internal::GetArrayValidator<0, false, nullptr>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<::gfx::mojom::RectDataView>, send_validation>(
        in_character_bounds,
        character_bounds_fragment,
        &character_bounds_validate_params);

      fragment->character_bounds.Set(
          character_bounds_fragment.is_null() ? nullptr : character_bounds_fragment.data());

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

      decltype(Traits::editor_bounds_info(input)) in_editor_bounds_info = Traits::editor_bounds_info(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->editor_bounds_info)::BaseType> editor_bounds_info_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::blink::mojom::EditorBoundsInfoDataView, send_validation>(
        in_editor_bounds_info,
        editor_bounds_info_fragment);

      fragment->editor_bounds_info.Set(
          editor_bounds_info_fragment.is_null() ? nullptr : editor_bounds_info_fragment.data());

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

      decltype(Traits::text_appearance_info(input)) in_text_appearance_info = Traits::text_appearance_info(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->text_appearance_info)::BaseType> text_appearance_info_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::blink::mojom::TextAppearanceInfoDataView, send_validation>(
        in_text_appearance_info,
        text_appearance_info_fragment);

      fragment->text_appearance_info.Set(
          text_appearance_info_fragment.is_null() ? nullptr : text_appearance_info_fragment.data());

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

      decltype(Traits::visible_line_bounds(input)) in_visible_line_bounds = Traits::visible_line_bounds(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->visible_line_bounds)::BaseType>
          visible_line_bounds_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& visible_line_bounds_validate_params =
          mojo::internal::GetArrayValidator<0, false, nullptr>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<::gfx::mojom::RectDataView>, send_validation>(
        in_visible_line_bounds,
        visible_line_bounds_fragment,
        &visible_line_bounds_validate_params);

      fragment->visible_line_bounds.Set(
          visible_line_bounds_fragment.is_null() ? nullptr : visible_line_bounds_fragment.data());

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

      decltype(Traits::insertion_marker(input)) in_insertion_marker = Traits::insertion_marker(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->insertion_marker)::BaseType> insertion_marker_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::gfx::mojom::RectDataView, send_validation>(
        in_insertion_marker,
        insertion_marker_fragment);

      fragment->insertion_marker.Set(
          insertion_marker_fragment.is_null() ? nullptr : insertion_marker_fragment.data());

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

}  // namespace mojo::internal

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_INPUT_IME_HOST_MOJOM_SEND_VALIDATION_H_