// chrome/common/readaloud/read_aloud.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 "chrome/common/readaloud/read_aloud.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 "chrome/common/readaloud/read_aloud.mojom-params-data.h"
#include "chrome/common/readaloud/read_aloud.mojom-shared-message-ids.h"

#include "chrome/common/readaloud/read_aloud.mojom-import-headers.h"
#include "chrome/common/readaloud/read_aloud.mojom-test-utils.h"


namespace read_aloud::mojom {
TextSegment::TextSegment()
    : segment_index(),
      text() {}

TextSegment::TextSegment(
    uint32_t segment_index_in,
    const ::std::u16string& text_in)
    : segment_index(std::move(segment_index_in)),
      text(std::move(text_in)) {}

TextSegment::~TextSegment() = default;

void TextSegment::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "segment_index"), this->segment_index,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "text"), this->text,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::std::u16string&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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

ReadAloudPlaybackController::IPCStableHashFunction ReadAloudPlaybackController::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
  switch (static_cast<messages::ReadAloudPlaybackController>(message.name())) {
    case messages::ReadAloudPlaybackController::kInitializeAudio: {
      return &ReadAloudPlaybackController::InitializeAudio_Sym::IPCStableHash;
    }
    case messages::ReadAloudPlaybackController::kSetTextContent: {
      return &ReadAloudPlaybackController::SetTextContent_Sym::IPCStableHash;
    }
    case messages::ReadAloudPlaybackController::kPlay: {
      return &ReadAloudPlaybackController::Play_Sym::IPCStableHash;
    }
    case messages::ReadAloudPlaybackController::kPause: {
      return &ReadAloudPlaybackController::Pause_Sym::IPCStableHash;
    }
    case messages::ReadAloudPlaybackController::kSeekToWord: {
      return &ReadAloudPlaybackController::SeekToWord_Sym::IPCStableHash;
    }
    case messages::ReadAloudPlaybackController::kSeekToTime: {
      return &ReadAloudPlaybackController::SeekToTime_Sym::IPCStableHash;
    }
    case messages::ReadAloudPlaybackController::kSetVoice: {
      return &ReadAloudPlaybackController::SetVoice_Sym::IPCStableHash;
    }
    case messages::ReadAloudPlaybackController::kSetPlaybackRate: {
      return &ReadAloudPlaybackController::SetPlaybackRate_Sym::IPCStableHash;
    }
    case messages::ReadAloudPlaybackController::kFlushBuffers: {
      return &ReadAloudPlaybackController::FlushBuffers_Sym::IPCStableHash;
    }
  }
#endif  // !BUILDFLAG(IS_FUCHSIA)
  return nullptr;
}


const char* ReadAloudPlaybackController::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::ReadAloudPlaybackController>(message.name())) {
      case messages::ReadAloudPlaybackController::kInitializeAudio:
            return "Receive read_aloud::mojom::ReadAloudPlaybackController::InitializeAudio";
      case messages::ReadAloudPlaybackController::kSetTextContent:
            return "Receive read_aloud::mojom::ReadAloudPlaybackController::SetTextContent";
      case messages::ReadAloudPlaybackController::kPlay:
            return "Receive read_aloud::mojom::ReadAloudPlaybackController::Play";
      case messages::ReadAloudPlaybackController::kPause:
            return "Receive read_aloud::mojom::ReadAloudPlaybackController::Pause";
      case messages::ReadAloudPlaybackController::kSeekToWord:
            return "Receive read_aloud::mojom::ReadAloudPlaybackController::SeekToWord";
      case messages::ReadAloudPlaybackController::kSeekToTime:
            return "Receive read_aloud::mojom::ReadAloudPlaybackController::SeekToTime";
      case messages::ReadAloudPlaybackController::kSetVoice:
            return "Receive read_aloud::mojom::ReadAloudPlaybackController::SetVoice";
      case messages::ReadAloudPlaybackController::kSetPlaybackRate:
            return "Receive read_aloud::mojom::ReadAloudPlaybackController::SetPlaybackRate";
      case messages::ReadAloudPlaybackController::kFlushBuffers:
            return "Receive read_aloud::mojom::ReadAloudPlaybackController::FlushBuffers";
    }
  } else {
    switch (static_cast<messages::ReadAloudPlaybackController>(message.name())) {
      case messages::ReadAloudPlaybackController::kInitializeAudio:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackController::InitializeAudio";
      case messages::ReadAloudPlaybackController::kSetTextContent:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackController::SetTextContent";
      case messages::ReadAloudPlaybackController::kPlay:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackController::Play";
      case messages::ReadAloudPlaybackController::kPause:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackController::Pause";
      case messages::ReadAloudPlaybackController::kSeekToWord:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackController::SeekToWord";
      case messages::ReadAloudPlaybackController::kSeekToTime:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackController::SeekToTime";
      case messages::ReadAloudPlaybackController::kSetVoice:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackController::SetVoice";
      case messages::ReadAloudPlaybackController::kSetPlaybackRate:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackController::SetPlaybackRate";
      case messages::ReadAloudPlaybackController::kFlushBuffers:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackController::FlushBuffers";
    }
  }
  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 ReadAloudPlaybackController::InitializeAudio_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 = 0x85cf74b8;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackController::InitializeAudio
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t ReadAloudPlaybackController::SetTextContent_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 = 0xd2d95ff0;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackController::SetTextContent
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t ReadAloudPlaybackController::Play_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 = 0x5d61e15e;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackController::Play
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t ReadAloudPlaybackController::Pause_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 = 0xdeb29ad4;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackController::Pause
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t ReadAloudPlaybackController::SeekToWord_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 = 0xde5b2b97;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackController::SeekToWord
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t ReadAloudPlaybackController::SeekToTime_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 = 0x923ec69a;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackController::SeekToTime
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t ReadAloudPlaybackController::SetVoice_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 = 0xdf009c1a;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackController::SetVoice
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t ReadAloudPlaybackController::SetPlaybackRate_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 = 0x8e9e4ab2;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackController::SetPlaybackRate
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t ReadAloudPlaybackController::FlushBuffers_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 = 0x0f2068cb;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackController::FlushBuffers
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)

