// components/surface_embed/common/surface_embed.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 "components/surface_embed/common/surface_embed.mojom.h"
#include <math.h>
#include <stdint.h>
#include <utility>
#include "base/debug/alias.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/generated_code_util.h"
#include "mojo/public/cpp/bindings/lib/message_internal.h"
#include "mojo/public/cpp/bindings/lib/proxy_to_responder.h"
#include "mojo/public/cpp/bindings/lib/send_message_helper.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/lib/unserialized_message_context.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 "mojo/public/cpp/bindings/urgent_message_scope.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "components/surface_embed/common/surface_embed.mojom-params-data.h"
#include "components/surface_embed/common/surface_embed.mojom-shared-message-ids.h"

#include "components/surface_embed/common/surface_embed.mojom-import-headers.h"
#include "components/surface_embed/common/surface_embed.mojom-test-utils.h"


namespace surface_embed::mojom {
RenderThrottlingStatus::RenderThrottlingStatus()
    : is_throttled(),
      subtree_throttled(),
      display_locked() {}

RenderThrottlingStatus::RenderThrottlingStatus(
    bool is_throttled_in,
    bool subtree_throttled_in,
    bool display_locked_in)
    : is_throttled(std::move(is_throttled_in)),
      subtree_throttled(std::move(subtree_throttled_in)),
      display_locked(std::move(display_locked_in)) {}

RenderThrottlingStatus::~RenderThrottlingStatus() = default;
size_t RenderThrottlingStatus::Hash(size_t seed) const {
  seed = mojo::internal::Hash(seed, this->is_throttled);
  seed = mojo::internal::Hash(seed, this->subtree_throttled);
  seed = mojo::internal::Hash(seed, this->display_locked);
  return seed;
}

void RenderThrottlingStatus::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "is_throttled"), this->is_throttled,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "subtree_throttled"), this->subtree_throttled,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "display_locked"), this->display_locked,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool RenderThrottlingStatus::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
// The declaration includes the definition on other builds.

SurfaceEmbed::IPCStableHashFunction SurfaceEmbed::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
  switch (static_cast<messages::SurfaceEmbed>(message.name())) {
    case messages::SurfaceEmbed::kSetFrameSinkId: {
      return &SurfaceEmbed::SetFrameSinkId_Sym::IPCStableHash;
    }
    case messages::SurfaceEmbed::kUpdateLocalSurfaceIdFromChild: {
      return &SurfaceEmbed::UpdateLocalSurfaceIdFromChild_Sym::IPCStableHash;
    }
    case messages::SurfaceEmbed::kChildProcessGone: {
      return &SurfaceEmbed::ChildProcessGone_Sym::IPCStableHash;
    }
    case messages::SurfaceEmbed::kRequestFocusOnEmbedElement: {
      return &SurfaceEmbed::RequestFocusOnEmbedElement_Sym::IPCStableHash;
    }
    case messages::SurfaceEmbed::kAdvanceFocusFromEmbedElement: {
      return &SurfaceEmbed::AdvanceFocusFromEmbedElement_Sym::IPCStableHash;
    }
  }
#endif  // !BUILDFLAG(IS_FUCHSIA)
  return nullptr;
}


const char* SurfaceEmbed::MessageToMethodName_(mojo::Message& message) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  bool is_response = message.has_flag(mojo::Message::kFlagIsResponse);
  if (!is_response) {
    switch (static_cast<messages::SurfaceEmbed>(message.name())) {
      case messages::SurfaceEmbed::kSetFrameSinkId:
            return "Receive surface_embed::mojom::SurfaceEmbed::SetFrameSinkId";
      case messages::SurfaceEmbed::kUpdateLocalSurfaceIdFromChild:
            return "Receive surface_embed::mojom::SurfaceEmbed::UpdateLocalSurfaceIdFromChild";
      case messages::SurfaceEmbed::kChildProcessGone:
            return "Receive surface_embed::mojom::SurfaceEmbed::ChildProcessGone";
      case messages::SurfaceEmbed::kRequestFocusOnEmbedElement:
            return "Receive surface_embed::mojom::SurfaceEmbed::RequestFocusOnEmbedElement";
      case messages::SurfaceEmbed::kAdvanceFocusFromEmbedElement:
            return "Receive surface_embed::mojom::SurfaceEmbed::AdvanceFocusFromEmbedElement";
    }
  } else {
    switch (static_cast<messages::SurfaceEmbed>(message.name())) {
      case messages::SurfaceEmbed::kSetFrameSinkId:
            return "Receive reply surface_embed::mojom::SurfaceEmbed::SetFrameSinkId";
      case messages::SurfaceEmbed::kUpdateLocalSurfaceIdFromChild:
            return "Receive reply surface_embed::mojom::SurfaceEmbed::UpdateLocalSurfaceIdFromChild";
      case messages::SurfaceEmbed::kChildProcessGone:
            return "Receive reply surface_embed::mojom::SurfaceEmbed::ChildProcessGone";
      case messages::SurfaceEmbed::kRequestFocusOnEmbedElement:
            return "Receive reply surface_embed::mojom::SurfaceEmbed::RequestFocusOnEmbedElement";
      case messages::SurfaceEmbed::kAdvanceFocusFromEmbedElement:
            return "Receive reply surface_embed::mojom::SurfaceEmbed::AdvanceFocusFromEmbedElement";
    }
  }
  return "Receive unknown mojo message";
#else
  bool is_response = message.has_flag(mojo::Message::kFlagIsResponse);
  if (is_response) {
    return "Receive mojo reply";
  } else {
    return "Receive mojo message";
  }
#endif // BUILDFLAG(MOJO_TRACE_ENABLED)
}

