// third_party/blink/public/mojom/choosers/date_time_chooser.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/choosers/date_time_chooser.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/choosers/date_time_chooser.mojom-params-data.h"
namespace blink {
namespace mojom {

namespace internal {


// static
bool DateTimeSuggestion_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 32, 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 DateTimeSuggestion_Data* object =
      static_cast<const DateTimeSuggestion_Data*>(data);

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

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

  return true;
}

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


// static
bool DateTimeDialogValue_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 DateTimeDialogValue_Data* object =
      static_cast<const DateTimeDialogValue_Data*>(data);


  if (!::ui::mojom::internal::TextInputType_Data
        ::Validate(object->dialog_type, validation_context))
    return false;

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

  return true;
}

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


// static
bool DateTimeChooser_OpenDateTimeDialog_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 DateTimeChooser_OpenDateTimeDialog_Params_Data* object =
      static_cast<const DateTimeChooser_OpenDateTimeDialog_Params_Data*>(data);

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

  return true;
}

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


// static
bool DateTimeChooser_OpenDateTimeDialog_ResponseParams_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 DateTimeChooser_OpenDateTimeDialog_ResponseParams_Data* object =
      static_cast<const DateTimeChooser_OpenDateTimeDialog_ResponseParams_Data*>(data);

  return true;
}

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


// static
bool DateTimeChooser_CloseDateTimeDialog_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 8, 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 DateTimeChooser_CloseDateTimeDialog_Params_Data* object =
      static_cast<const DateTimeChooser_CloseDateTimeDialog_Params_Data*>(data);

  return true;
}

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

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