// third_party/blink/public/mojom/input/ime_host.mojom-shared.cc is auto generated by mojom_bindings_generator.py, do not edit

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

#include "third_party/blink/public/mojom/input/ime_host.mojom-shared.h"
#include <utility>
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "third_party/blink/public/mojom/input/ime_host.mojom-params-data.h"
namespace blink {
namespace mojom {

namespace internal {


// static
bool EditorBoundsInfo_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 24, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const EditorBoundsInfo_Data* object =
      static_cast<const EditorBoundsInfo_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->editor_bounds, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->editor_bounds, validation_context))
    return false;

  if (!mojo::internal::ValidatePointerNonNullable(
          object->handwriting_bounds, 2, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->handwriting_bounds, validation_context))
    return false;

  return true;
}

EditorBoundsInfo_Data::EditorBoundsInfo_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool TextAppearanceInfo_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const TextAppearanceInfo_Data* object =
      static_cast<const TextAppearanceInfo_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->text_color, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->text_color, validation_context))
    return false;

  return true;
}

TextAppearanceInfo_Data::TextAppearanceInfo_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool InputCursorAnchorInfo_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 56, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const InputCursorAnchorInfo_Data* object =
      static_cast<const InputCursorAnchorInfo_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->character_bounds, 1, validation_context)) {
    return false;
  }
  constexpr const mojo::internal::ContainerValidateParams& character_bounds_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  if (!mojo::internal::ValidateContainer(object->character_bounds, validation_context,
                                         &character_bounds_validate_params)) {
    return false;
  }

  if (!mojo::internal::ValidatePointerNonNullable(
          object->editor_bounds_info, 2, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->editor_bounds_info, validation_context))
    return false;

  if (!mojo::internal::ValidatePointerNonNullable(
          object->text_appearance_info, 3, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->text_appearance_info, validation_context))
    return false;

  if (!mojo::internal::ValidatePointerNonNullable(
          object->visible_line_bounds, 4, validation_context)) {
    return false;
  }
  constexpr const mojo::internal::ContainerValidateParams& visible_line_bounds_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  if (!mojo::internal::ValidateContainer(object->visible_line_bounds, validation_context,
                                         &visible_line_bounds_validate_params)) {
    return false;
  }

  if (!mojo::internal::ValidateStruct(object->insertion_marker, validation_context))
    return false;

  return true;
}

InputCursorAnchorInfo_Data::InputCursorAnchorInfo_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool ImeRenderWidgetHost_UpdateCursorAnchorInfo_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const ImeRenderWidgetHost_UpdateCursorAnchorInfo_Params_Data* object =
      static_cast<const ImeRenderWidgetHost_UpdateCursorAnchorInfo_Params_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->cursor_anchor_info, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->cursor_anchor_info, validation_context))
    return false;

  return true;
}

ImeRenderWidgetHost_UpdateCursorAnchorInfo_Params_Data::ImeRenderWidgetHost_UpdateCursorAnchorInfo_Params_Data()
    : header_({sizeof(*this), 0}) {}

}  // namespace internal
}  // namespace mojom
}  // namespace blink