// static
bool ReadAloudPlaybackController::RuntimeFeature_IsEnabled_(bool expected) {
  bool enabled = base::FeatureList::IsEnabled(::mojo_base::mojom::kMojomWorkInProgress);
#if DCHECK_IS_ON()
  if (expected) {
    DCHECK(enabled) << "RuntimeFeature ::mojo_base::mojom::kMojomWorkInProgress for ReadAloudPlaybackController is not enabled";
  }
#endif
  return enabled;
}

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

void ReadAloudPlaybackControllerProxy::InitializeAudio(
    ::mojo::PendingRemote<::media::mojom::AudioOutputStream> in_stream, ::media::mojom::ReadWriteAudioDataPipePtr in_data_pipe, const ::media::AudioParameters& in_params) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send read_aloud::mojom::ReadAloudPlaybackController::InitializeAudio", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("stream"), in_stream,
                        "<value of type ::mojo::PendingRemote<::media::mojom::AudioOutputStream>>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("data_pipe"), in_data_pipe,
                        "<value of type ::media::mojom::ReadWriteAudioDataPipePtr>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("params"), in_params,
                        "<value of type const ::media::AudioParameters&>");
   });
#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::ReadAloudPlaybackController::kInitializeAudio), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackController_InitializeAudio_Params_Data> params(
          message);
  params.Allocate();

  
  mojo::internal::Serialize<mojo::InterfacePtrDataView<::media::mojom::AudioOutputStreamInterfaceBase>>(
    in_stream,
    &params->stream,
    &params.message());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(!mojo::internal::IsHandleOrInterfaceValid(params->stream)),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
    "invalid stream in ReadAloudPlaybackController.InitializeAudio request");
  mojo::internal::MessageFragment<
      typename decltype(params->data_pipe)::BaseType> data_pipe_fragment(
          params.message());
  
  mojo::internal::Serialize<::media::mojom::ReadWriteAudioDataPipeDataView>(
    in_data_pipe,
    data_pipe_fragment);

  params->data_pipe.Set(
      data_pipe_fragment.is_null() ? nullptr : data_pipe_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->data_pipe.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null data_pipe in ReadAloudPlaybackController.InitializeAudio request");
  mojo::internal::MessageFragment<
      typename decltype(params->params)::BaseType> params_fragment(
          params.message());
  
  mojo::internal::Serialize<::media::mojom::AudioParametersDataView>(
    in_params,
    params_fragment);

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

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

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackController::Name_);
  message.set_method_name("InitializeAudio");
#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 ReadAloudPlaybackControllerProxy::SetTextContent(
    std::vector<TextSegmentPtr> in_segments) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send read_aloud::mojom::ReadAloudPlaybackController::SetTextContent", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("segments"), in_segments,
                        "<value of type std::vector<TextSegmentPtr>>");
   });
#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::ReadAloudPlaybackController::kSetTextContent), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackController_SetTextContent_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->segments)::BaseType>
      segments_fragment(params.message());
  constexpr const mojo::internal::ContainerValidateParams& segments_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  
  mojo::internal::Serialize<mojo::ArrayDataView<::read_aloud::mojom::TextSegmentDataView>>(
    in_segments,
    segments_fragment,
    &segments_validate_params);

  params->segments.Set(
      segments_fragment.is_null() ? nullptr : segments_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->segments.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null segments in ReadAloudPlaybackController.SetTextContent request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackController::Name_);
  message.set_method_name("SetTextContent");
#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 ReadAloudPlaybackControllerProxy::Play(
    ) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT0("mojom", "Send read_aloud::mojom::ReadAloudPlaybackController::Play");
#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::ReadAloudPlaybackController::kPlay), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackController_Play_Params_Data> params(
          message);
  params.Allocate();

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackController::Name_);
  message.set_method_name("Play");
#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 ReadAloudPlaybackControllerProxy::Pause(
    ) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT0("mojom", "Send read_aloud::mojom::ReadAloudPlaybackController::Pause");
#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::ReadAloudPlaybackController::kPause), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackController_Pause_Params_Data> params(
          message);
  params.Allocate();

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackController::Name_);
  message.set_method_name("Pause");
#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 ReadAloudPlaybackControllerProxy::SeekToWord(
    uint32_t in_segment_index, uint32_t in_character_offset) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send read_aloud::mojom::ReadAloudPlaybackController::SeekToWord", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("segment_index"), in_segment_index,
                        "<value of type uint32_t>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("character_offset"), in_character_offset,
                        "<value of type uint32_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::ReadAloudPlaybackController::kSeekToWord), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackController_SeekToWord_Params_Data> params(
          message);
  params.Allocate();

  params->segment_index = in_segment_index;

  params->character_offset = in_character_offset;

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackController::Name_);
  message.set_method_name("SeekToWord");
#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 ReadAloudPlaybackControllerProxy::SeekToTime(
    ::base::TimeDelta in_position) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send read_aloud::mojom::ReadAloudPlaybackController::SeekToTime", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("position"), in_position,
                        "<value of type ::base::TimeDelta>");
   });
#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::ReadAloudPlaybackController::kSeekToTime), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackController_SeekToTime_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->position)::BaseType> position_fragment(
          params.message());
  
  mojo::internal::Serialize<::mojo_base::mojom::TimeDeltaDataView>(
    in_position,
    position_fragment);

  params->position.Set(
      position_fragment.is_null() ? nullptr : position_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->position.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null position in ReadAloudPlaybackController.SeekToTime request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackController::Name_);
  message.set_method_name("SeekToTime");