#if !BUILDFLAG(IS_FUCHSIA)
uint32_t SurfaceEmbed::SetFrameSinkId_Sym::IPCStableHash() {
  // This method's address is used for identifying the mojo method name after
  // symbolization. So each IPCStableHash should have a unique address.
  // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
  // __LINE__ value, which is not unique across different mojo modules.
  // The code below is very similar to NO_CODE_FOLDING, but it uses a unique
  // hash instead of __LINE__.
  static constexpr uint32_t kHash = 0x05a70d5f;  // IPCStableHash for surface_embed::mojom::SurfaceEmbed::SetFrameSinkId
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t SurfaceEmbed::UpdateLocalSurfaceIdFromChild_Sym::IPCStableHash() {
  // This method's address is used for identifying the mojo method name after
  // symbolization. So each IPCStableHash should have a unique address.
  // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
  // __LINE__ value, which is not unique across different mojo modules.
  // The code below is very similar to NO_CODE_FOLDING, but it uses a unique
  // hash instead of __LINE__.
  static constexpr uint32_t kHash = 0x3fc90984;  // IPCStableHash for surface_embed::mojom::SurfaceEmbed::UpdateLocalSurfaceIdFromChild
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t SurfaceEmbed::ChildProcessGone_Sym::IPCStableHash() {
  // This method's address is used for identifying the mojo method name after
  // symbolization. So each IPCStableHash should have a unique address.
  // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
  // __LINE__ value, which is not unique across different mojo modules.
  // The code below is very similar to NO_CODE_FOLDING, but it uses a unique
  // hash instead of __LINE__.
  static constexpr uint32_t kHash = 0x993a50e2;  // IPCStableHash for surface_embed::mojom::SurfaceEmbed::ChildProcessGone
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t SurfaceEmbed::RequestFocusOnEmbedElement_Sym::IPCStableHash() {
  // This method's address is used for identifying the mojo method name after
  // symbolization. So each IPCStableHash should have a unique address.
  // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
  // __LINE__ value, which is not unique across different mojo modules.
  // The code below is very similar to NO_CODE_FOLDING, but it uses a unique
  // hash instead of __LINE__.
  static constexpr uint32_t kHash = 0x40b9eb67;  // IPCStableHash for surface_embed::mojom::SurfaceEmbed::RequestFocusOnEmbedElement
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t SurfaceEmbed::AdvanceFocusFromEmbedElement_Sym::IPCStableHash() {
  // This method's address is used for identifying the mojo method name after
  // symbolization. So each IPCStableHash should have a unique address.
  // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
  // __LINE__ value, which is not unique across different mojo modules.
  // The code below is very similar to NO_CODE_FOLDING, but it uses a unique
  // hash instead of __LINE__.
  static constexpr uint32_t kHash = 0x01162f5c;  // IPCStableHash for surface_embed::mojom::SurfaceEmbed::AdvanceFocusFromEmbedElement
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)

class SurfaceEmbed_RequestFocusOnEmbedElement_ForwardToCallback
    : public mojo::MessageReceiver {
 public:
  SurfaceEmbed_RequestFocusOnEmbedElement_ForwardToCallback(
      SurfaceEmbed::RequestFocusOnEmbedElementCallback callback
      ) : callback_(std::move(callback)) {
  }

  SurfaceEmbed_RequestFocusOnEmbedElement_ForwardToCallback(const SurfaceEmbed_RequestFocusOnEmbedElement_ForwardToCallback&) = delete;
  SurfaceEmbed_RequestFocusOnEmbedElement_ForwardToCallback& operator=(const SurfaceEmbed_RequestFocusOnEmbedElement_ForwardToCallback&) = delete;

  bool Accept(mojo::Message* message) override;
 private:
  SurfaceEmbed::RequestFocusOnEmbedElementCallback callback_;
};

SurfaceEmbedProxy::SurfaceEmbedProxy(mojo::MessageReceiverWithResponder* receiver)
    : receiver_(receiver) {
}

void SurfaceEmbedProxy::SetFrameSinkId(
    const ::viz::FrameSinkId& in_frame_sink_id, bool in_allow_paint_holding) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send surface_embed::mojom::SurfaceEmbed::SetFrameSinkId", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("frame_sink_id"), in_frame_sink_id,
                        "<value of type const ::viz::FrameSinkId&>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("allow_paint_holding"), in_allow_paint_holding,
                        "<value of type bool>");
   });
#endif

  const bool kExpectsResponse = false;
  const bool kIsSync = false;
  const bool kAllowInterrupt = true;
  const bool is_urgent = false;

  const uint32_t kFlags =
      ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
      ((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
      ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
      ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);

  const size_t estimated_payload_size =
    0;
  mojo::Message message(
      std::to_underlying(messages::SurfaceEmbed::kSetFrameSinkId), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::surface_embed::mojom::internal::SurfaceEmbed_SetFrameSinkId_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->frame_sink_id)::BaseType> frame_sink_id_fragment(
          params.message());
  
  mojo::internal::Serialize<::viz::mojom::FrameSinkIdDataView>(
    in_frame_sink_id,
    frame_sink_id_fragment);

  params->frame_sink_id.Set(
      frame_sink_id_fragment.is_null() ? nullptr : frame_sink_id_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->frame_sink_id.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null frame_sink_id in SurfaceEmbed.SetFrameSinkId request");

  params->allow_paint_holding = in_allow_paint_holding;

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(SurfaceEmbed::Name_);
  message.set_method_name("SetFrameSinkId");
#endif
  // This return value may be ignored as false implies the Connector has
  // encountered an error, which will be visible through other means.
  ::mojo::internal::SendMojoMessage(*receiver_, message);
}

void SurfaceEmbedProxy::UpdateLocalSurfaceIdFromChild(
    const ::viz::LocalSurfaceId& in_local_surface_id) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send surface_embed::mojom::SurfaceEmbed::UpdateLocalSurfaceIdFromChild", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("local_surface_id"), in_local_surface_id,
                        "<value of type const ::viz::LocalSurfaceId&>");
   });
