// third_party/blink/public/mojom/web_install/web_install.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 "third_party/blink/public/mojom/web_install/web_install.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 "third_party/blink/public/mojom/web_install/web_install.mojom-params-data.h"
#include "third_party/blink/public/mojom/web_install/web_install.mojom-shared-message-ids.h"

#include "third_party/blink/public/mojom/web_install/web_install.mojom-import-headers.h"
#include "third_party/blink/public/mojom/web_install/web_install.mojom-test-utils.h"


namespace blink::mojom {
InstallOptions::InstallOptions()
    : install_url(),
      manifest_id() {}

InstallOptions::InstallOptions(
    const ::GURL& install_url_in,
    const std::optional<::GURL>& manifest_id_in)
    : install_url(std::move(install_url_in)),
      manifest_id(std::move(manifest_id_in)) {}

InstallOptions::~InstallOptions() = default;

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

bool InstallOptions::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
ManifestInstallOptions::ManifestInstallOptions()
    : manifest_url(),
      manifest_id() {}

ManifestInstallOptions::ManifestInstallOptions(
    const ::GURL& manifest_url_in,
    const std::optional<::GURL>& manifest_id_in)
    : manifest_url(std::move(manifest_url_in)),
      manifest_id(std::move(manifest_id_in)) {}

ManifestInstallOptions::~ManifestInstallOptions() = default;

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

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

WebInstallService::IPCStableHashFunction WebInstallService::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
  switch (static_cast<messages::WebInstallService>(message.name())) {
    case messages::WebInstallService::kIsInstalled: {
      return &WebInstallService::IsInstalled_Sym::IPCStableHash;
    }
    case messages::WebInstallService::kInstall: {
      return &WebInstallService::Install_Sym::IPCStableHash;
    }
    case messages::WebInstallService::kInstallFromElement: {
      return &WebInstallService::InstallFromElement_Sym::IPCStableHash;
    }
    case messages::WebInstallService::kInstallFromManifest: {
      return &WebInstallService::InstallFromManifest_Sym::IPCStableHash;
    }
    case messages::WebInstallService::kElementInstallFromManifest: {
      return &WebInstallService::ElementInstallFromManifest_Sym::IPCStableHash;
    }
  }
#endif  // !BUILDFLAG(IS_FUCHSIA)
  return nullptr;
}


const char* WebInstallService::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::WebInstallService>(message.name())) {
      case messages::WebInstallService::kIsInstalled:
            return "Receive blink::mojom::WebInstallService::IsInstalled";
      case messages::WebInstallService::kInstall:
            return "Receive blink::mojom::WebInstallService::Install";
      case messages::WebInstallService::kInstallFromElement:
            return "Receive blink::mojom::WebInstallService::InstallFromElement";
      case messages::WebInstallService::kInstallFromManifest:
            return "Receive blink::mojom::WebInstallService::InstallFromManifest";
      case messages::WebInstallService::kElementInstallFromManifest:
            return "Receive blink::mojom::WebInstallService::ElementInstallFromManifest";
    }
  } else {
    switch (static_cast<messages::WebInstallService>(message.name())) {
      case messages::WebInstallService::kIsInstalled:
            return "Receive reply blink::mojom::WebInstallService::IsInstalled";
      case messages::WebInstallService::kInstall:
            return "Receive reply blink::mojom::WebInstallService::Install";
      case messages::WebInstallService::kInstallFromElement:
            return "Receive reply blink::mojom::WebInstallService::InstallFromElement";
      case messages::WebInstallService::kInstallFromManifest:
            return "Receive reply blink::mojom::WebInstallService::InstallFromManifest";
      case messages::WebInstallService::kElementInstallFromManifest:
            return "Receive reply blink::mojom::WebInstallService::ElementInstallFromManifest";
    }
  }
  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 WebInstallService::IsInstalled_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 = 0x0c7ef87f;  // IPCStableHash for blink::mojom::WebInstallService::IsInstalled
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t WebInstallService::Install_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 = 0xee1ca595;  // IPCStableHash for blink::mojom::WebInstallService::Install
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t WebInstallService::InstallFromElement_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 = 0x7b272c56;  // IPCStableHash for blink::mojom::WebInstallService::InstallFromElement
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t WebInstallService::InstallFromManifest_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 = 0x333aa965;  // IPCStableHash for blink::mojom::WebInstallService::InstallFromManifest
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t WebInstallService::ElementInstallFromManifest_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 = 0xaa28e5d7;  // IPCStableHash for blink::mojom::WebInstallService::ElementInstallFromManifest
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)

