// third_party/blink/public/mojom/payments/payment_app.mojom-blink.cc is auto generated by mojom_bindings_generator.py, do not edit

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

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

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

#include "third_party/blink/public/mojom/payments/payment_app.mojom-blink-import-headers.h"
#include "third_party/blink/public/mojom/payments/payment_app.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


namespace payments::mojom::blink {
// The declaration includes the definition on other builds.

PaymentManager::IPCStableHashFunction PaymentManager::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
  switch (static_cast<messages::PaymentManager>(message.name())) {
    case messages::PaymentManager::kInit: {
      return &PaymentManager::Init_Sym::IPCStableHash;
    }
    case messages::PaymentManager::kSetUserHint: {
      return &PaymentManager::SetUserHint_Sym::IPCStableHash;
    }
    case messages::PaymentManager::kEnableDelegations: {
      return &PaymentManager::EnableDelegations_Sym::IPCStableHash;
    }
  }
#endif  // !BUILDFLAG(IS_FUCHSIA)
  return nullptr;
}


const char* PaymentManager::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::PaymentManager>(message.name())) {
      case messages::PaymentManager::kInit:
            return "Receive payments::mojom::PaymentManager::Init";
      case messages::PaymentManager::kSetUserHint:
            return "Receive payments::mojom::PaymentManager::SetUserHint";
      case messages::PaymentManager::kEnableDelegations:
            return "Receive payments::mojom::PaymentManager::EnableDelegations";
    }
  } else {
    switch (static_cast<messages::PaymentManager>(message.name())) {
      case messages::PaymentManager::kInit:
            return "Receive reply payments::mojom::PaymentManager::Init";
      case messages::PaymentManager::kSetUserHint:
            return "Receive reply payments::mojom::PaymentManager::SetUserHint";
      case messages::PaymentManager::kEnableDelegations:
            return "Receive reply payments::mojom::PaymentManager::EnableDelegations";
    }
  }
  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 PaymentManager::Init_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 = 0x23e3c3a7;  // IPCStableHash for payments::mojom::PaymentManager::Init
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t PaymentManager::SetUserHint_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 = 0xb288bbb7;  // IPCStableHash for payments::mojom::PaymentManager::SetUserHint
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t PaymentManager::EnableDelegations_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 = 0xa88ebc48;  // IPCStableHash for payments::mojom::PaymentManager::EnableDelegations
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)

class PaymentManager_EnableDelegations_ForwardToCallback
    : public mojo::MessageReceiver {
 public:
  PaymentManager_EnableDelegations_ForwardToCallback(
      PaymentManager::EnableDelegationsCallback callback
      ) : callback_(std::move(callback)) {
  }

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

  bool Accept(mojo::Message* message) override;
 private:
  PaymentManager::EnableDelegationsCallback callback_;
};

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

void PaymentManagerProxy::Init(
    const ::blink::KURL& in_context_url, const ::blink::String& in_service_worker_scope) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send payments::mojom::PaymentManager::Init", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("context_url"), in_context_url,
                        "<value of type const ::blink::KURL&>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("service_worker_scope"), in_service_worker_scope,
                        "<value of type const ::blink::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::PaymentManager::kInit), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::payments::mojom::internal::PaymentManager_Init_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->context_url)::BaseType> context_url_fragment(
          params.message());
  
  mojo::internal::Serialize<::url::mojom::UrlDataView>(
    in_context_url,
    context_url_fragment);

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

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->context_url.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null context_url in PaymentManager.Init request");
  mojo::internal::MessageFragment<
      typename decltype(params->service_worker_scope)::BaseType> service_worker_scope_fragment(
          params.message());
  
  mojo::internal::Serialize<mojo::StringDataView>(
    in_service_worker_scope,
    service_worker_scope_fragment);

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

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

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(PaymentManager::Name_);
  message.set_method_name("Init");