#endif

  const bool kExpectsResponse = false;
  const bool kIsSync = false;
  const bool kAllowInterrupt = true;
  const bool is_urgent = false;

  const uint32_t kFlags =
      ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
      ((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
      ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
      ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);

  const size_t estimated_payload_size =
    0;
  mojo::Message message(
      std::to_underlying(messages::SurfaceEmbed::kUpdateLocalSurfaceIdFromChild), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::surface_embed::mojom::internal::SurfaceEmbed_UpdateLocalSurfaceIdFromChild_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->local_surface_id)::BaseType> local_surface_id_fragment(
          params.message());
  
  mojo::internal::Serialize<::viz::mojom::LocalSurfaceIdDataView>(
    in_local_surface_id,
    local_surface_id_fragment);

  params->local_surface_id.Set(
      local_surface_id_fragment.is_null() ? nullptr : local_surface_id_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->local_surface_id.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null local_surface_id in SurfaceEmbed.UpdateLocalSurfaceIdFromChild request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(SurfaceEmbed::Name_);
  message.set_method_name("UpdateLocalSurfaceIdFromChild");
#endif
  // This return value may be ignored as false implies the Connector has
  // encountered an error, which will be visible through other means.
  ::mojo::internal::SendMojoMessage(*receiver_, message);
}

void SurfaceEmbedProxy::ChildProcessGone(
    ) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT0("mojom", "Send surface_embed::mojom::SurfaceEmbed::ChildProcessGone");
#endif

  const bool kExpectsResponse = false;
  const bool kIsSync = false;
  const bool kAllowInterrupt = true;
  const bool is_urgent = false;

  const uint32_t kFlags =
      ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
      ((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
      ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
      ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);

  const size_t estimated_payload_size =
    0;
  mojo::Message message(
      std::to_underlying(messages::SurfaceEmbed::kChildProcessGone), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::surface_embed::mojom::internal::SurfaceEmbed_ChildProcessGone_Params_Data> params(
          message);
  params.Allocate();

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(SurfaceEmbed::Name_);
  message.set_method_name("ChildProcessGone");
#endif
  // This return value may be ignored as false implies the Connector has
  // encountered an error, which will be visible through other means.
  ::mojo::internal::SendMojoMessage(*receiver_, message);
}

void SurfaceEmbedProxy::RequestFocusOnEmbedElement(
    RequestFocusOnEmbedElementCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT0("mojom", "Send surface_embed::mojom::SurfaceEmbed::RequestFocusOnEmbedElement");
#endif

  const bool kExpectsResponse = true;
  const bool kIsSync = false;
  const bool kAllowInterrupt = true;
  const bool is_urgent = false;

  const uint32_t kFlags =
      ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
      ((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
      ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
      ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);

  const size_t estimated_payload_size =
    0;
  mojo::Message message(
      std::to_underlying(messages::SurfaceEmbed::kRequestFocusOnEmbedElement), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::surface_embed::mojom::internal::SurfaceEmbed_RequestFocusOnEmbedElement_Params_Data> params(
          message);
  params.Allocate();

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(SurfaceEmbed::Name_);
  message.set_method_name("RequestFocusOnEmbedElement");
#endif
  std::unique_ptr<mojo::MessageReceiver> responder(
      new SurfaceEmbed_RequestFocusOnEmbedElement_ForwardToCallback(
          std::move(callback)));
  ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
}

void SurfaceEmbedProxy::AdvanceFocusFromEmbedElement(
    bool in_reverse) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send surface_embed::mojom::SurfaceEmbed::AdvanceFocusFromEmbedElement", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("reverse"), in_reverse,
                        "<value of type bool>");
   });
#endif

  const bool kExpectsResponse = false;
  const bool kIsSync = false;
  const bool kAllowInterrupt = true;
  const bool is_urgent = false;

  const uint32_t kFlags =
      ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
      ((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
      ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
      ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);

  const size_t estimated_payload_size =
    0;
  mojo::Message message(
      std::to_underlying(messages::SurfaceEmbed::kAdvanceFocusFromEmbedElement), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::surface_embed::mojom::internal::SurfaceEmbed_AdvanceFocusFromEmbedElement_Params_Data> params(
          message);
  params.Allocate();

  params->reverse = in_reverse;

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(SurfaceEmbed::Name_);
  message.set_method_name("AdvanceFocusFromEmbedElement");
#endif
  // This return value may be ignored as false implies the Connector has
  // encountered an error, which will be visible through other means.
  ::mojo::internal::SendMojoMessage(*receiver_, message);
}
class SurfaceEmbed_RequestFocusOnEmbedElement_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
 public:
  static SurfaceEmbed::RequestFocusOnEmbedElementCallback CreateCallback(
      ::mojo::Message& message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
    std::unique_ptr<SurfaceEmbed_RequestFocusOnEmbedElement_ProxyToResponder> proxy(
        new SurfaceEmbed_RequestFocusOnEmbedElement_ProxyToResponder(
            message, std::move(responder)));
    return base::BindOnce(&SurfaceEmbed_RequestFocusOnEmbedElement_ProxyToResponder::Run,
                          std::move(proxy));
  }

  ~SurfaceEmbed_RequestFocusOnEmbedElement_ProxyToResponder() {
#if DCHECK_IS_ON()
    if (responder_) {
      // If we're being destroyed without being run, we want to ensure the
      // binding endpoint has been closed. This checks for that asynchronously.
      // We pass a bound generated callback to handle the response so that any
      // resulting DCHECK stack will have useful interface type information.
      // Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to
      // fizzle if this happens after shutdown and the endpoint is bound to a
      // BLOCK_SHUTDOWN sequence.
      base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler;
      responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete));
    }
#endif
  }

 private:
  SurfaceEmbed_RequestFocusOnEmbedElement_ProxyToResponder(
      ::mojo::Message& message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder)
      : ::mojo::internal::ProxyToResponder(message, std::move(responder)) {
  }

#if DCHECK_IS_ON()
  static void OnIsConnectedComplete(bool connected) {
    DCHECK(!connected)
        << "SurfaceEmbed::RequestFocusOnEmbedElementCallback was destroyed without "
        << "first either being run or its corresponding binding being closed. "
        << "It is an error to drop response callbacks which still correspond "
        << "to an open interface pipe.";
  }
#endif

  void Run(
      );
};

bool SurfaceEmbed_RequestFocusOnEmbedElement_ForwardToCallback::Accept(
    mojo::Message* message) {
  DCHECK(message->is_serialized());
  internal::SurfaceEmbed_RequestFocusOnEmbedElement_ResponseParams_Data* params =
      reinterpret_cast<
          internal::SurfaceEmbed_RequestFocusOnEmbedElement_ResponseParams_Data*>(
              message->mutable_payload());
  

  // Validation for SurfaceEmbed.3
  bool success = true;
  SurfaceEmbed_RequestFocusOnEmbedElement_ResponseParamsDataView input_data_view(params, message);
  
  if (!success) {
    ReportValidationErrorForMessage(
        message,
        mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
        SurfaceEmbed::Name_, 3, true);
    return false;
  }
  if (!callback_.is_null()) {
    std::move(callback_).Run();
  }
  return true;
}

void SurfaceEmbed_RequestFocusOnEmbedElement_ProxyToResponder::Run(
    ) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT0("mojom", "Send reply surface_embed::mojom::SurfaceEmbed::RequestFocusOnEmbedElement");
#endif

  const uint32_t kFlags = mojo::Message::kFlagIsResponse |
      ((is_sync_) ? mojo::Message::kFlagIsSync : 0) |
      ((true) ? 0 : mojo::Message::kFlagNoInterrupt) |
      ((false) ? mojo::Message::kFlagIsUrgent : 0);

  const size_t estimated_payload_size =
    0;
  mojo::Message message(
      std::to_underlying(messages::SurfaceEmbed::kRequestFocusOnEmbedElement), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::surface_embed::mojom::internal::SurfaceEmbed_RequestFocusOnEmbedElement_ResponseParams_Data> params(
          message);
  params.Allocate();

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(SurfaceEmbed::Name_);
  message.set_method_name("RequestFocusOnEmbedElement");
#endif

  message.set_request_id(request_id_);
  message.set_trace_nonce(trace_nonce_);
  ::mojo::internal::SendMojoMessage(*responder_, message);
  // SendMojoMessage() fails silently if the responder connection is closed,
  // or if the message is malformed.
  //
  // TODO(darin): If Accept() returns false due to a malformed message, that
  // may be good reason to close the connection. However, we don't have a
  // way to do that from here. We should add a way.
  responder_ = nullptr;
}