class WebInstallService_IsInstalled_ForwardToCallback
    : public mojo::MessageReceiver {
 public:
  WebInstallService_IsInstalled_ForwardToCallback(
      WebInstallService::IsInstalledCallback callback
      ) : callback_(std::move(callback)) {
  }

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

  bool Accept(mojo::Message* message) override;
 private:
  WebInstallService::IsInstalledCallback callback_;
};

class WebInstallService_Install_ForwardToCallback
    : public mojo::MessageReceiver {
 public:
  WebInstallService_Install_ForwardToCallback(
      WebInstallService::InstallCallback callback
      ) : callback_(std::move(callback)) {
  }

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

  bool Accept(mojo::Message* message) override;
 private:
  WebInstallService::InstallCallback callback_;
};

class WebInstallService_InstallFromElement_ForwardToCallback
    : public mojo::MessageReceiver {
 public:
  WebInstallService_InstallFromElement_ForwardToCallback(
      WebInstallService::InstallFromElementCallback callback
      ) : callback_(std::move(callback)) {
  }

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

  bool Accept(mojo::Message* message) override;
 private:
  WebInstallService::InstallFromElementCallback callback_;
};

class WebInstallService_InstallFromManifest_ForwardToCallback
    : public mojo::MessageReceiver {
 public:
  WebInstallService_InstallFromManifest_ForwardToCallback(
      WebInstallService::InstallFromManifestCallback callback
      ) : callback_(std::move(callback)) {
  }

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

  bool Accept(mojo::Message* message) override;
 private:
  WebInstallService::InstallFromManifestCallback callback_;
};

class WebInstallService_ElementInstallFromManifest_ForwardToCallback
    : public mojo::MessageReceiver {
 public:
  WebInstallService_ElementInstallFromManifest_ForwardToCallback(
      WebInstallService::ElementInstallFromManifestCallback callback
      ) : callback_(std::move(callback)) {
  }

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

  bool Accept(mojo::Message* message) override;
 private:
  WebInstallService::ElementInstallFromManifestCallback callback_;
};

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

void WebInstallServiceProxy::IsInstalled(
    InstallOptionsPtr in_options, IsInstalledCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send blink::mojom::WebInstallService::IsInstalled", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("options"), in_options,
                        "<value of type InstallOptionsPtr>");
   });
#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::WebInstallService::kIsInstalled), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::WebInstallService_IsInstalled_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->options)::BaseType> options_fragment(
          params.message());
  
  mojo::internal::Serialize<::blink::mojom::InstallOptionsDataView>(
    in_options,
    options_fragment);

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

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

void WebInstallServiceProxy::Install(
    InstallOptionsPtr in_options, InstallCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send blink::mojom::WebInstallService::Install", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("options"), in_options,
                        "<value of type InstallOptionsPtr>");
   });
#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::WebInstallService::kInstall), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::WebInstallService_Install_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->options)::BaseType> options_fragment(
          params.message());
  
  mojo::internal::Serialize<::blink::mojom::InstallOptionsDataView>(
    in_options,
    options_fragment);

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

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

void WebInstallServiceProxy::InstallFromElement(
    InstallOptionsPtr in_options, InstallFromElementCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send blink::mojom::WebInstallService::InstallFromElement", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("options"), in_options,
                        "<value of type InstallOptionsPtr>");
   });
#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::WebInstallService::kInstallFromElement), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::WebInstallService_InstallFromElement_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->options)::BaseType> options_fragment(
          params.message());
  
  mojo::internal::Serialize<::blink::mojom::InstallOptionsDataView>(
    in_options,
    options_fragment);

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

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

void WebInstallServiceProxy::InstallFromManifest(
    ManifestInstallOptionsPtr in_options, InstallFromManifestCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send blink::mojom::WebInstallService::InstallFromManifest", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("options"), in_options,
                        "<value of type ManifestInstallOptionsPtr>");
   });
#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::WebInstallService::kInstallFromManifest), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::WebInstallService_InstallFromManifest_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->options)::BaseType> options_fragment(
          params.message());
  
  mojo::internal::Serialize<::blink::mojom::ManifestInstallOptionsDataView>(
    in_options,
    options_fragment);

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

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