#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 ReadAloudPlaybackControllerProxy::SetVoice(
    const std::string& in_voice_id) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send read_aloud::mojom::ReadAloudPlaybackController::SetVoice", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("voice_id"), in_voice_id,
                        "<value of type const std::string&>");
   });
#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::ReadAloudPlaybackController::kSetVoice), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackController_SetVoice_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->voice_id)::BaseType> voice_id_fragment(
          params.message());
  
  mojo::internal::Serialize<mojo::StringDataView>(
    in_voice_id,
    voice_id_fragment);

  params->voice_id.Set(
      voice_id_fragment.is_null() ? nullptr : voice_id_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->voice_id.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null voice_id in ReadAloudPlaybackController.SetVoice request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackController::Name_);
  message.set_method_name("SetVoice");
#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 ReadAloudPlaybackControllerProxy::SetPlaybackRate(
    float in_rate) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send read_aloud::mojom::ReadAloudPlaybackController::SetPlaybackRate", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("rate"), in_rate,
                        "<value of type float>");
   });
#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::ReadAloudPlaybackController::kSetPlaybackRate), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackController_SetPlaybackRate_Params_Data> params(
          message);
  params.Allocate();

  params->rate = in_rate;

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackController::Name_);
  message.set_method_name("SetPlaybackRate");
#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 ReadAloudPlaybackControllerProxy::FlushBuffers(
    ) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT0("mojom", "Send read_aloud::mojom::ReadAloudPlaybackController::FlushBuffers");
#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::ReadAloudPlaybackController::kFlushBuffers), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackController_FlushBuffers_Params_Data> params(
          message);
  params.Allocate();

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackController::Name_);
  message.set_method_name("FlushBuffers");
#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 ReadAloudPlaybackControllerStubDispatch::Accept(
    ReadAloudPlaybackController* impl,
    mojo::Message* message) {
  switch (static_cast<messages::ReadAloudPlaybackController>(message->header()->name)) {
    case messages::ReadAloudPlaybackController::kInitializeAudio: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackController_InitializeAudio_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackController_InitializeAudio_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackController.0
      bool success = true;
      ::mojo::PendingRemote<::media::mojom::AudioOutputStream> p_stream{};
      ::media::mojom::ReadWriteAudioDataPipePtr p_data_pipe{};
      ::media::AudioParameters p_params{};
      ReadAloudPlaybackController_InitializeAudio_ParamsDataView input_data_view(params, message);
      
      if (success) {
        p_stream =
            input_data_view.TakeStream<decltype(p_stream)>();
      }
      if (success && !input_data_view.ReadDataPipe(&p_data_pipe))
        success = false;
      if (success && !input_data_view.ReadParams(&p_params))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackController::Name_, 0, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->InitializeAudio(        
        std::move(p_stream), 
        std::move(p_data_pipe), 
        std::move(p_params));
      return true;
    }
    case messages::ReadAloudPlaybackController::kSetTextContent: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackController_SetTextContent_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackController_SetTextContent_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackController.1
      bool success = true;
      std::vector<TextSegmentPtr> p_segments{};
      ReadAloudPlaybackController_SetTextContent_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadSegments(&p_segments))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackController::Name_, 1, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->SetTextContent(        
        std::move(p_segments));
      return true;
    }
    case messages::ReadAloudPlaybackController::kPlay: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackController_Play_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackController_Play_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackController.2
      bool success = true;
      ReadAloudPlaybackController_Play_ParamsDataView input_data_view(params, message);
      
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackController::Name_, 2, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->Play(        );
      return true;
    }
    case messages::ReadAloudPlaybackController::kPause: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackController_Pause_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackController_Pause_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackController.3
      bool success = true;
      ReadAloudPlaybackController_Pause_ParamsDataView input_data_view(params, message);
      
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackController::Name_, 3, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->Pause(        );
      return true;
    }
    case messages::ReadAloudPlaybackController::kSeekToWord: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackController_SeekToWord_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackController_SeekToWord_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackController.4
      bool success = true;
      uint32_t p_segment_index{};
      uint32_t p_character_offset{};
      ReadAloudPlaybackController_SeekToWord_ParamsDataView input_data_view(params, message);
      
      if (success)
        p_segment_index = input_data_view.segment_index();
      if (success)
        p_character_offset = input_data_view.character_offset();
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackController::Name_, 4, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->SeekToWord(        
        std::move(p_segment_index), 
        std::move(p_character_offset));
      return true;
    }
    case messages::ReadAloudPlaybackController::kSeekToTime: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackController_SeekToTime_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackController_SeekToTime_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackController.5
      bool success = true;
      ::base::TimeDelta p_position{};
      ReadAloudPlaybackController_SeekToTime_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadPosition(&p_position))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackController::Name_, 5, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->SeekToTime(        
        std::move(p_position));
      return true;
    }
    case messages::ReadAloudPlaybackController::kSetVoice: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackController_SetVoice_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackController_SetVoice_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackController.6
      bool success = true;
      std::string p_voice_id{};
      ReadAloudPlaybackController_SetVoice_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadVoiceId(&p_voice_id))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackController::Name_, 6, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->SetVoice(        
        std::move(p_voice_id));
      return true;
    }
    case messages::ReadAloudPlaybackController::kSetPlaybackRate: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackController_SetPlaybackRate_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackController_SetPlaybackRate_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackController.7
      bool success = true;
      float p_rate{};
      ReadAloudPlaybackController_SetPlaybackRate_ParamsDataView input_data_view(params, message);
      
      if (success)
        p_rate = input_data_view.rate();
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackController::Name_, 7, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->SetPlaybackRate(        
        std::move(p_rate));
      return true;
    }
    case messages::ReadAloudPlaybackController::kFlushBuffers: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackController_FlushBuffers_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackController_FlushBuffers_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackController.8
      bool success = true;
      ReadAloudPlaybackController_FlushBuffers_ParamsDataView input_data_view(params, message);
      
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackController::Name_, 8, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->FlushBuffers(        );
      return true;
    }
  }
  return false;
}

