blob: 6ef63d3b124851c3492c4094d54c79235609c4ad [file] [log] [blame]
// services/device/public/mojom/usb_manager.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/device/public/mojom/usb_manager.mojom-shared.h"
// Used to support stream output operator for enums.
// TODO(dcheng): Consider omitting this somehow if not needed.
#include <ostream>
#include <utility>
#include "base/strings/stringprintf.h"
#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/device/public/mojom/usb_manager.mojom-params-data.h"
namespace device {
namespace mojom {
namespace internal {
// static
bool UsbDeviceManager_EnumerateDevicesAndSetClient_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 UsbDeviceManager_EnumerateDevicesAndSetClient_Params_Data* object =
static_cast<const UsbDeviceManager_EnumerateDevicesAndSetClient_Params_Data*>(data);
if (!mojo::internal::ValidateHandleOrInterfaceNonNullable(
object->client, 1, validation_context)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterface(object->client,
validation_context)) {
return false;
}
return true;
}
UsbDeviceManager_EnumerateDevicesAndSetClient_Params_Data::UsbDeviceManager_EnumerateDevicesAndSetClient_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool UsbDeviceManager_EnumerateDevicesAndSetClient_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 UsbDeviceManager_EnumerateDevicesAndSetClient_ResponseParams_Data* object =
static_cast<const UsbDeviceManager_EnumerateDevicesAndSetClient_ResponseParams_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->results, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& results_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->results, validation_context,
&results_validate_params)) {
return false;
}
return true;
}
UsbDeviceManager_EnumerateDevicesAndSetClient_ResponseParams_Data::UsbDeviceManager_EnumerateDevicesAndSetClient_ResponseParams_Data()
: header_({sizeof(*this), 0}) {}
// static
bool UsbDeviceManager_GetDevices_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 UsbDeviceManager_GetDevices_Params_Data* object =
static_cast<const UsbDeviceManager_GetDevices_Params_Data*>(data);
if (!mojo::internal::ValidateStruct(object->options, validation_context))
return false;
return true;
}
UsbDeviceManager_GetDevices_Params_Data::UsbDeviceManager_GetDevices_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool UsbDeviceManager_GetDevices_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 UsbDeviceManager_GetDevices_ResponseParams_Data* object =
static_cast<const UsbDeviceManager_GetDevices_ResponseParams_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->results, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& results_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->results, validation_context,
&results_validate_params)) {
return false;
}
return true;
}
UsbDeviceManager_GetDevices_ResponseParams_Data::UsbDeviceManager_GetDevices_ResponseParams_Data()
: header_({sizeof(*this), 0}) {}
// static
bool UsbDeviceManager_GetDevice_Params_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 UsbDeviceManager_GetDevice_Params_Data* object =
static_cast<const UsbDeviceManager_GetDevice_Params_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->guid, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& guid_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->guid, validation_context,
&guid_validate_params)) {
return false;
}
if (!mojo::internal::ValidatePointerNonNullable(
object->blocked_interface_classes, 2, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& blocked_interface_classes_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->blocked_interface_classes, validation_context,
&blocked_interface_classes_validate_params)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterfaceNonNullable(
object->device_receiver, 3, validation_context)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterface(object->device_receiver,
validation_context)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterface(object->device_client,
validation_context)) {
return false;
}
return true;
}
UsbDeviceManager_GetDevice_Params_Data::UsbDeviceManager_GetDevice_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool UsbDeviceManager_GetSecurityKeyDevice_Params_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 UsbDeviceManager_GetSecurityKeyDevice_Params_Data* object =
static_cast<const UsbDeviceManager_GetSecurityKeyDevice_Params_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->guid, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& guid_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->guid, validation_context,
&guid_validate_params)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterfaceNonNullable(
object->device_receiver, 2, validation_context)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterface(object->device_receiver,
validation_context)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterface(object->device_client,
validation_context)) {
return false;
}
return true;
}
UsbDeviceManager_GetSecurityKeyDevice_Params_Data::UsbDeviceManager_GetSecurityKeyDevice_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool UsbDeviceManager_SetClient_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 UsbDeviceManager_SetClient_Params_Data* object =
static_cast<const UsbDeviceManager_SetClient_Params_Data*>(data);
if (!mojo::internal::ValidateHandleOrInterfaceNonNullable(
object->client, 1, validation_context)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterface(object->client,
validation_context)) {
return false;
}
return true;
}
UsbDeviceManager_SetClient_Params_Data::UsbDeviceManager_SetClient_Params_Data()
: header_({sizeof(*this), 0}) {}
} // namespace internal
} // namespace mojom
} // namespace device