void WebInstallServiceProxy::ElementInstallFromManifest(
    ManifestInstallOptionsPtr in_options, ElementInstallFromManifestCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send blink::mojom::WebInstallService::ElementInstallFromManifest", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("options"), in_options,
                        "<value of type ManifestInstallOptionsPtr>");
   });
#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::WebInstallService::kElementInstallFromManifest), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::WebInstallService_ElementInstallFromManifest_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->options)::BaseType> options_fragment(
          params.message());
  
  mojo::internal::Serialize<::blink::mojom::ManifestInstallOptionsDataView>(
    in_options,
    options_fragment);

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

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

  ~WebInstallService_IsInstalled_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:
  WebInstallService_IsInstalled_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)
        << "WebInstallService::IsInstalledCallback 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 in_is_installed);
};

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

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

void WebInstallService_IsInstalled_ProxyToResponder::Run(
    bool in_is_installed) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send reply blink::mojom::WebInstallService::IsInstalled", "async_response_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("is_installed"), in_is_installed,
                        "<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::WebInstallService::kIsInstalled), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::WebInstallService_IsInstalled_ResponseParams_Data> params(
          message);
  params.Allocate();

  params->is_installed = in_is_installed;

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(WebInstallService::Name_);
  message.set_method_name("IsInstalled");
#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;
}
class WebInstallService_Install_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
 public:
  static WebInstallService::InstallCallback CreateCallback(
      ::mojo::Message& message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
    std::unique_ptr<WebInstallService_Install_ProxyToResponder> proxy(
        new WebInstallService_Install_ProxyToResponder(
            message, std::move(responder)));
    return base::BindOnce(&WebInstallService_Install_ProxyToResponder::Run,
                          std::move(proxy));
  }

  ~WebInstallService_Install_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:
  WebInstallService_Install_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)
        << "WebInstallService::InstallCallback 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(
      WebInstallServiceResult in_result, const ::GURL& in_manifest_id);
};

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

  // Validation for WebInstallService.1
  bool success = true;
  WebInstallServiceResult p_result{};
  ::GURL p_manifest_id{};
  WebInstallService_Install_ResponseParamsDataView input_data_view(params, message);
  
  if (success && !input_data_view.ReadResult(&p_result))
    success = false;
  if (success && !input_data_view.ReadManifestId(&p_manifest_id))
    success = false;
  if (!success) {
    ReportValidationErrorForMessage(
        message,
        mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
        WebInstallService::Name_, 1, true);
    return false;
  }
  if (!callback_.is_null()) {
    std::move(callback_).Run(
std::move(p_result), 
std::move(p_manifest_id));
  }
  return true;
}

void WebInstallService_Install_ProxyToResponder::Run(
    WebInstallServiceResult in_result, const ::GURL& in_manifest_id) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send reply blink::mojom::WebInstallService::Install", "async_response_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("result"), in_result,
                        "<value of type WebInstallServiceResult>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("manifest_id"), in_manifest_id,
                        "<value of type const ::GURL&>");
   });
#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::WebInstallService::kInstall), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::WebInstallService_Install_ResponseParams_Data> params(
          message);
  params.Allocate();

  
  mojo::internal::Serialize<::blink::mojom::WebInstallServiceResult>(
    in_result,
    &params->result);
  mojo::internal::MessageFragment<
      typename decltype(params->manifest_id)::BaseType> manifest_id_fragment(
          params.message());
  
  mojo::internal::Serialize<::url::mojom::UrlDataView>(
    in_manifest_id,
    manifest_id_fragment);

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

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

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(WebInstallService::Name_);
  message.set_method_name("Install");