// static
bool ReadAloudPlaybackControllerStubDispatch::AcceptWithResponder(
    ReadAloudPlaybackController* 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::ReadAloudPlaybackController>(message->header()->name)) {
    case messages::ReadAloudPlaybackController::kInitializeAudio: {
      break;
    }
    case messages::ReadAloudPlaybackController::kSetTextContent: {
      break;
    }
    case messages::ReadAloudPlaybackController::kPlay: {
      break;
    }
    case messages::ReadAloudPlaybackController::kPause: {
      break;
    }
    case messages::ReadAloudPlaybackController::kSeekToWord: {
      break;
    }
    case messages::ReadAloudPlaybackController::kSeekToTime: {
      break;
    }
    case messages::ReadAloudPlaybackController::kSetVoice: {
      break;
    }
    case messages::ReadAloudPlaybackController::kSetPlaybackRate: {
      break;
    }
    case messages::ReadAloudPlaybackController::kFlushBuffers: {
      break;
    }
  }
  return false;
}
namespace {
}  // namespace
static const mojo::internal::GenericValidationInfo kReadAloudPlaybackControllerValidationInfo[] = {
    { &internal::ReadAloudPlaybackController_InitializeAudio_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::ReadAloudPlaybackController_SetTextContent_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::ReadAloudPlaybackController_Play_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::ReadAloudPlaybackController_Pause_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::ReadAloudPlaybackController_SeekToWord_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::ReadAloudPlaybackController_SeekToTime_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::ReadAloudPlaybackController_SetVoice_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::ReadAloudPlaybackController_SetPlaybackRate_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::ReadAloudPlaybackController_FlushBuffers_Params_Data::Validate,
     nullptr /* no response */},
};

bool ReadAloudPlaybackControllerRequestValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateRequestGenericPacked(
    message,
    ::read_aloud::mojom::ReadAloudPlaybackController::Name_,
    kReadAloudPlaybackControllerValidationInfo);
}

// The declaration includes the definition on other builds.

ReadAloudPlaybackControllerClient::IPCStableHashFunction ReadAloudPlaybackControllerClient::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
  switch (static_cast<messages::ReadAloudPlaybackControllerClient>(message.name())) {
    case messages::ReadAloudPlaybackControllerClient::kOnPlaybackStateChanged: {
      return &ReadAloudPlaybackControllerClient::OnPlaybackStateChanged_Sym::IPCStableHash;
    }
    case messages::ReadAloudPlaybackControllerClient::kOnPlaybackDurationChanged: {
      return &ReadAloudPlaybackControllerClient::OnPlaybackDurationChanged_Sym::IPCStableHash;
    }
    case messages::ReadAloudPlaybackControllerClient::kOnWordBoundaryReached: {
      return &ReadAloudPlaybackControllerClient::OnWordBoundaryReached_Sym::IPCStableHash;
    }
    case messages::ReadAloudPlaybackControllerClient::kRequestSpeechSynthesis: {
      return &ReadAloudPlaybackControllerClient::RequestSpeechSynthesis_Sym::IPCStableHash;
    }
  }
#endif  // !BUILDFLAG(IS_FUCHSIA)
  return nullptr;
}


const char* ReadAloudPlaybackControllerClient::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::ReadAloudPlaybackControllerClient>(message.name())) {
      case messages::ReadAloudPlaybackControllerClient::kOnPlaybackStateChanged:
            return "Receive read_aloud::mojom::ReadAloudPlaybackControllerClient::OnPlaybackStateChanged";
      case messages::ReadAloudPlaybackControllerClient::kOnPlaybackDurationChanged:
            return "Receive read_aloud::mojom::ReadAloudPlaybackControllerClient::OnPlaybackDurationChanged";
      case messages::ReadAloudPlaybackControllerClient::kOnWordBoundaryReached:
            return "Receive read_aloud::mojom::ReadAloudPlaybackControllerClient::OnWordBoundaryReached";
      case messages::ReadAloudPlaybackControllerClient::kRequestSpeechSynthesis:
            return "Receive read_aloud::mojom::ReadAloudPlaybackControllerClient::RequestSpeechSynthesis";
    }
  } else {
    switch (static_cast<messages::ReadAloudPlaybackControllerClient>(message.name())) {
      case messages::ReadAloudPlaybackControllerClient::kOnPlaybackStateChanged:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackControllerClient::OnPlaybackStateChanged";
      case messages::ReadAloudPlaybackControllerClient::kOnPlaybackDurationChanged:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackControllerClient::OnPlaybackDurationChanged";
      case messages::ReadAloudPlaybackControllerClient::kOnWordBoundaryReached:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackControllerClient::OnWordBoundaryReached";
      case messages::ReadAloudPlaybackControllerClient::kRequestSpeechSynthesis:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackControllerClient::RequestSpeechSynthesis";
    }
  }
  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 ReadAloudPlaybackControllerClient::OnPlaybackStateChanged_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 = 0x98a19e6e;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackControllerClient::OnPlaybackStateChanged
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t ReadAloudPlaybackControllerClient::OnPlaybackDurationChanged_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 = 0xd9bf582a;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackControllerClient::OnPlaybackDurationChanged
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t ReadAloudPlaybackControllerClient::OnWordBoundaryReached_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 = 0x72237e7f;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackControllerClient::OnWordBoundaryReached
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t ReadAloudPlaybackControllerClient::RequestSpeechSynthesis_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 = 0x3cad9867;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackControllerClient::RequestSpeechSynthesis
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)

