// services/video_capture/public/mojom/device.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 "services/video_capture/public/mojom/device.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 "services/video_capture/public/mojom/device.mojom-params-data.h"
namespace video_capture {
namespace mojom {

namespace internal {


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

  if (!mojo::internal::ValidatePointerNonNullable(
          object->requested_settings, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->requested_settings, 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;
}

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


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

  return true;
}

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


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

  return true;
}

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


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

  return true;
}

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


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

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

  return true;
}

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


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

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

  return true;
}

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


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

  return true;
}

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


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

  return true;
}

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


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

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

  return true;
}

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


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

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

  return true;
}

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


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

  return true;
}

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


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

  return true;
}

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

}  // namespace internal
}  // namespace mojom
}  // namespace video_capture