// static
bool SurfaceEmbedStubDispatch::Accept(
    SurfaceEmbed* impl,
    mojo::Message* message) {
  switch (static_cast<messages::SurfaceEmbed>(message->header()->name)) {
    case messages::SurfaceEmbed::kSetFrameSinkId: {
      DCHECK(message->is_serialized());
      internal::SurfaceEmbed_SetFrameSinkId_Params_Data* params =
          reinterpret_cast<internal::SurfaceEmbed_SetFrameSinkId_Params_Data*>(
              message->mutable_payload());
      

      // Validation for SurfaceEmbed.0
      bool success = true;
      ::viz::FrameSinkId p_frame_sink_id{};
      bool p_allow_paint_holding{};
      SurfaceEmbed_SetFrameSinkId_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadFrameSinkId(&p_frame_sink_id))
        success = false;
      if (success)
        p_allow_paint_holding = input_data_view.allow_paint_holding();
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            SurfaceEmbed::Name_, 0, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->SetFrameSinkId(        
        std::move(p_frame_sink_id), 
        std::move(p_allow_paint_holding));
      return true;
    }
    case messages::SurfaceEmbed::kUpdateLocalSurfaceIdFromChild: {
      DCHECK(message->is_serialized());
      internal::SurfaceEmbed_UpdateLocalSurfaceIdFromChild_Params_Data* params =
          reinterpret_cast<internal::SurfaceEmbed_UpdateLocalSurfaceIdFromChild_Params_Data*>(
              message->mutable_payload());
      

      // Validation for SurfaceEmbed.1
      bool success = true;
      ::viz::LocalSurfaceId p_local_surface_id{};
      SurfaceEmbed_UpdateLocalSurfaceIdFromChild_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadLocalSurfaceId(&p_local_surface_id))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            SurfaceEmbed::Name_, 1, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->UpdateLocalSurfaceIdFromChild(        
        std::move(p_local_surface_id));
      return true;
    }
    case messages::SurfaceEmbed::kChildProcessGone: {
      DCHECK(message->is_serialized());
      internal::SurfaceEmbed_ChildProcessGone_Params_Data* params =
          reinterpret_cast<internal::SurfaceEmbed_ChildProcessGone_Params_Data*>(
              message->mutable_payload());
      

      // Validation for SurfaceEmbed.2
      bool success = true;
      SurfaceEmbed_ChildProcessGone_ParamsDataView input_data_view(params, message);
      
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            SurfaceEmbed::Name_, 2, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->ChildProcessGone(        );
      return true;
    }
    case messages::SurfaceEmbed::kRequestFocusOnEmbedElement: {
      break;
    }
    case messages::SurfaceEmbed::kAdvanceFocusFromEmbedElement: {
      DCHECK(message->is_serialized());
      internal::SurfaceEmbed_AdvanceFocusFromEmbedElement_Params_Data* params =
          reinterpret_cast<internal::SurfaceEmbed_AdvanceFocusFromEmbedElement_Params_Data*>(
              message->mutable_payload());
      

      // Validation for SurfaceEmbed.4
      bool success = true;
      bool p_reverse{};
      SurfaceEmbed_AdvanceFocusFromEmbedElement_ParamsDataView input_data_view(params, message);
      
      if (success)
        p_reverse = input_data_view.reverse();
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            SurfaceEmbed::Name_, 4, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->AdvanceFocusFromEmbedElement(        
        std::move(p_reverse));
      return true;
    }
  }
  return false;
}

// static
bool SurfaceEmbedStubDispatch::AcceptWithResponder(
    SurfaceEmbed* impl,
    mojo::Message* message,
    std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
  [[maybe_unused]] const bool message_is_sync =
      message->has_flag(mojo::Message::kFlagIsSync);
  [[maybe_unused]] const uint64_t request_id = message->request_id();
  switch (static_cast<messages::SurfaceEmbed>(message->header()->name)) {
    case messages::SurfaceEmbed::kSetFrameSinkId: {
      break;
    }
    case messages::SurfaceEmbed::kUpdateLocalSurfaceIdFromChild: {
      break;
    }
    case messages::SurfaceEmbed::kChildProcessGone: {
      break;
    }
    case messages::SurfaceEmbed::kRequestFocusOnEmbedElement: {
      internal::SurfaceEmbed_RequestFocusOnEmbedElement_Params_Data* params =
          reinterpret_cast<
              internal::SurfaceEmbed_RequestFocusOnEmbedElement_Params_Data*>(
                  message->mutable_payload());
      

      // Validation for SurfaceEmbed.3
      bool success = true;
      SurfaceEmbed_RequestFocusOnEmbedElement_ParamsDataView input_data_view(params, message);
      
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            SurfaceEmbed::Name_, 3, false);
        return false;
      }
      auto callback =
          SurfaceEmbed_RequestFocusOnEmbedElement_ProxyToResponder::CreateCallback(
              *message, std::move(responder));
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->RequestFocusOnEmbedElement(std::move(callback));
      return true;
    }
    case messages::SurfaceEmbed::kAdvanceFocusFromEmbedElement: {
      break;
    }
  }
  return false;
}
namespace {
}  // namespace
static const mojo::internal::GenericValidationInfo kSurfaceEmbedValidationInfo[] = {
    { &internal::SurfaceEmbed_SetFrameSinkId_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::SurfaceEmbed_UpdateLocalSurfaceIdFromChild_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::SurfaceEmbed_ChildProcessGone_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::SurfaceEmbed_RequestFocusOnEmbedElement_Params_Data::Validate,
     &internal::SurfaceEmbed_RequestFocusOnEmbedElement_ResponseParams_Data::Validate},
    { &internal::SurfaceEmbed_AdvanceFocusFromEmbedElement_Params_Data::Validate,
     nullptr /* no response */},
};

bool SurfaceEmbedRequestValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateRequestGenericPacked(
    message,
    ::surface_embed::mojom::SurfaceEmbed::Name_,
    kSurfaceEmbedValidationInfo);
}

bool SurfaceEmbedResponseValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateResponseGenericPacked(
    message,
    ::surface_embed::mojom::SurfaceEmbed::Name_,
    kSurfaceEmbedValidationInfo);
}
// The declaration includes the definition on other builds.

SurfaceEmbedHost::IPCStableHashFunction SurfaceEmbedHost::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
  switch (static_cast<messages::SurfaceEmbedHost>(message.name())) {
    case messages::SurfaceEmbedHost::kSetSurfaceEmbed: {
      return &SurfaceEmbedHost::SetSurfaceEmbed_Sym::IPCStableHash;
    }
    case messages::SurfaceEmbedHost::kAttachConnector: {
      return &SurfaceEmbedHost::AttachConnector_Sym::IPCStableHash;
    }
    case messages::SurfaceEmbedHost::kSynchronizeVisualProperties: {
      return &SurfaceEmbedHost::SynchronizeVisualProperties_Sym::IPCStableHash;
    }
    case messages::SurfaceEmbedHost::kOnEmbedElementFocused: {
      return &SurfaceEmbedHost::OnEmbedElementFocused_Sym::IPCStableHash;
    }
    case messages::SurfaceEmbedHost::kOnEmbedElementThrottlingStatusChanged: {
      return &SurfaceEmbedHost::OnEmbedElementThrottlingStatusChanged_Sym::IPCStableHash;
    }
    case messages::SurfaceEmbedHost::kSetParentAccessibilityInfo: {
      return &SurfaceEmbedHost::SetParentAccessibilityInfo_Sym::IPCStableHash;
    }
  }