// static
bool ReadAloudPlaybackControllerClient::RuntimeFeature_IsEnabled_(bool expected) {
  bool enabled = base::FeatureList::IsEnabled(::mojo_base::mojom::kMojomWorkInProgress);
#if DCHECK_IS_ON()
  if (expected) {
    DCHECK(enabled) << "RuntimeFeature ::mojo_base::mojom::kMojomWorkInProgress for ReadAloudPlaybackControllerClient is not enabled";
  }
#endif
  return enabled;
}

class ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ForwardToCallback
    : public mojo::MessageReceiver {
 public:
  ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ForwardToCallback(
      ReadAloudPlaybackControllerClient::RequestSpeechSynthesisCallback callback
      ) : callback_(std::move(callback)) {
  }

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

  bool Accept(mojo::Message* message) override;
 private:
  ReadAloudPlaybackControllerClient::RequestSpeechSynthesisCallback callback_;
};

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

void ReadAloudPlaybackControllerClientProxy::OnPlaybackStateChanged(
    PlaybackState in_state) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send read_aloud::mojom::ReadAloudPlaybackControllerClient::OnPlaybackStateChanged", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("state"), in_state,
                        "<value of type PlaybackState>");
   });
#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::ReadAloudPlaybackControllerClient::kOnPlaybackStateChanged), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackControllerClient_OnPlaybackStateChanged_Params_Data> params(
          message);
  params.Allocate();

  
  mojo::internal::Serialize<::read_aloud::mojom::PlaybackState>(
    in_state,
    &params->state);

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackControllerClient::Name_);
  message.set_method_name("OnPlaybackStateChanged");
#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 ReadAloudPlaybackControllerClientProxy::OnPlaybackDurationChanged(
    ::base::TimeDelta in_duration) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send read_aloud::mojom::ReadAloudPlaybackControllerClient::OnPlaybackDurationChanged", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("duration"), in_duration,
                        "<value of type ::base::TimeDelta>");
   });
#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::ReadAloudPlaybackControllerClient::kOnPlaybackDurationChanged), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackControllerClient_OnPlaybackDurationChanged_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->duration)::BaseType> duration_fragment(
          params.message());
  
  mojo::internal::Serialize<::mojo_base::mojom::TimeDeltaDataView>(
    in_duration,
    duration_fragment);

  params->duration.Set(
      duration_fragment.is_null() ? nullptr : duration_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->duration.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null duration in ReadAloudPlaybackControllerClient.OnPlaybackDurationChanged request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackControllerClient::Name_);
  message.set_method_name("OnPlaybackDurationChanged");
#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 ReadAloudPlaybackControllerClientProxy::OnWordBoundaryReached(
    uint32_t in_segment_index, uint32_t in_character_offset, ::base::TimeDelta in_audio_timestamp) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send read_aloud::mojom::ReadAloudPlaybackControllerClient::OnWordBoundaryReached", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("segment_index"), in_segment_index,
                        "<value of type uint32_t>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("character_offset"), in_character_offset,
                        "<value of type uint32_t>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("audio_timestamp"), in_audio_timestamp,
                        "<value of type ::base::TimeDelta>");
   });
#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::ReadAloudPlaybackControllerClient::kOnWordBoundaryReached), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackControllerClient_OnWordBoundaryReached_Params_Data> params(
          message);
  params.Allocate();

  params->segment_index = in_segment_index;

  params->character_offset = in_character_offset;
  mojo::internal::MessageFragment<
      typename decltype(params->audio_timestamp)::BaseType> audio_timestamp_fragment(
          params.message());
  
  mojo::internal::Serialize<::mojo_base::mojom::TimeDeltaDataView>(
    in_audio_timestamp,
    audio_timestamp_fragment);

  params->audio_timestamp.Set(
      audio_timestamp_fragment.is_null() ? nullptr : audio_timestamp_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->audio_timestamp.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null audio_timestamp in ReadAloudPlaybackControllerClient.OnWordBoundaryReached request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackControllerClient::Name_);
  message.set_method_name("OnWordBoundaryReached");
#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 ReadAloudPlaybackControllerClientProxy::RequestSpeechSynthesis(
    const ::std::u16string& in_text_chunk, uint64_t in_sequence_id, RequestSpeechSynthesisCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send read_aloud::mojom::ReadAloudPlaybackControllerClient::RequestSpeechSynthesis", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("text_chunk"), in_text_chunk,
                        "<value of type const ::std::u16string&>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("sequence_id"), in_sequence_id,
                        "<value of type uint64_t>");
   });
#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::ReadAloudPlaybackControllerClient::kRequestSpeechSynthesis), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->text_chunk)::BaseType> text_chunk_fragment(
          params.message());
  
  mojo::internal::Serialize<::mojo_base::mojom::String16DataView>(
    in_text_chunk,
    text_chunk_fragment);

  params->text_chunk.Set(
      text_chunk_fragment.is_null() ? nullptr : text_chunk_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->text_chunk.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null text_chunk in ReadAloudPlaybackControllerClient.RequestSpeechSynthesis request");

  params->sequence_id = in_sequence_id;

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackControllerClient::Name_);
  message.set_method_name("RequestSpeechSynthesis");
