// ui/accessibility/mojom/ax_event.mojom-blink.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/accessibility/mojom/ax_event.mojom-blink.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/accessibility/mojom/ax_event.mojom-params-data.h"
#include "ui/accessibility/mojom/ax_event.mojom-shared-message-ids.h"

#include "ui/accessibility/mojom/ax_event.mojom-blink-import-headers.h"
#include "ui/accessibility/mojom/ax_event.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


namespace ax::mojom::blink {
AXEvent::AXEvent()
    : event_type(),
      id(),
      event_from(),
      event_from_action(),
      event_intents(),
      action_request_id() {}

AXEvent::AXEvent(
    ::ax::mojom::blink::Event event_type_in,
    int32_t id_in,
    ::ax::mojom::blink::EventFrom event_from_in,
    ::ax::mojom::blink::Action event_from_action_in,
    ::blink::Vector<::ax::mojom::blink::EventIntentPtr> event_intents_in,
    int32_t action_request_id_in)
    : event_type(std::move(event_type_in)),
      id(std::move(id_in)),
      event_from(std::move(event_from_in)),
      event_from_action(std::move(event_from_action_in)),
      event_intents(std::move(event_intents_in)),
      action_request_id(std::move(action_request_id_in)) {}

AXEvent::~AXEvent() = default;

void AXEvent::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "event_type"), this->event_type,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::ax::mojom::blink::Event>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  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(
      "event_from"), this->event_from,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::ax::mojom::blink::EventFrom>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "event_from_action"), this->event_from_action,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::ax::mojom::blink::Action>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "event_intents"), this->event_intents,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::blink::Vector<::ax::mojom::blink::EventIntentPtr>>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "action_request_id"), this->action_request_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // ax::mojom::blink


namespace mojo {


// static
bool StructTraits<::ax::mojom::blink::AXEvent::DataView, ::ax::mojom::blink::AXEventPtr>::Read(
    ::ax::mojom::blink::AXEvent::DataView input,
    ::ax::mojom::blink::AXEventPtr* output) {
  bool success = true;
  ::ax::mojom::blink::AXEventPtr result(::ax::mojom::blink::AXEvent::New());
  
      if (success && !input.ReadEventType(&result->event_type))
        success = false;
      if (success)
        result->id = input.id();
      if (success && !input.ReadEventFrom(&result->event_from))
        success = false;
      if (success && !input.ReadEventFromAction(&result->event_from_action))
        success = false;
      if (success && !input.ReadEventIntents(&result->event_intents))
        success = false;
      if (success)
        result->action_request_id = input.action_request_id();
  *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 ax::mojom::blink {




}  // ax::mojom::blink


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