#endif  // !BUILDFLAG(IS_FUCHSIA)
  return nullptr;
}


const char* SurfaceEmbedHost::MessageToMethodName_(mojo::Message& message) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  bool is_response = message.has_flag(mojo::Message::kFlagIsResponse);
  if (!is_response) {
    switch (static_cast<messages::SurfaceEmbedHost>(message.name())) {
      case messages::SurfaceEmbedHost::kSetSurfaceEmbed:
            return "Receive surface_embed::mojom::SurfaceEmbedHost::SetSurfaceEmbed";
      case messages::SurfaceEmbedHost::kAttachConnector:
            return "Receive surface_embed::mojom::SurfaceEmbedHost::AttachConnector";
      case messages::SurfaceEmbedHost::kSynchronizeVisualProperties:
            return "Receive surface_embed::mojom::SurfaceEmbedHost::SynchronizeVisualProperties";
      case messages::SurfaceEmbedHost::kOnEmbedElementFocused:
            return "Receive surface_embed::mojom::SurfaceEmbedHost::OnEmbedElementFocused";
      case messages::SurfaceEmbedHost::kOnEmbedElementThrottlingStatusChanged:
            return "Receive surface_embed::mojom::SurfaceEmbedHost::OnEmbedElementThrottlingStatusChanged";
      case messages::SurfaceEmbedHost::kSetParentAccessibilityInfo:
            return "Receive surface_embed::mojom::SurfaceEmbedHost::SetParentAccessibilityInfo";
    }
  } else {
    switch (static_cast<messages::SurfaceEmbedHost>(message.name())) {
      case messages::SurfaceEmbedHost::kSetSurfaceEmbed:
            return "Receive reply surface_embed::mojom::SurfaceEmbedHost::SetSurfaceEmbed";
      case messages::SurfaceEmbedHost::kAttachConnector:
            return "Receive reply surface_embed::mojom::SurfaceEmbedHost::AttachConnector";
      case messages::SurfaceEmbedHost::kSynchronizeVisualProperties:
            return "Receive reply surface_embed::mojom::SurfaceEmbedHost::SynchronizeVisualProperties";
      case messages::SurfaceEmbedHost::kOnEmbedElementFocused:
            return "Receive reply surface_embed::mojom::SurfaceEmbedHost::OnEmbedElementFocused";
      case messages::SurfaceEmbedHost::kOnEmbedElementThrottlingStatusChanged:
            return "Receive reply surface_embed::mojom::SurfaceEmbedHost::OnEmbedElementThrottlingStatusChanged";
      case messages::SurfaceEmbedHost::kSetParentAccessibilityInfo:
            return "Receive reply surface_embed::mojom::SurfaceEmbedHost::SetParentAccessibilityInfo";
    }
  }
  return "Receive unknown mojo message";
#else
  bool is_response = message.has_flag(mojo::Message::kFlagIsResponse);
  if (is_response) {
    return "Receive mojo reply";
  } else {
    return "Receive mojo message";
  }
#endif // BUILDFLAG(MOJO_TRACE_ENABLED)
}

#if !BUILDFLAG(IS_FUCHSIA)
uint32_t SurfaceEmbedHost::SetSurfaceEmbed_Sym::IPCStableHash() {
  // This method's address is used for identifying the mojo method name after
  // symbolization. So each IPCStableHash should have a unique address.
  // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
  // __LINE__ value, which is not unique across different mojo modules.
  // The code below is very similar to NO_CODE_FOLDING, but it uses a unique
  // hash instead of __LINE__.
  static constexpr uint32_t kHash = 0x56f13bd8;  // IPCStableHash for surface_embed::mojom::SurfaceEmbedHost::SetSurfaceEmbed
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t SurfaceEmbedHost::AttachConnector_Sym::IPCStableHash() {
  // This method's address is used for identifying the mojo method name after
  // symbolization. So each IPCStableHash should have a unique address.
  // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
  // __LINE__ value, which is not unique across different mojo modules.
  // The code below is very similar to NO_CODE_FOLDING, but it uses a unique
  // hash instead of __LINE__.
  static constexpr uint32_t kHash = 0xf28aee78;  // IPCStableHash for surface_embed::mojom::SurfaceEmbedHost::AttachConnector
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t SurfaceEmbedHost::SynchronizeVisualProperties_Sym::IPCStableHash() {
  // This method's address is used for identifying the mojo method name after
  // symbolization. So each IPCStableHash should have a unique address.
  // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
  // __LINE__ value, which is not unique across different mojo modules.
  // The code below is very similar to NO_CODE_FOLDING, but it uses a unique
  // hash instead of __LINE__.
  static constexpr uint32_t kHash = 0xff9da670;  // IPCStableHash for surface_embed::mojom::SurfaceEmbedHost::SynchronizeVisualProperties
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t SurfaceEmbedHost::OnEmbedElementFocused_Sym::IPCStableHash() {
  // This method's address is used for identifying the mojo method name after
  // symbolization. So each IPCStableHash should have a unique address.
  // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
  // __LINE__ value, which is not unique across different mojo modules.
  // The code below is very similar to NO_CODE_FOLDING, but it uses a unique
  // hash instead of __LINE__.
  static constexpr uint32_t kHash = 0x1feceea8;  // IPCStableHash for surface_embed::mojom::SurfaceEmbedHost::OnEmbedElementFocused
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t SurfaceEmbedHost::OnEmbedElementThrottlingStatusChanged_Sym::IPCStableHash() {
  // This method's address is used for identifying the mojo method name after
  // symbolization. So each IPCStableHash should have a unique address.
  // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
  // __LINE__ value, which is not unique across different mojo modules.
  // The code below is very similar to NO_CODE_FOLDING, but it uses a unique
  // hash instead of __LINE__.
  static constexpr uint32_t kHash = 0x1c0c4a7c;  // IPCStableHash for surface_embed::mojom::SurfaceEmbedHost::OnEmbedElementThrottlingStatusChanged
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t SurfaceEmbedHost::SetParentAccessibilityInfo_Sym::IPCStableHash() {
  // This method's address is used for identifying the mojo method name after
  // symbolization. So each IPCStableHash should have a unique address.
  // We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
  // __LINE__ value, which is not unique across different mojo modules.
  // The code below is very similar to NO_CODE_FOLDING, but it uses a unique
  // hash instead of __LINE__.
  static constexpr uint32_t kHash = 0x69aecb59;  // IPCStableHash for surface_embed::mojom::SurfaceEmbedHost::SetParentAccessibilityInfo
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)

SurfaceEmbedHostProxy::SurfaceEmbedHostProxy(mojo::MessageReceiverWithResponder* receiver)
    : receiver_(receiver) {
}

void SurfaceEmbedHostProxy::SetSurfaceEmbed(
    ::mojo::PendingAssociatedRemote<SurfaceEmbed> in_surface_embed) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send surface_embed::mojom::SurfaceEmbedHost::SetSurfaceEmbed", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("surface_embed"), in_surface_embed,
                        "<value of type ::mojo::PendingAssociatedRemote<SurfaceEmbed>>");
   });
#endif

  const bool kExpectsResponse = false;
  const bool kIsSync = false;
  const bool kAllowInterrupt = true;
  const bool is_urgent = false;

  const uint32_t kFlags =
      ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
      ((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
      ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
      ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);

  const size_t estimated_payload_size =
    0;
  mojo::Message message(
      std::to_underlying(messages::SurfaceEmbedHost::kSetSurfaceEmbed), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::surface_embed::mojom::internal::SurfaceEmbedHost_SetSurfaceEmbed_Params_Data> params(
          message);
  params.Allocate();

  
  mojo::internal::Serialize<::surface_embed::mojom::SurfaceEmbedAssociatedPtrInfoDataView>(
    in_surface_embed,
    &params->surface_embed,
    &params.message());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(!mojo::internal::IsHandleOrInterfaceValid(params->surface_embed)),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_INTERFACE_ID,
    "invalid surface_embed in SurfaceEmbedHost.SetSurfaceEmbed request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(SurfaceEmbedHost::Name_);
  message.set_method_name("SetSurfaceEmbed");
#endif
  // This return value may be ignored as false implies the Connector has
  // encountered an error, which will be visible through other means.
  ::mojo::internal::SendMojoMessage(*receiver_, message);
}

void SurfaceEmbedHostProxy::AttachConnector(
    const ::base::UnguessableToken& in_content_id) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send surface_embed::mojom::SurfaceEmbedHost::AttachConnector", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("content_id"), in_content_id,
                        "<value of type const ::base::UnguessableToken&>");
   });