#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 PaymentManagerProxy::SetUserHint(
    const ::blink::String& in_user_hint) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send payments::mojom::PaymentManager::SetUserHint", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("user_hint"), in_user_hint,
                        "<value of type const ::blink::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::PaymentManager::kSetUserHint), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::payments::mojom::internal::PaymentManager_SetUserHint_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->user_hint)::BaseType> user_hint_fragment(
          params.message());
  
  mojo::internal::Serialize<mojo::StringDataView>(
    in_user_hint,
    user_hint_fragment);

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

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

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(PaymentManager::Name_);
  message.set_method_name("SetUserHint");
#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 PaymentManagerProxy::EnableDelegations(
    const ::blink::Vector<PaymentDelegation>& in_delegations, EnableDelegationsCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send payments::mojom::PaymentManager::EnableDelegations", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("delegations"), in_delegations,
                        "<value of type const ::blink::Vector<PaymentDelegation>&>");
   });
#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::PaymentManager::kEnableDelegations), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::payments::mojom::internal::PaymentManager_EnableDelegations_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->delegations)::BaseType>
      delegations_fragment(params.message());
  constexpr const mojo::internal::ContainerValidateParams& delegations_validate_params =
      mojo::internal::GetArrayOfEnumsValidator<0, false, ::payments::mojom::internal::PaymentDelegation_Data::Validate>();
  
  mojo::internal::Serialize<mojo::ArrayDataView<::payments::mojom::PaymentDelegation>>(
    in_delegations,
    delegations_fragment,
    &delegations_validate_params);

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

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

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

  ~PaymentManager_EnableDelegations_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:
  PaymentManager_EnableDelegations_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)
        << "PaymentManager::EnableDelegationsCallback 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(
      PaymentHandlerStatus in_status);
};

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

  // Validation for PaymentManager.2
  bool success = true;
  PaymentHandlerStatus p_status{};
  PaymentManager_EnableDelegations_ResponseParamsDataView input_data_view(params, message);
  
  if (success && !input_data_view.ReadStatus(&p_status))
    success = false;
  if (!success) {
    ReportValidationErrorForMessage(
        message,
        mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
        PaymentManager::Name_, 2, true);
    return false;
  }
  if (!callback_.is_null()) {
    std::move(callback_).Run(
std::move(p_status));
  }
  return true;
}

void PaymentManager_EnableDelegations_ProxyToResponder::Run(
    PaymentHandlerStatus in_status) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send reply payments::mojom::PaymentManager::EnableDelegations", "async_response_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("status"), in_status,
                        "<value of type PaymentHandlerStatus>");
   });
#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::PaymentManager::kEnableDelegations), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::payments::mojom::internal::PaymentManager_EnableDelegations_ResponseParams_Data> params(
          message);
  params.Allocate();

  
  mojo::internal::Serialize<::payments::mojom::PaymentHandlerStatus>(
    in_status,
    &params->status);

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

      // Validation for PaymentManager.0
      bool success = true;
      ::blink::KURL p_context_url{};
      ::blink::String p_service_worker_scope{};
      PaymentManager_Init_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadContextUrl(&p_context_url))
        success = false;
      if (success && !input_data_view.ReadServiceWorkerScope(&p_service_worker_scope))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            PaymentManager::Name_, 0, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->Init(        
        std::move(p_context_url), 
        std::move(p_service_worker_scope));
      return true;
    }
    case messages::PaymentManager::kSetUserHint: {
      DCHECK(message->is_serialized());
      internal::PaymentManager_SetUserHint_Params_Data* params =
          reinterpret_cast<internal::PaymentManager_SetUserHint_Params_Data*>(
              message->mutable_payload());
      

      // Validation for PaymentManager.1
      bool success = true;
      ::blink::String p_user_hint{};
      PaymentManager_SetUserHint_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadUserHint(&p_user_hint))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            PaymentManager::Name_, 1, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->SetUserHint(        
        std::move(p_user_hint));
      return true;
    }
    case messages::PaymentManager::kEnableDelegations: {
      break;
    }
  }
  return false;
}