#endif
  std::unique_ptr<mojo::MessageReceiver> responder(
      new ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ForwardToCallback(
          std::move(callback)));
  ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
}
class ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
 public:
  static ReadAloudPlaybackControllerClient::RequestSpeechSynthesisCallback CreateCallback(
      ::mojo::Message& message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
    std::unique_ptr<ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ProxyToResponder> proxy(
        new ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ProxyToResponder(
            message, std::move(responder)));
    return base::BindOnce(&ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ProxyToResponder::Run,
                          std::move(proxy));
  }

  ~ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_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:
  ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_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)
        << "ReadAloudPlaybackControllerClient::RequestSpeechSynthesisCallback 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(
      ::mojo_base::BigBuffer in_response_bytes, bool in_success);
};

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

  // Validation for ReadAloudPlaybackControllerClient.3
  bool success = true;
  ::mojo_base::BigBuffer p_response_bytes{};
  bool p_success{};
  ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ResponseParamsDataView input_data_view(params, message);
  
  if (success && !input_data_view.ReadResponseBytes(&p_response_bytes))
    success = false;
  if (success)
    p_success = input_data_view.success();
  if (!success) {
    ReportValidationErrorForMessage(
        message,
        mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
        ReadAloudPlaybackControllerClient::Name_, 3, true);
    return false;
  }
  if (!callback_.is_null()) {
    std::move(callback_).Run(
std::move(p_response_bytes), 
std::move(p_success));
  }
  return true;
}

void ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ProxyToResponder::Run(
    ::mojo_base::BigBuffer in_response_bytes, bool in_success) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send reply read_aloud::mojom::ReadAloudPlaybackControllerClient::RequestSpeechSynthesis", "async_response_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("response_bytes"), in_response_bytes,
                        "<value of type ::mojo_base::BigBuffer>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("success"), in_success,
                        "<value of type bool>");
   });
#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::ReadAloudPlaybackControllerClient::kRequestSpeechSynthesis), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ResponseParams_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<decltype(params->response_bytes)>
      response_bytes_fragment(params.message());
  response_bytes_fragment.Claim(&params->response_bytes);
  
  mojo::internal::Serialize<::mojo_base::mojom::BigBufferDataView>(
    in_response_bytes,
    response_bytes_fragment,
    true);

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

  params->success = in_success;

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackControllerClient::Name_);
  message.set_method_name("RequestSpeechSynthesis");
#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 ReadAloudPlaybackControllerClientStubDispatch::Accept(
    ReadAloudPlaybackControllerClient* impl,
    mojo::Message* message) {
  switch (static_cast<messages::ReadAloudPlaybackControllerClient>(message->header()->name)) {
    case messages::ReadAloudPlaybackControllerClient::kOnPlaybackStateChanged: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackControllerClient_OnPlaybackStateChanged_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackControllerClient_OnPlaybackStateChanged_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackControllerClient.0
      bool success = true;
      PlaybackState p_state{};
      ReadAloudPlaybackControllerClient_OnPlaybackStateChanged_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadState(&p_state))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackControllerClient::Name_, 0, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->OnPlaybackStateChanged(        
        std::move(p_state));
      return true;
    }
    case messages::ReadAloudPlaybackControllerClient::kOnPlaybackDurationChanged: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackControllerClient_OnPlaybackDurationChanged_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackControllerClient_OnPlaybackDurationChanged_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackControllerClient.1
      bool success = true;
      ::base::TimeDelta p_duration{};
      ReadAloudPlaybackControllerClient_OnPlaybackDurationChanged_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadDuration(&p_duration))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackControllerClient::Name_, 1, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->OnPlaybackDurationChanged(        
        std::move(p_duration));
      return true;
    }
    case messages::ReadAloudPlaybackControllerClient::kOnWordBoundaryReached: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackControllerClient_OnWordBoundaryReached_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackControllerClient_OnWordBoundaryReached_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackControllerClient.2
      bool success = true;
      uint32_t p_segment_index{};
      uint32_t p_character_offset{};
      ::base::TimeDelta p_audio_timestamp{};
      ReadAloudPlaybackControllerClient_OnWordBoundaryReached_ParamsDataView input_data_view(params, message);
      
      if (success)
        p_segment_index = input_data_view.segment_index();
      if (success)
        p_character_offset = input_data_view.character_offset();
      if (success && !input_data_view.ReadAudioTimestamp(&p_audio_timestamp))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackControllerClient::Name_, 2, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->OnWordBoundaryReached(        
        std::move(p_segment_index), 
        std::move(p_character_offset), 
        std::move(p_audio_timestamp));
      return true;
    }
    case messages::ReadAloudPlaybackControllerClient::kRequestSpeechSynthesis: {
      break;
    }
  }
  return false;
}

// static
bool ReadAloudPlaybackControllerClientStubDispatch::AcceptWithResponder(
    ReadAloudPlaybackControllerClient* 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::ReadAloudPlaybackControllerClient>(message->header()->name)) {
    case messages::ReadAloudPlaybackControllerClient::kOnPlaybackStateChanged: {
      break;
    }
    case messages::ReadAloudPlaybackControllerClient::kOnPlaybackDurationChanged: {
      break;
    }
    case messages::ReadAloudPlaybackControllerClient::kOnWordBoundaryReached: {
      break;
    }
    case messages::ReadAloudPlaybackControllerClient::kRequestSpeechSynthesis: {
      internal::ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_Params_Data* params =
          reinterpret_cast<
              internal::ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_Params_Data*>(
                  message->mutable_payload());
      

      // Validation for ReadAloudPlaybackControllerClient.3
      bool success = true;
      ::std::u16string p_text_chunk{};
      uint64_t p_sequence_id{};
      ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadTextChunk(&p_text_chunk))
        success = false;
      if (success)
        p_sequence_id = input_data_view.sequence_id();
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackControllerClient::Name_, 3, false);
        return false;
      }
      auto callback =
          ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ProxyToResponder::CreateCallback(
              *message, std::move(responder));
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->RequestSpeechSynthesis(        
        std::move(p_text_chunk), 
        std::move(p_sequence_id), std::move(callback));
      return true;
    }
  }
  return false;
}
namespace {
}  // namespace
static const mojo::internal::GenericValidationInfo kReadAloudPlaybackControllerClientValidationInfo[] = {
    { &internal::ReadAloudPlaybackControllerClient_OnPlaybackStateChanged_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::ReadAloudPlaybackControllerClient_OnPlaybackDurationChanged_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::ReadAloudPlaybackControllerClient_OnWordBoundaryReached_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_Params_Data::Validate,
     &internal::ReadAloudPlaybackControllerClient_RequestSpeechSynthesis_ResponseParams_Data::Validate},
};