#endif

  const bool kExpectsResponse = false;
  const bool kIsSync = false;
  const bool kAllowInterrupt = true;
  const bool is_urgent = false;

  const uint32_t kFlags =
      ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
      ((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
      ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
      ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);

  const size_t estimated_payload_size =
    0;
  mojo::Message message(
      std::to_underlying(messages::SurfaceEmbedHost::kAttachConnector), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::surface_embed::mojom::internal::SurfaceEmbedHost_AttachConnector_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->content_id)::BaseType> content_id_fragment(
          params.message());
  
  mojo::internal::Serialize<::mojo_base::mojom::UnguessableTokenDataView>(
    in_content_id,
    content_id_fragment);

  params->content_id.Set(
      content_id_fragment.is_null() ? nullptr : content_id_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->content_id.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null content_id in SurfaceEmbedHost.AttachConnector request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(SurfaceEmbedHost::Name_);
  message.set_method_name("AttachConnector");
#endif
  // This return value may be ignored as false implies the Connector has
  // encountered an error, which will be visible through other means.
  ::mojo::internal::SendMojoMessage(*receiver_, message);
}

void SurfaceEmbedHostProxy::SynchronizeVisualProperties(
    const ::blink::FrameVisualProperties& in_visual_properties, bool in_is_visible) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send surface_embed::mojom::SurfaceEmbedHost::SynchronizeVisualProperties", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("visual_properties"), in_visual_properties,
                        "<value of type const ::blink::FrameVisualProperties&>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("is_visible"), in_is_visible,
                        "<value of type bool>");
   });
#endif

  const bool kExpectsResponse = false;
  const bool kIsSync = false;
  const bool kAllowInterrupt = true;
  const bool is_urgent = false;

  const uint32_t kFlags =
      ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
      ((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
      ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
      ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);

  const size_t estimated_payload_size =
    0;
  mojo::Message message(
      std::to_underlying(messages::SurfaceEmbedHost::kSynchronizeVisualProperties), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::surface_embed::mojom::internal::SurfaceEmbedHost_SynchronizeVisualProperties_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->visual_properties)::BaseType> visual_properties_fragment(
          params.message());
  
  mojo::internal::Serialize<::blink::mojom::FrameVisualPropertiesDataView>(
    in_visual_properties,
    visual_properties_fragment);

  params->visual_properties.Set(
      visual_properties_fragment.is_null() ? nullptr : visual_properties_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->visual_properties.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null visual_properties in SurfaceEmbedHost.SynchronizeVisualProperties request");

  params->is_visible = in_is_visible;

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(SurfaceEmbedHost::Name_);
  message.set_method_name("SynchronizeVisualProperties");
#endif
  // This return value may be ignored as false implies the Connector has
  // encountered an error, which will be visible through other means.
  ::mojo::internal::SendMojoMessage(*receiver_, message);
}

void SurfaceEmbedHostProxy::OnEmbedElementFocused(
    bool in_focused, ::blink::mojom::FocusType in_focus_type) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send surface_embed::mojom::SurfaceEmbedHost::OnEmbedElementFocused", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("focused"), in_focused,
                        "<value of type bool>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("focus_type"), in_focus_type,
                        "<value of type ::blink::mojom::FocusType>");
   });
#endif

  const bool kExpectsResponse = false;
  const bool kIsSync = false;
  const bool kAllowInterrupt = true;
  const bool is_urgent = false;

  const uint32_t kFlags =
      ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
      ((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
      ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
      ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);

  const size_t estimated_payload_size =
    0;
  mojo::Message message(
      std::to_underlying(messages::SurfaceEmbedHost::kOnEmbedElementFocused), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::surface_embed::mojom::internal::SurfaceEmbedHost_OnEmbedElementFocused_Params_Data> params(
          message);
  params.Allocate();

  params->focused = in_focused;

  
  mojo::internal::Serialize<::blink::mojom::FocusType>(
    in_focus_type,
    &params->focus_type);

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(SurfaceEmbedHost::Name_);
  message.set_method_name("OnEmbedElementFocused");
#endif
  // This return value may be ignored as false implies the Connector has
  // encountered an error, which will be visible through other means.
  ::mojo::internal::SendMojoMessage(*receiver_, message);
}

void SurfaceEmbedHostProxy::OnEmbedElementThrottlingStatusChanged(
    RenderThrottlingStatusPtr in_status) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send surface_embed::mojom::SurfaceEmbedHost::OnEmbedElementThrottlingStatusChanged", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("status"), in_status,
                        "<value of type RenderThrottlingStatusPtr>");
   });
