// ui/events/mojom/motion_event_android.mojom.cc is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif

#include "ui/events/mojom/motion_event_android.mojom.h"
#include <stdint.h>
#include <utility>
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "ui/events/mojom/motion_event_android.mojom-params-data.h"
#include "ui/events/mojom/motion_event_android.mojom-shared-message-ids.h"

#include "ui/events/mojom/motion_event_android.mojom-import-headers.h"
#include "ui/events/mojom/motion_event_android.mojom-test-utils.h"


namespace ui::mojom {
PointerCoordinates::PointerCoordinates()
    : position(),
      touch_major() {}

PointerCoordinates::PointerCoordinates(
    const ::gfx::PointF& position_in,
    float touch_major_in)
    : position(std::move(position_in)),
      touch_major(std::move(touch_major_in)) {}

PointerCoordinates::~PointerCoordinates() = default;

void PointerCoordinates::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "position"), this->position,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::PointF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "touch_major"), this->touch_major,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool PointerCoordinates::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
MotionEventAndroidCachedPointer::MotionEventAndroidCachedPointer()
    : id(),
      pointer_data(),
      touch_minor(),
      pressure(),
      orientation(),
      tilt_x(),
      tilt_y(),
      tool_type() {}

MotionEventAndroidCachedPointer::MotionEventAndroidCachedPointer(
    int32_t id_in,
    const ::ui::MotionEventAndroid::PointerCoordinates& pointer_data_in,
    float touch_minor_in,
    float pressure_in,
    float orientation_in,
    float tilt_x_in,
    float tilt_y_in,
    int32_t tool_type_in)
    : id(std::move(id_in)),
      pointer_data(std::move(pointer_data_in)),
      touch_minor(std::move(touch_minor_in)),
      pressure(std::move(pressure_in)),
      orientation(std::move(orientation_in)),
      tilt_x(std::move(tilt_x_in)),
      tilt_y(std::move(tilt_y_in)),
      tool_type(std::move(tool_type_in)) {}

MotionEventAndroidCachedPointer::~MotionEventAndroidCachedPointer() = default;

void MotionEventAndroidCachedPointer::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "id"), this->id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "pointer_data"), this->pointer_data,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::ui::MotionEventAndroid::PointerCoordinates&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "touch_minor"), this->touch_minor,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "pressure"), this->pressure,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "orientation"), this->orientation,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "tilt_x"), this->tilt_x,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "tilt_y"), this->tilt_y,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "tool_type"), this->tool_type,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool MotionEventAndroidCachedPointer::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
HistoricalCachedPointer::HistoricalCachedPointer()
    : pointers(),
      event_time() {}

HistoricalCachedPointer::HistoricalCachedPointer(
    std::vector<::ui::MotionEventAndroid::PointerCoordinates> pointers_in,
    ::base::TimeTicks event_time_in)
    : pointers(std::move(pointers_in)),
      event_time(std::move(event_time_in)) {}

HistoricalCachedPointer::~HistoricalCachedPointer() = default;

void HistoricalCachedPointer::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "pointers"), this->pointers,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::vector<::ui::MotionEventAndroid::PointerCoordinates>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "event_time"), this->event_time,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::base::TimeTicks>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool HistoricalCachedPointer::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
CachedMotionEventAndroid::CachedMotionEventAndroid()
    : pix_to_dip(),
      ticks_x(),
      ticks_y(),
      tick_multiplier(),
      source(),
      for_touch_handle(),
      latest_event_time(),
      down_time_ms(),
      action(),
      action_index(),
      action_button(),
      gesture_classification(),
      button_state(),
      flags(),
      raw_position_offset(),
      pointers(),
      historical_events() {}

CachedMotionEventAndroid::CachedMotionEventAndroid(
    float pix_to_dip_in,
    float ticks_x_in,
    float ticks_y_in,
    float tick_multiplier_in,
    int32_t source_in,
    bool for_touch_handle_in,
    ::base::TimeTicks latest_event_time_in,
    ::base::TimeTicks down_time_ms_in,
    int32_t action_in,
    int32_t action_index_in,
    int32_t action_button_in,
    int32_t gesture_classification_in,
    int32_t button_state_in,
    int32_t flags_in,
    const ::gfx::Vector2dF& raw_position_offset_in,
    std::vector<::ui::MotionEventAndroid::CachedPointer> pointers_in,
    std::vector<::ui::CachedHistoricalEventSource::HistoricalCachedPointer> historical_events_in)
    : pix_to_dip(std::move(pix_to_dip_in)),
      ticks_x(std::move(ticks_x_in)),
      ticks_y(std::move(ticks_y_in)),
      tick_multiplier(std::move(tick_multiplier_in)),
      source(std::move(source_in)),
      for_touch_handle(std::move(for_touch_handle_in)),
      latest_event_time(std::move(latest_event_time_in)),
      down_time_ms(std::move(down_time_ms_in)),
      action(std::move(action_in)),
      action_index(std::move(action_index_in)),
      action_button(std::move(action_button_in)),
      gesture_classification(std::move(gesture_classification_in)),
      button_state(std::move(button_state_in)),
      flags(std::move(flags_in)),
      raw_position_offset(std::move(raw_position_offset_in)),
      pointers(std::move(pointers_in)),
      historical_events(std::move(historical_events_in)) {}