#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;
}
class WebInstallService_InstallFromElement_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
 public:
  static WebInstallService::InstallFromElementCallback CreateCallback(
      ::mojo::Message& message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
    std::unique_ptr<WebInstallService_InstallFromElement_ProxyToResponder> proxy(
        new WebInstallService_InstallFromElement_ProxyToResponder(
            message, std::move(responder)));
    return base::BindOnce(&WebInstallService_InstallFromElement_ProxyToResponder::Run,
                          std::move(proxy));
  }

  ~WebInstallService_InstallFromElement_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:
  WebInstallService_InstallFromElement_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)
        << "WebInstallService::InstallFromElementCallback 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(
      WebInstallServiceResult in_result, const ::GURL& in_manifest_id);
};

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

  // Validation for WebInstallService.2
  bool success = true;
  WebInstallServiceResult p_result{};
  ::GURL p_manifest_id{};
  WebInstallService_InstallFromElement_ResponseParamsDataView input_data_view(params, message);
  
  if (success && !input_data_view.ReadResult(&p_result))
    success = false;
  if (success && !input_data_view.ReadManifestId(&p_manifest_id))
    success = false;
  if (!success) {
    ReportValidationErrorForMessage(
        message,
        mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
        WebInstallService::Name_, 2, true);
    return false;
  }
  if (!callback_.is_null()) {
    std::move(callback_).Run(
std::move(p_result), 
std::move(p_manifest_id));
  }
  return true;
}

void WebInstallService_InstallFromElement_ProxyToResponder::Run(
    WebInstallServiceResult in_result, const ::GURL& in_manifest_id) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send reply blink::mojom::WebInstallService::InstallFromElement", "async_response_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("result"), in_result,
                        "<value of type WebInstallServiceResult>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("manifest_id"), in_manifest_id,
                        "<value of type const ::GURL&>");
   });
#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::WebInstallService::kInstallFromElement), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::WebInstallService_InstallFromElement_ResponseParams_Data> params(
          message);
  params.Allocate();

  
  mojo::internal::Serialize<::blink::mojom::WebInstallServiceResult>(
    in_result,
    &params->result);
  mojo::internal::MessageFragment<
      typename decltype(params->manifest_id)::BaseType> manifest_id_fragment(
          params.message());
  
  mojo::internal::Serialize<::url::mojom::UrlDataView>(
    in_manifest_id,
    manifest_id_fragment);

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

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

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(WebInstallService::Name_);
  message.set_method_name("InstallFromElement");
#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;
}
class WebInstallService_InstallFromManifest_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
 public:
  static WebInstallService::InstallFromManifestCallback CreateCallback(
      ::mojo::Message& message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
    std::unique_ptr<WebInstallService_InstallFromManifest_ProxyToResponder> proxy(
        new WebInstallService_InstallFromManifest_ProxyToResponder(
            message, std::move(responder)));
    return base::BindOnce(&WebInstallService_InstallFromManifest_ProxyToResponder::Run,
                          std::move(proxy));
  }

  ~WebInstallService_InstallFromManifest_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:
  WebInstallService_InstallFromManifest_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)
        << "WebInstallService::InstallFromManifestCallback 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(
      WebInstallServiceResult in_result);
};

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

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

void WebInstallService_InstallFromManifest_ProxyToResponder::Run(
    WebInstallServiceResult in_result) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send reply blink::mojom::WebInstallService::InstallFromManifest", "async_response_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("result"), in_result,
                        "<value of type WebInstallServiceResult>");
   });
#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::WebInstallService::kInstallFromManifest), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::WebInstallService_InstallFromManifest_ResponseParams_Data> params(
          message);
  params.Allocate();

  
  mojo::internal::Serialize<::blink::mojom::WebInstallServiceResult>(
    in_result,
    &params->result);

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(WebInstallService::Name_);
  message.set_method_name("InstallFromManifest");
#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;
}
class WebInstallService_ElementInstallFromManifest_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
 public:
  static WebInstallService::ElementInstallFromManifestCallback CreateCallback(
      ::mojo::Message& message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
    std::unique_ptr<WebInstallService_ElementInstallFromManifest_ProxyToResponder> proxy(
        new WebInstallService_ElementInstallFromManifest_ProxyToResponder(
            message, std::move(responder)));
    return base::BindOnce(&WebInstallService_ElementInstallFromManifest_ProxyToResponder::Run,
                          std::move(proxy));
  }

  ~WebInstallService_ElementInstallFromManifest_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:
  WebInstallService_ElementInstallFromManifest_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)
        << "WebInstallService::ElementInstallFromManifestCallback 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(
      WebInstallServiceResult in_result);
};

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

  // Validation for WebInstallService.4
  bool success = true;
  WebInstallServiceResult p_result{};
  WebInstallService_ElementInstallFromManifest_ResponseParamsDataView input_data_view(params, message);
  
  if (success && !input_data_view.ReadResult(&p_result))
    success = false;
  if (!success) {
    ReportValidationErrorForMessage(
        message,
        mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
        WebInstallService::Name_, 4, true);
    return false;
  }
  if (!callback_.is_null()) {
    std::move(callback_).Run(
std::move(p_result));
  }
  return true;
}