bool ReadAloudPlaybackControllerClientRequestValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateRequestGenericPacked(
    message,
    ::read_aloud::mojom::ReadAloudPlaybackControllerClient::Name_,
    kReadAloudPlaybackControllerClientValidationInfo);
}

bool ReadAloudPlaybackControllerClientResponseValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateResponseGenericPacked(
    message,
    ::read_aloud::mojom::ReadAloudPlaybackControllerClient::Name_,
    kReadAloudPlaybackControllerClientValidationInfo);
}
// The declaration includes the definition on other builds.

ReadAloudPlaybackControllerFactory::IPCStableHashFunction ReadAloudPlaybackControllerFactory::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
  switch (static_cast<messages::ReadAloudPlaybackControllerFactory>(message.name())) {
    case messages::ReadAloudPlaybackControllerFactory::kCreateController: {
      return &ReadAloudPlaybackControllerFactory::CreateController_Sym::IPCStableHash;
    }
  }
#endif  // !BUILDFLAG(IS_FUCHSIA)
  return nullptr;
}


const char* ReadAloudPlaybackControllerFactory::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::ReadAloudPlaybackControllerFactory>(message.name())) {
      case messages::ReadAloudPlaybackControllerFactory::kCreateController:
            return "Receive read_aloud::mojom::ReadAloudPlaybackControllerFactory::CreateController";
    }
  } else {
    switch (static_cast<messages::ReadAloudPlaybackControllerFactory>(message.name())) {
      case messages::ReadAloudPlaybackControllerFactory::kCreateController:
            return "Receive reply read_aloud::mojom::ReadAloudPlaybackControllerFactory::CreateController";
    }
  }
  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 ReadAloudPlaybackControllerFactory::CreateController_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 = 0x878bf42d;  // IPCStableHash for read_aloud::mojom::ReadAloudPlaybackControllerFactory::CreateController
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)

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

void ReadAloudPlaybackControllerFactoryProxy::CreateController(
    ::mojo::PendingReceiver<ReadAloudPlaybackController> in_controller, ::mojo::PendingRemote<ReadAloudPlaybackControllerClient> in_client) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send read_aloud::mojom::ReadAloudPlaybackControllerFactory::CreateController", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("controller"), in_controller,
                        "<value of type ::mojo::PendingReceiver<ReadAloudPlaybackController>>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("client"), in_client,
                        "<value of type ::mojo::PendingRemote<ReadAloudPlaybackControllerClient>>");
   });
#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::ReadAloudPlaybackControllerFactory::kCreateController), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::read_aloud::mojom::internal::ReadAloudPlaybackControllerFactory_CreateController_Params_Data> params(
          message);
  params.Allocate();

  
  mojo::internal::Serialize<mojo::InterfaceRequestDataView<::read_aloud::mojom::ReadAloudPlaybackControllerInterfaceBase>>(
    in_controller,
    &params->controller,
    &params.message());

  
  mojo::internal::Serialize<mojo::InterfacePtrDataView<::read_aloud::mojom::ReadAloudPlaybackControllerClientInterfaceBase>>(
    in_client,
    &params->client,
    &params.message());

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(ReadAloudPlaybackControllerFactory::Name_);
  message.set_method_name("CreateController");
#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 ReadAloudPlaybackControllerFactoryStubDispatch::Accept(
    ReadAloudPlaybackControllerFactory* impl,
    mojo::Message* message) {
  switch (static_cast<messages::ReadAloudPlaybackControllerFactory>(message->header()->name)) {
    case messages::ReadAloudPlaybackControllerFactory::kCreateController: {
      DCHECK(message->is_serialized());
      internal::ReadAloudPlaybackControllerFactory_CreateController_Params_Data* params =
          reinterpret_cast<internal::ReadAloudPlaybackControllerFactory_CreateController_Params_Data*>(
              message->mutable_payload());
      

      // Validation for ReadAloudPlaybackControllerFactory.0
      bool success = true;
      ::mojo::PendingReceiver<ReadAloudPlaybackController> p_controller{};
      ::mojo::PendingRemote<ReadAloudPlaybackControllerClient> p_client{};
      ReadAloudPlaybackControllerFactory_CreateController_ParamsDataView input_data_view(params, message);
      
      if (success) {
        p_controller =
            input_data_view.TakeController<decltype(p_controller)>();
      }
      if (success) {
        p_client =
            input_data_view.TakeClient<decltype(p_client)>();
      }
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            ReadAloudPlaybackControllerFactory::Name_, 0, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->CreateController(        
        std::move(p_controller), 
        std::move(p_client));
      return true;
    }
  }
  return false;
}

// static
bool ReadAloudPlaybackControllerFactoryStubDispatch::AcceptWithResponder(
    ReadAloudPlaybackControllerFactory* 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::ReadAloudPlaybackControllerFactory>(message->header()->name)) {
    case messages::ReadAloudPlaybackControllerFactory::kCreateController: {
      break;
    }
  }
  return false;
}
namespace {
}  // namespace
static const mojo::internal::GenericValidationInfo kReadAloudPlaybackControllerFactoryValidationInfo[] = {
    { &internal::ReadAloudPlaybackControllerFactory_CreateController_Params_Data::Validate,
     nullptr /* no response */},
};

bool ReadAloudPlaybackControllerFactoryRequestValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateRequestGenericPacked(
    message,
    ::read_aloud::mojom::ReadAloudPlaybackControllerFactory::Name_,
    kReadAloudPlaybackControllerFactoryValidationInfo);
}



}  // read_aloud::mojom