#endif

  const bool kExpectsResponse = false;
  const bool kIsSync = false;
  const bool kAllowInterrupt = true;
  const bool is_urgent = false;

  const uint32_t kFlags =
      ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
      ((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
      ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
      ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);

  const size_t estimated_payload_size =
    0;
  mojo::Message message(
      std::to_underlying(messages::SurfaceEmbedHost::kOnEmbedElementThrottlingStatusChanged), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::surface_embed::mojom::internal::SurfaceEmbedHost_OnEmbedElementThrottlingStatusChanged_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->status)::BaseType> status_fragment(
          params.message());
  
  mojo::internal::Serialize<::surface_embed::mojom::RenderThrottlingStatusDataView>(
    in_status,
    status_fragment);

  params->status.Set(
      status_fragment.is_null() ? nullptr : status_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->status.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null status in SurfaceEmbedHost.OnEmbedElementThrottlingStatusChanged request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(SurfaceEmbedHost::Name_);
  message.set_method_name("OnEmbedElementThrottlingStatusChanged");
#endif
  // This return value may be ignored as false implies the Connector has
  // encountered an error, which will be visible through other means.
  ::mojo::internal::SendMojoMessage(*receiver_, message);
}

void SurfaceEmbedHostProxy::SetParentAccessibilityInfo(
    int32_t in_ax_node_id) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send surface_embed::mojom::SurfaceEmbedHost::SetParentAccessibilityInfo", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("ax_node_id"), in_ax_node_id,
                        "<value of type int32_t>");
   });
#endif

  const bool kExpectsResponse = false;
  const bool kIsSync = false;
  const bool kAllowInterrupt = true;
  const bool is_urgent = false;

  const uint32_t kFlags =
      ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
      ((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
      ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
      ((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);

  const size_t estimated_payload_size =
    0;
  mojo::Message message(
      std::to_underlying(messages::SurfaceEmbedHost::kSetParentAccessibilityInfo), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::surface_embed::mojom::internal::SurfaceEmbedHost_SetParentAccessibilityInfo_Params_Data> params(
          message);
  params.Allocate();

  params->ax_node_id = in_ax_node_id;

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(SurfaceEmbedHost::Name_);
  message.set_method_name("SetParentAccessibilityInfo");
#endif
  // This return value may be ignored as false implies the Connector has
  // encountered an error, which will be visible through other means.
  ::mojo::internal::SendMojoMessage(*receiver_, message);
}

// static
bool SurfaceEmbedHostStubDispatch::Accept(
    SurfaceEmbedHost* impl,
    mojo::Message* message) {
  switch (static_cast<messages::SurfaceEmbedHost>(message->header()->name)) {
    case messages::SurfaceEmbedHost::kSetSurfaceEmbed: {
      DCHECK(message->is_serialized());
      internal::SurfaceEmbedHost_SetSurfaceEmbed_Params_Data* params =
          reinterpret_cast<internal::SurfaceEmbedHost_SetSurfaceEmbed_Params_Data*>(
              message->mutable_payload());
      

      // Validation for SurfaceEmbedHost.0
      bool success = true;
      ::mojo::PendingAssociatedRemote<SurfaceEmbed> p_surface_embed{};
      SurfaceEmbedHost_SetSurfaceEmbed_ParamsDataView input_data_view(params, message);
      
      if (success) {
        p_surface_embed =
            input_data_view.TakeSurfaceEmbed<decltype(p_surface_embed)>();
      }
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            SurfaceEmbedHost::Name_, 0, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->SetSurfaceEmbed(        
        std::move(p_surface_embed));
      return true;
    }
    case messages::SurfaceEmbedHost::kAttachConnector: {
      DCHECK(message->is_serialized());
      internal::SurfaceEmbedHost_AttachConnector_Params_Data* params =
          reinterpret_cast<internal::SurfaceEmbedHost_AttachConnector_Params_Data*>(
              message->mutable_payload());
      

      // Validation for SurfaceEmbedHost.1
      bool success = true;
      ::base::UnguessableToken p_content_id{};
      SurfaceEmbedHost_AttachConnector_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadContentId(&p_content_id))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            SurfaceEmbedHost::Name_, 1, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->AttachConnector(        
        std::move(p_content_id));
      return true;
    }
    case messages::SurfaceEmbedHost::kSynchronizeVisualProperties: {
      DCHECK(message->is_serialized());
      internal::SurfaceEmbedHost_SynchronizeVisualProperties_Params_Data* params =
          reinterpret_cast<internal::SurfaceEmbedHost_SynchronizeVisualProperties_Params_Data*>(
              message->mutable_payload());
      

      // Validation for SurfaceEmbedHost.2
      bool success = true;
      ::blink::FrameVisualProperties p_visual_properties{};
      bool p_is_visible{};
      SurfaceEmbedHost_SynchronizeVisualProperties_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadVisualProperties(&p_visual_properties))
        success = false;
      if (success)
        p_is_visible = input_data_view.is_visible();
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            SurfaceEmbedHost::Name_, 2, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->SynchronizeVisualProperties(        
        std::move(p_visual_properties), 
        std::move(p_is_visible));
      return true;
    }
    case messages::SurfaceEmbedHost::kOnEmbedElementFocused: {
      DCHECK(message->is_serialized());
      internal::SurfaceEmbedHost_OnEmbedElementFocused_Params_Data* params =
          reinterpret_cast<internal::SurfaceEmbedHost_OnEmbedElementFocused_Params_Data*>(
              message->mutable_payload());
      

      // Validation for SurfaceEmbedHost.3
      bool success = true;
      bool p_focused{};
      ::blink::mojom::FocusType p_focus_type{};
      SurfaceEmbedHost_OnEmbedElementFocused_ParamsDataView input_data_view(params, message);
      
      if (success)
        p_focused = input_data_view.focused();
      if (success && !input_data_view.ReadFocusType(&p_focus_type))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            SurfaceEmbedHost::Name_, 3, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->OnEmbedElementFocused(        
        std::move(p_focused), 
        std::move(p_focus_type));
      return true;
    }
    case messages::SurfaceEmbedHost::kOnEmbedElementThrottlingStatusChanged: {
      DCHECK(message->is_serialized());
      internal::SurfaceEmbedHost_OnEmbedElementThrottlingStatusChanged_Params_Data* params =
          reinterpret_cast<internal::SurfaceEmbedHost_OnEmbedElementThrottlingStatusChanged_Params_Data*>(
              message->mutable_payload());
      

      // Validation for SurfaceEmbedHost.4
      bool success = true;
      RenderThrottlingStatusPtr p_status{};
      SurfaceEmbedHost_OnEmbedElementThrottlingStatusChanged_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadStatus(&p_status))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            SurfaceEmbedHost::Name_, 4, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->OnEmbedElementThrottlingStatusChanged(        
        std::move(p_status));
      return true;
    }
    case messages::SurfaceEmbedHost::kSetParentAccessibilityInfo: {
      DCHECK(message->is_serialized());
      internal::SurfaceEmbedHost_SetParentAccessibilityInfo_Params_Data* params =
          reinterpret_cast<internal::SurfaceEmbedHost_SetParentAccessibilityInfo_Params_Data*>(
              message->mutable_payload());
      

      // Validation for SurfaceEmbedHost.5
      bool success = true;
      int32_t p_ax_node_id{};
      SurfaceEmbedHost_SetParentAccessibilityInfo_ParamsDataView input_data_view(params, message);
      
      if (success)
        p_ax_node_id = input_data_view.ax_node_id();
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            SurfaceEmbedHost::Name_, 5, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->SetParentAccessibilityInfo(        
        std::move(p_ax_node_id));
      return true;
    }
  }
  return false;
}