void WebInstallService_ElementInstallFromManifest_ProxyToResponder::Run(
    WebInstallServiceResult in_result) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send reply blink::mojom::WebInstallService::ElementInstallFromManifest", "async_response_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("result"), in_result,
                        "<value of type WebInstallServiceResult>");
   });
#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::WebInstallService::kElementInstallFromManifest), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::WebInstallService_ElementInstallFromManifest_ResponseParams_Data> params(
          message);
  params.Allocate();

  
  mojo::internal::Serialize<::blink::mojom::WebInstallServiceResult>(
    in_result,
    &params->result);

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(WebInstallService::Name_);
  message.set_method_name("ElementInstallFromManifest");
#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 WebInstallServiceStubDispatch::Accept(
    WebInstallService* impl,
    mojo::Message* message) {
  switch (static_cast<messages::WebInstallService>(message->header()->name)) {
    case messages::WebInstallService::kIsInstalled: {
      break;
    }
    case messages::WebInstallService::kInstall: {
      break;
    }
    case messages::WebInstallService::kInstallFromElement: {
      break;
    }
    case messages::WebInstallService::kInstallFromManifest: {
      break;
    }
    case messages::WebInstallService::kElementInstallFromManifest: {
      break;
    }
  }
  return false;
}

// static
bool WebInstallServiceStubDispatch::AcceptWithResponder(
    WebInstallService* 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::WebInstallService>(message->header()->name)) {
    case messages::WebInstallService::kIsInstalled: {
      internal::WebInstallService_IsInstalled_Params_Data* params =
          reinterpret_cast<
              internal::WebInstallService_IsInstalled_Params_Data*>(
                  message->mutable_payload());
      

      // Validation for WebInstallService.0
      bool success = true;
      InstallOptionsPtr p_options{};
      WebInstallService_IsInstalled_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadOptions(&p_options))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            WebInstallService::Name_, 0, false);
        return false;
      }
      auto callback =
          WebInstallService_IsInstalled_ProxyToResponder::CreateCallback(
              *message, std::move(responder));
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->IsInstalled(        
        std::move(p_options), std::move(callback));
      return true;
    }
    case messages::WebInstallService::kInstall: {
      internal::WebInstallService_Install_Params_Data* params =
          reinterpret_cast<
              internal::WebInstallService_Install_Params_Data*>(
                  message->mutable_payload());
      

      // Validation for WebInstallService.1
      bool success = true;
      InstallOptionsPtr p_options{};
      WebInstallService_Install_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadOptions(&p_options))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            WebInstallService::Name_, 1, false);
        return false;
      }
      auto callback =
          WebInstallService_Install_ProxyToResponder::CreateCallback(
              *message, std::move(responder));
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->Install(        
        std::move(p_options), std::move(callback));
      return true;
    }
    case messages::WebInstallService::kInstallFromElement: {
      internal::WebInstallService_InstallFromElement_Params_Data* params =
          reinterpret_cast<
              internal::WebInstallService_InstallFromElement_Params_Data*>(
                  message->mutable_payload());
      

      // Validation for WebInstallService.2
      bool success = true;
      InstallOptionsPtr p_options{};
      WebInstallService_InstallFromElement_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadOptions(&p_options))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            WebInstallService::Name_, 2, false);
        return false;
      }
      auto callback =
          WebInstallService_InstallFromElement_ProxyToResponder::CreateCallback(
              *message, std::move(responder));
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->InstallFromElement(        
        std::move(p_options), std::move(callback));
      return true;
    }
    case messages::WebInstallService::kInstallFromManifest: {
      internal::WebInstallService_InstallFromManifest_Params_Data* params =
          reinterpret_cast<
              internal::WebInstallService_InstallFromManifest_Params_Data*>(
                  message->mutable_payload());
      

      // Validation for WebInstallService.3
      bool success = true;
      ManifestInstallOptionsPtr p_options{};
      WebInstallService_InstallFromManifest_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadOptions(&p_options))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            WebInstallService::Name_, 3, false);
        return false;
      }
      auto callback =
          WebInstallService_InstallFromManifest_ProxyToResponder::CreateCallback(
              *message, std::move(responder));
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->InstallFromManifest(        
        std::move(p_options), std::move(callback));
      return true;
    }
    case messages::WebInstallService::kElementInstallFromManifest: {
      internal::WebInstallService_ElementInstallFromManifest_Params_Data* params =
          reinterpret_cast<
              internal::WebInstallService_ElementInstallFromManifest_Params_Data*>(
                  message->mutable_payload());
      

      // Validation for WebInstallService.4
      bool success = true;
      ManifestInstallOptionsPtr p_options{};
      WebInstallService_ElementInstallFromManifest_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadOptions(&p_options))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            WebInstallService::Name_, 4, false);
        return false;
      }
      auto callback =
          WebInstallService_ElementInstallFromManifest_ProxyToResponder::CreateCallback(
              *message, std::move(responder));
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->ElementInstallFromManifest(        
        std::move(p_options), std::move(callback));
      return true;
    }
  }
  return false;
}
namespace {
}  // namespace
static const mojo::internal::GenericValidationInfo kWebInstallServiceValidationInfo[] = {
    { &internal::WebInstallService_IsInstalled_Params_Data::Validate,
     &internal::WebInstallService_IsInstalled_ResponseParams_Data::Validate},
    { &internal::WebInstallService_Install_Params_Data::Validate,
     &internal::WebInstallService_Install_ResponseParams_Data::Validate},
    { &internal::WebInstallService_InstallFromElement_Params_Data::Validate,
     &internal::WebInstallService_InstallFromElement_ResponseParams_Data::Validate},
    { &internal::WebInstallService_InstallFromManifest_Params_Data::Validate,
     &internal::WebInstallService_InstallFromManifest_ResponseParams_Data::Validate},
    { &internal::WebInstallService_ElementInstallFromManifest_Params_Data::Validate,
     &internal::WebInstallService_ElementInstallFromManifest_ResponseParams_Data::Validate},
};