CachedMotionEventAndroid::~CachedMotionEventAndroid() = default;

void CachedMotionEventAndroid::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "pix_to_dip"), this->pix_to_dip,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "ticks_x"), this->ticks_x,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "ticks_y"), this->ticks_y,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "tick_multiplier"), this->tick_multiplier,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "source"), this->source,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "for_touch_handle"), this->for_touch_handle,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "latest_event_time"), this->latest_event_time,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::base::TimeTicks>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "down_time_ms"), this->down_time_ms,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::base::TimeTicks>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "action"), this->action,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "action_index"), this->action_index,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "action_button"), this->action_button,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "gesture_classification"), this->gesture_classification,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "button_state"), this->button_state,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "flags"), this->flags,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "raw_position_offset"), this->raw_position_offset,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Vector2dF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "pointers"), this->pointers,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::vector<::ui::MotionEventAndroid::CachedPointer>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "historical_events"), this->historical_events,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::vector<::ui::CachedHistoricalEventSource::HistoricalCachedPointer>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool CachedMotionEventAndroid::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}


}  // ui::mojom


namespace mojo {


// static
bool StructTraits<::ui::mojom::PointerCoordinates::DataView, ::ui::mojom::PointerCoordinatesPtr>::Read(
    ::ui::mojom::PointerCoordinates::DataView input,
    ::ui::mojom::PointerCoordinatesPtr* output) {
  bool success = true;
  ::ui::mojom::PointerCoordinatesPtr result(::ui::mojom::PointerCoordinates::New());
  
      if (success && !input.ReadPosition(&result->position))
        success = false;
      if (success)
        result->touch_major = input.touch_major();
  *output = std::move(result);
  return success;
}


// static
bool StructTraits<::ui::mojom::MotionEventAndroidCachedPointer::DataView, ::ui::mojom::MotionEventAndroidCachedPointerPtr>::Read(
    ::ui::mojom::MotionEventAndroidCachedPointer::DataView input,
    ::ui::mojom::MotionEventAndroidCachedPointerPtr* output) {
  bool success = true;
  ::ui::mojom::MotionEventAndroidCachedPointerPtr result(::ui::mojom::MotionEventAndroidCachedPointer::New());
  
      if (success)
        result->id = input.id();
      if (success && !input.ReadPointerData(&result->pointer_data))
        success = false;
      if (success)
        result->touch_minor = input.touch_minor();
      if (success)
        result->pressure = input.pressure();
      if (success)
        result->orientation = input.orientation();
      if (success)
        result->tilt_x = input.tilt_x();
      if (success)
        result->tilt_y = input.tilt_y();
      if (success)
        result->tool_type = input.tool_type();
  *output = std::move(result);
  return success;
}


// static
bool StructTraits<::ui::mojom::HistoricalCachedPointer::DataView, ::ui::mojom::HistoricalCachedPointerPtr>::Read(
    ::ui::mojom::HistoricalCachedPointer::DataView input,
    ::ui::mojom::HistoricalCachedPointerPtr* output) {
  bool success = true;
  ::ui::mojom::HistoricalCachedPointerPtr result(::ui::mojom::HistoricalCachedPointer::New());
  
      if (success && !input.ReadPointers(&result->pointers))
        success = false;
      if (success && !input.ReadEventTime(&result->event_time))
        success = false;
  *output = std::move(result);
  return success;
}


// static
bool StructTraits<::ui::mojom::CachedMotionEventAndroid::DataView, ::ui::mojom::CachedMotionEventAndroidPtr>::Read(
    ::ui::mojom::CachedMotionEventAndroid::DataView input,
    ::ui::mojom::CachedMotionEventAndroidPtr* output) {
  bool success = true;
  ::ui::mojom::CachedMotionEventAndroidPtr result(::ui::mojom::CachedMotionEventAndroid::New());
  
      if (success)
        result->pix_to_dip = input.pix_to_dip();
      if (success)
        result->ticks_x = input.ticks_x();
      if (success)
        result->ticks_y = input.ticks_y();
      if (success)
        result->tick_multiplier = input.tick_multiplier();
      if (success)
        result->source = input.source();
      if (success)
        result->for_touch_handle = input.for_touch_handle();
      if (success && !input.ReadLatestEventTime(&result->latest_event_time))
        success = false;
      if (success && !input.ReadDownTimeMs(&result->down_time_ms))
        success = false;
      if (success)
        result->action = input.action();
      if (success)
        result->action_index = input.action_index();
      if (success)
        result->action_button = input.action_button();
      if (success)
        result->gesture_classification = input.gesture_classification();
      if (success)
        result->button_state = input.button_state();
      if (success)
        result->flags = input.flags();
      if (success && !input.ReadRawPositionOffset(&result->raw_position_offset))
        success = false;
      if (success && !input.ReadPointers(&result->pointers))
        success = false;
      if (success && !input.ReadHistoricalEvents(&result->historical_events))
        success = false;
  *output = std::move(result);
  return success;
}

}  // namespace mojo


// Symbols declared in the -test-utils.h header are defined here instead of a
// separate .cc file to save compile time.


namespace ui::mojom {




}  // ui::mojom


#if defined(__clang__)
#pragma clang diagnostic pop
#endif