namespace mojo {


// static
bool StructTraits<::read_aloud::mojom::TextSegment::DataView, ::read_aloud::mojom::TextSegmentPtr>::Read(
    ::read_aloud::mojom::TextSegment::DataView input,
    ::read_aloud::mojom::TextSegmentPtr* output) {
  bool success = true;
  ::read_aloud::mojom::TextSegmentPtr result(::read_aloud::mojom::TextSegment::New());
  
      if (success)
        result->segment_index = input.segment_index();
      if (success && !input.ReadText(&result->text))
        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 read_aloud::mojom {


void ReadAloudPlaybackControllerInterceptorForTesting::InitializeAudio(::mojo::PendingRemote<::media::mojom::AudioOutputStream> stream, ::media::mojom::ReadWriteAudioDataPipePtr data_pipe, const ::media::AudioParameters& params) {
  GetForwardingInterface()->InitializeAudio(
    std::move(stream)
    , 
    std::move(data_pipe)
    , 
    std::move(params)
    );
}
void ReadAloudPlaybackControllerInterceptorForTesting::SetTextContent(std::vector<TextSegmentPtr> segments) {
  GetForwardingInterface()->SetTextContent(
    std::move(segments)
    );
}
void ReadAloudPlaybackControllerInterceptorForTesting::Play() {
  GetForwardingInterface()->Play();
}
void ReadAloudPlaybackControllerInterceptorForTesting::Pause() {
  GetForwardingInterface()->Pause();
}
void ReadAloudPlaybackControllerInterceptorForTesting::SeekToWord(uint32_t segment_index, uint32_t character_offset) {
  GetForwardingInterface()->SeekToWord(
    std::move(segment_index)
    , 
    std::move(character_offset)
    );
}
void ReadAloudPlaybackControllerInterceptorForTesting::SeekToTime(::base::TimeDelta position) {
  GetForwardingInterface()->SeekToTime(
    std::move(position)
    );
}
void ReadAloudPlaybackControllerInterceptorForTesting::SetVoice(const std::string& voice_id) {
  GetForwardingInterface()->SetVoice(
    std::move(voice_id)
    );
}
void ReadAloudPlaybackControllerInterceptorForTesting::SetPlaybackRate(float rate) {
  GetForwardingInterface()->SetPlaybackRate(
    std::move(rate)
    );
}
void ReadAloudPlaybackControllerInterceptorForTesting::FlushBuffers() {
  GetForwardingInterface()->FlushBuffers();
}
ReadAloudPlaybackControllerAsyncWaiter::ReadAloudPlaybackControllerAsyncWaiter(
    ReadAloudPlaybackController* proxy) : proxy_(proxy) {}

ReadAloudPlaybackControllerAsyncWaiter::~ReadAloudPlaybackControllerAsyncWaiter() = default;





void ReadAloudPlaybackControllerClientInterceptorForTesting::OnPlaybackStateChanged(PlaybackState state) {
  GetForwardingInterface()->OnPlaybackStateChanged(
    std::move(state)
    );
}
void ReadAloudPlaybackControllerClientInterceptorForTesting::OnPlaybackDurationChanged(::base::TimeDelta duration) {
  GetForwardingInterface()->OnPlaybackDurationChanged(
    std::move(duration)
    );
}
void ReadAloudPlaybackControllerClientInterceptorForTesting::OnWordBoundaryReached(uint32_t segment_index, uint32_t character_offset, ::base::TimeDelta audio_timestamp) {
  GetForwardingInterface()->OnWordBoundaryReached(
    std::move(segment_index)
    , 
    std::move(character_offset)
    , 
    std::move(audio_timestamp)
    );
}
void ReadAloudPlaybackControllerClientInterceptorForTesting::RequestSpeechSynthesis(const ::std::u16string& text_chunk, uint64_t sequence_id, RequestSpeechSynthesisCallback callback) {
  GetForwardingInterface()->RequestSpeechSynthesis(
    std::move(text_chunk)
    , 
    std::move(sequence_id)
    , std::move(callback));
}
ReadAloudPlaybackControllerClientAsyncWaiter::ReadAloudPlaybackControllerClientAsyncWaiter(
    ReadAloudPlaybackControllerClient* proxy) : proxy_(proxy) {}

ReadAloudPlaybackControllerClientAsyncWaiter::~ReadAloudPlaybackControllerClientAsyncWaiter() = default;


void ReadAloudPlaybackControllerClientAsyncWaiter::RequestSpeechSynthesis(
    const ::std::u16string& text_chunk, uint64_t sequence_id, ::mojo_base::BigBuffer* out_response_bytes, bool* out_success) {
  base::RunLoop loop;
  proxy_->RequestSpeechSynthesis(
      std::move(text_chunk),
      std::move(sequence_id),
      base::BindOnce(
          [](base::RunLoop* loop,
             ::mojo_base::BigBuffer* out_response_bytes
,
             bool* out_success
,
             ::mojo_base::BigBuffer response_bytes,
             bool success) {*out_response_bytes = std::move(response_bytes);*out_success = std::move(success);
            loop->Quit();
          },
          &loop,
          out_response_bytes,
          out_success));
  loop.Run();
}






void ReadAloudPlaybackControllerFactoryInterceptorForTesting::CreateController(::mojo::PendingReceiver<ReadAloudPlaybackController> controller, ::mojo::PendingRemote<ReadAloudPlaybackControllerClient> client) {
  GetForwardingInterface()->CreateController(
    std::move(controller)
    , 
    std::move(client)
    );
}
ReadAloudPlaybackControllerFactoryAsyncWaiter::ReadAloudPlaybackControllerFactoryAsyncWaiter(
    ReadAloudPlaybackControllerFactory* proxy) : proxy_(proxy) {}

ReadAloudPlaybackControllerFactoryAsyncWaiter::~ReadAloudPlaybackControllerFactoryAsyncWaiter() = default;







}  // read_aloud::mojom


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