// components/guest_view/common/guest_view.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 "components/guest_view/common/guest_view.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 "components/guest_view/common/guest_view.mojom-params-data.h"
namespace guest_view {
namespace mojom {

namespace internal {


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

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

  return true;
}

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


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

  return true;
}

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


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

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

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

  return true;
}

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

}  // namespace internal
}  // namespace mojom
}  // namespace guest_view