// chrome/browser/ui/webui/signin/batch_upload/batch_upload.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 "chrome/browser/ui/webui/signin/batch_upload/batch_upload.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 "chrome/browser/ui/webui/signin/batch_upload/batch_upload.mojom-params-data.h"
namespace batch_upload {
namespace mojom {

namespace internal {


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

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

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

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

  return true;
}

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


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

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

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

  return true;
}

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


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

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

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

  return true;
}

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


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

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

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

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

  return true;
}

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


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

  if (!mojo::internal::ValidateHandleOrInterfaceNonNullable(
          object->page, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateHandleOrInterface(object->page,
                                                 validation_context)) {
    return false;
  }

  if (!mojo::internal::ValidateHandleOrInterfaceNonNullable(
          object->handler, 2, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateHandleOrInterface(object->handler,
                                                 validation_context)) {
    return false;
  }

  return true;
}

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


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

  return true;
}

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


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

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

  return true;
}

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


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

  return true;
}

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


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

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

  return true;
}

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

}  // namespace internal
}  // namespace mojom
}  // namespace batch_upload