// static
bool PaymentManagerStubDispatch::AcceptWithResponder(
    PaymentManager* 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::PaymentManager>(message->header()->name)) {
    case messages::PaymentManager::kInit: {
      break;
    }
    case messages::PaymentManager::kSetUserHint: {
      break;
    }
    case messages::PaymentManager::kEnableDelegations: {
      internal::PaymentManager_EnableDelegations_Params_Data* params =
          reinterpret_cast<
              internal::PaymentManager_EnableDelegations_Params_Data*>(
                  message->mutable_payload());
      

      // Validation for PaymentManager.2
      bool success = true;
      ::blink::Vector<PaymentDelegation> p_delegations{};
      PaymentManager_EnableDelegations_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadDelegations(&p_delegations))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            PaymentManager::Name_, 2, false);
        return false;
      }
      auto callback =
          PaymentManager_EnableDelegations_ProxyToResponder::CreateCallback(
              *message, std::move(responder));
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->EnableDelegations(        
        std::move(p_delegations), std::move(callback));
      return true;
    }
  }
  return false;
}
namespace {
}  // namespace
static const mojo::internal::GenericValidationInfo kPaymentManagerValidationInfo[] = {
    { &internal::PaymentManager_Init_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::PaymentManager_SetUserHint_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::PaymentManager_EnableDelegations_Params_Data::Validate,
     &internal::PaymentManager_EnableDelegations_ResponseParams_Data::Validate},
};

bool PaymentManagerRequestValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateRequestGenericPacked(
    message,
    ::payments::mojom::blink::PaymentManager::Name_,
    kPaymentManagerValidationInfo);
}

bool PaymentManagerResponseValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateResponseGenericPacked(
    message,
    ::payments::mojom::blink::PaymentManager::Name_,
    kPaymentManagerValidationInfo);
}


}  // payments::mojom::blink


namespace mojo {

}  // namespace mojo


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


namespace payments::mojom::blink {


void PaymentManagerInterceptorForTesting::Init(const ::blink::KURL& context_url, const ::blink::String& service_worker_scope) {
  GetForwardingInterface()->Init(
    std::move(context_url)
    , 
    std::move(service_worker_scope)
    );
}
void PaymentManagerInterceptorForTesting::SetUserHint(const ::blink::String& user_hint) {
  GetForwardingInterface()->SetUserHint(
    std::move(user_hint)
    );
}
void PaymentManagerInterceptorForTesting::EnableDelegations(const ::blink::Vector<PaymentDelegation>& delegations, EnableDelegationsCallback callback) {
  GetForwardingInterface()->EnableDelegations(
    std::move(delegations)
    , std::move(callback));
}
PaymentManagerAsyncWaiter::PaymentManagerAsyncWaiter(
    PaymentManager* proxy) : proxy_(proxy) {}

PaymentManagerAsyncWaiter::~PaymentManagerAsyncWaiter() = default;


void PaymentManagerAsyncWaiter::EnableDelegations(
    const ::blink::Vector<PaymentDelegation>& delegations, PaymentHandlerStatus* out_status) {
  base::RunLoop loop;
  proxy_->EnableDelegations(
      std::move(delegations),
      base::BindOnce(
          [](base::RunLoop* loop,
             PaymentHandlerStatus* out_status
,
             PaymentHandlerStatus status) {*out_status = std::move(status);
            loop->Quit();
          },
          &loop,
          out_status));
  loop.Run();
}

PaymentHandlerStatus PaymentManagerAsyncWaiter::EnableDelegations(
    const ::blink::Vector<PaymentDelegation>& delegations) {
  PaymentHandlerStatus async_wait_result;
  EnableDelegations(std::move(delegations),&async_wait_result);
  return async_wait_result;
}






}  // payments::mojom::blink


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