bool WebInstallServiceRequestValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateRequestGenericPacked(
    message,
    ::blink::mojom::WebInstallService::Name_,
    kWebInstallServiceValidationInfo);
}

bool WebInstallServiceResponseValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateResponseGenericPacked(
    message,
    ::blink::mojom::WebInstallService::Name_,
    kWebInstallServiceValidationInfo);
}


}  // blink::mojom


namespace mojo {


// static
bool StructTraits<::blink::mojom::InstallOptions::DataView, ::blink::mojom::InstallOptionsPtr>::Read(
    ::blink::mojom::InstallOptions::DataView input,
    ::blink::mojom::InstallOptionsPtr* output) {
  bool success = true;
  ::blink::mojom::InstallOptionsPtr result(::blink::mojom::InstallOptions::New());
  
      if (success && !input.ReadInstallUrl(&result->install_url))
        success = false;
      if (success && !input.ReadManifestId(&result->manifest_id))
        success = false;
  *output = std::move(result);
  return success;
}


// static
bool StructTraits<::blink::mojom::ManifestInstallOptions::DataView, ::blink::mojom::ManifestInstallOptionsPtr>::Read(
    ::blink::mojom::ManifestInstallOptions::DataView input,
    ::blink::mojom::ManifestInstallOptionsPtr* output) {
  bool success = true;
  ::blink::mojom::ManifestInstallOptionsPtr result(::blink::mojom::ManifestInstallOptions::New());
  
      if (success && !input.ReadManifestUrl(&result->manifest_url))
        success = false;
      if (success && !input.ReadManifestId(&result->manifest_id))
        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 blink::mojom {


void WebInstallServiceInterceptorForTesting::IsInstalled(InstallOptionsPtr options, IsInstalledCallback callback) {
  GetForwardingInterface()->IsInstalled(
    std::move(options)
    , std::move(callback));
}
void WebInstallServiceInterceptorForTesting::Install(InstallOptionsPtr options, InstallCallback callback) {
  GetForwardingInterface()->Install(
    std::move(options)
    , std::move(callback));
}
void WebInstallServiceInterceptorForTesting::InstallFromElement(InstallOptionsPtr options, InstallFromElementCallback callback) {
  GetForwardingInterface()->InstallFromElement(
    std::move(options)
    , std::move(callback));
}
void WebInstallServiceInterceptorForTesting::InstallFromManifest(ManifestInstallOptionsPtr options, InstallFromManifestCallback callback) {
  GetForwardingInterface()->InstallFromManifest(
    std::move(options)
    , std::move(callback));
}
void WebInstallServiceInterceptorForTesting::ElementInstallFromManifest(ManifestInstallOptionsPtr options, ElementInstallFromManifestCallback callback) {
  GetForwardingInterface()->ElementInstallFromManifest(
    std::move(options)
    , std::move(callback));
}
WebInstallServiceAsyncWaiter::WebInstallServiceAsyncWaiter(
    WebInstallService* proxy) : proxy_(proxy) {}

WebInstallServiceAsyncWaiter::~WebInstallServiceAsyncWaiter() = default;


void WebInstallServiceAsyncWaiter::IsInstalled(
    InstallOptionsPtr options, bool* out_is_installed) {
  base::RunLoop loop;
  proxy_->IsInstalled(
      std::move(options),
      base::BindOnce(
          [](base::RunLoop* loop,
             bool* out_is_installed
,
             bool is_installed) {*out_is_installed = std::move(is_installed);
            loop->Quit();
          },
          &loop,
          out_is_installed));
  loop.Run();
}

bool WebInstallServiceAsyncWaiter::IsInstalled(
    InstallOptionsPtr options) {
  bool async_wait_result;
  IsInstalled(std::move(options),&async_wait_result);
  return async_wait_result;
}

void WebInstallServiceAsyncWaiter::Install(
    InstallOptionsPtr options, WebInstallServiceResult* out_result, ::GURL* out_manifest_id) {
  base::RunLoop loop;
  proxy_->Install(
      std::move(options),
      base::BindOnce(
          [](base::RunLoop* loop,
             WebInstallServiceResult* out_result
,
             ::GURL* out_manifest_id
,
             WebInstallServiceResult result,
             const ::GURL& manifest_id) {*out_result = std::move(result);*out_manifest_id = std::move(manifest_id);
            loop->Quit();
          },
          &loop,
          out_result,
          out_manifest_id));
  loop.Run();
}



void WebInstallServiceAsyncWaiter::InstallFromElement(
    InstallOptionsPtr options, WebInstallServiceResult* out_result, ::GURL* out_manifest_id) {
  base::RunLoop loop;
  proxy_->InstallFromElement(
      std::move(options),
      base::BindOnce(
          [](base::RunLoop* loop,
             WebInstallServiceResult* out_result
,
             ::GURL* out_manifest_id
,
             WebInstallServiceResult result,
             const ::GURL& manifest_id) {*out_result = std::move(result);*out_manifest_id = std::move(manifest_id);
            loop->Quit();
          },
          &loop,
          out_result,
          out_manifest_id));
  loop.Run();
}



void WebInstallServiceAsyncWaiter::InstallFromManifest(
    ManifestInstallOptionsPtr options, WebInstallServiceResult* out_result) {
  base::RunLoop loop;
  proxy_->InstallFromManifest(
      std::move(options),
      base::BindOnce(
          [](base::RunLoop* loop,
             WebInstallServiceResult* out_result
,
             WebInstallServiceResult result) {*out_result = std::move(result);
            loop->Quit();
          },
          &loop,
          out_result));
  loop.Run();
}

WebInstallServiceResult WebInstallServiceAsyncWaiter::InstallFromManifest(
    ManifestInstallOptionsPtr options) {
  WebInstallServiceResult async_wait_result;
  InstallFromManifest(std::move(options),&async_wait_result);
  return async_wait_result;
}

void WebInstallServiceAsyncWaiter::ElementInstallFromManifest(
    ManifestInstallOptionsPtr options, WebInstallServiceResult* out_result) {
  base::RunLoop loop;
  proxy_->ElementInstallFromManifest(
      std::move(options),
      base::BindOnce(
          [](base::RunLoop* loop,
             WebInstallServiceResult* out_result
,
             WebInstallServiceResult result) {*out_result = std::move(result);
            loop->Quit();
          },
          &loop,
          out_result));
  loop.Run();
}

WebInstallServiceResult WebInstallServiceAsyncWaiter::ElementInstallFromManifest(
    ManifestInstallOptionsPtr options) {
  WebInstallServiceResult async_wait_result;
  ElementInstallFromManifest(std::move(options),&async_wait_result);
  return async_wait_result;
}






}  // blink::mojom


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