// static
bool SurfaceEmbedHostStubDispatch::AcceptWithResponder(
    SurfaceEmbedHost* impl,
    mojo::Message* message,
    std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
  [[maybe_unused]] const bool message_is_sync =
      message->has_flag(mojo::Message::kFlagIsSync);
  [[maybe_unused]] const uint64_t request_id = message->request_id();
  switch (static_cast<messages::SurfaceEmbedHost>(message->header()->name)) {
    case messages::SurfaceEmbedHost::kSetSurfaceEmbed: {
      break;
    }
    case messages::SurfaceEmbedHost::kAttachConnector: {
      break;
    }
    case messages::SurfaceEmbedHost::kSynchronizeVisualProperties: {
      break;
    }
    case messages::SurfaceEmbedHost::kOnEmbedElementFocused: {
      break;
    }
    case messages::SurfaceEmbedHost::kOnEmbedElementThrottlingStatusChanged: {
      break;
    }
    case messages::SurfaceEmbedHost::kSetParentAccessibilityInfo: {
      break;
    }
  }
  return false;
}
namespace {
}  // namespace
static const mojo::internal::GenericValidationInfo kSurfaceEmbedHostValidationInfo[] = {
    { &internal::SurfaceEmbedHost_SetSurfaceEmbed_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::SurfaceEmbedHost_AttachConnector_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::SurfaceEmbedHost_SynchronizeVisualProperties_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::SurfaceEmbedHost_OnEmbedElementFocused_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::SurfaceEmbedHost_OnEmbedElementThrottlingStatusChanged_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::SurfaceEmbedHost_SetParentAccessibilityInfo_Params_Data::Validate,
     nullptr /* no response */},
};

bool SurfaceEmbedHostRequestValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateRequestGenericPacked(
    message,
    ::surface_embed::mojom::SurfaceEmbedHost::Name_,
    kSurfaceEmbedHostValidationInfo);
}



}  // surface_embed::mojom


namespace mojo {


// static
bool StructTraits<::surface_embed::mojom::RenderThrottlingStatus::DataView, ::surface_embed::mojom::RenderThrottlingStatusPtr>::Read(
    ::surface_embed::mojom::RenderThrottlingStatus::DataView input,
    ::surface_embed::mojom::RenderThrottlingStatusPtr* output) {
  bool success = true;
  ::surface_embed::mojom::RenderThrottlingStatusPtr result(::surface_embed::mojom::RenderThrottlingStatus::New());
  
      if (success)
        result->is_throttled = input.is_throttled();
      if (success)
        result->subtree_throttled = input.subtree_throttled();
      if (success)
        result->display_locked = input.display_locked();
  *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 surface_embed::mojom {


void SurfaceEmbedInterceptorForTesting::SetFrameSinkId(const ::viz::FrameSinkId& frame_sink_id, bool allow_paint_holding) {
  GetForwardingInterface()->SetFrameSinkId(
    std::move(frame_sink_id)
    , 
    std::move(allow_paint_holding)
    );
}
void SurfaceEmbedInterceptorForTesting::UpdateLocalSurfaceIdFromChild(const ::viz::LocalSurfaceId& local_surface_id) {
  GetForwardingInterface()->UpdateLocalSurfaceIdFromChild(
    std::move(local_surface_id)
    );
}
void SurfaceEmbedInterceptorForTesting::ChildProcessGone() {
  GetForwardingInterface()->ChildProcessGone();
}
void SurfaceEmbedInterceptorForTesting::RequestFocusOnEmbedElement(RequestFocusOnEmbedElementCallback callback) {
  GetForwardingInterface()->RequestFocusOnEmbedElement(std::move(callback));
}
void SurfaceEmbedInterceptorForTesting::AdvanceFocusFromEmbedElement(bool reverse) {
  GetForwardingInterface()->AdvanceFocusFromEmbedElement(
    std::move(reverse)
    );
}
SurfaceEmbedAsyncWaiter::SurfaceEmbedAsyncWaiter(
    SurfaceEmbed* proxy) : proxy_(proxy) {}

SurfaceEmbedAsyncWaiter::~SurfaceEmbedAsyncWaiter() = default;


void SurfaceEmbedAsyncWaiter::RequestFocusOnEmbedElement(
    ) {
  base::RunLoop loop;
  proxy_->RequestFocusOnEmbedElement(
      base::BindOnce(
          [](base::RunLoop* loop) {
            loop->Quit();
          },
          &loop));
  loop.Run();
}






void SurfaceEmbedHostInterceptorForTesting::SetSurfaceEmbed(::mojo::PendingAssociatedRemote<SurfaceEmbed> surface_embed) {
  GetForwardingInterface()->SetSurfaceEmbed(
    std::move(surface_embed)
    );
}
void SurfaceEmbedHostInterceptorForTesting::AttachConnector(const ::base::UnguessableToken& content_id) {
  GetForwardingInterface()->AttachConnector(
    std::move(content_id)
    );
}
void SurfaceEmbedHostInterceptorForTesting::SynchronizeVisualProperties(const ::blink::FrameVisualProperties& visual_properties, bool is_visible) {
  GetForwardingInterface()->SynchronizeVisualProperties(
    std::move(visual_properties)
    , 
    std::move(is_visible)
    );
}
void SurfaceEmbedHostInterceptorForTesting::OnEmbedElementFocused(bool focused, ::blink::mojom::FocusType focus_type) {
  GetForwardingInterface()->OnEmbedElementFocused(
    std::move(focused)
    , 
    std::move(focus_type)
    );
}
void SurfaceEmbedHostInterceptorForTesting::OnEmbedElementThrottlingStatusChanged(RenderThrottlingStatusPtr status) {
  GetForwardingInterface()->OnEmbedElementThrottlingStatusChanged(
    std::move(status)
    );
}
void SurfaceEmbedHostInterceptorForTesting::SetParentAccessibilityInfo(int32_t ax_node_id) {
  GetForwardingInterface()->SetParentAccessibilityInfo(
    std::move(ax_node_id)
    );
}
SurfaceEmbedHostAsyncWaiter::SurfaceEmbedHostAsyncWaiter(
    SurfaceEmbedHost* proxy) : proxy_(proxy) {}

SurfaceEmbedHostAsyncWaiter::~SurfaceEmbedHostAsyncWaiter() = default;







}  // surface_embed::mojom


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