#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "chrome/services/printing/public/mojom/print_backend_service.mojom.h"
#include <math.h>
#include <stdint.h>
#include <utility>
#include "base/debug/alias.h"
#include "base/hash/md5_constexpr.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/features.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_util.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/services/printing/public/mojom/print_backend_service.mojom-params-data.h"
#include "chrome/services/printing/public/mojom/print_backend_service.mojom-shared-message-ids.h"
#include "chrome/services/printing/public/mojom/print_backend_service.mojom-import-headers.h"
#include "chrome/services/printing/public/mojom/print_backend_service.mojom-test-utils.h"
namespace printing::mojom {
PrinterCapsAndInfo::PrinterCapsAndInfo()
: … { … }
PrinterCapsAndInfo::PrinterCapsAndInfo(
const ::printing::PrinterBasicInfo& printer_info_in,
const ::printing::PrinterSemanticCapsAndDefaults& printer_caps_in)
: … { … }
PrinterCapsAndInfo::~PrinterCapsAndInfo() = default;
void PrinterCapsAndInfo::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool PrinterCapsAndInfo::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
DefaultPrinterNameResult::DefaultPrinterNameResult() : … { … }
DefaultPrinterNameResult::~DefaultPrinterNameResult() { … }
void DefaultPrinterNameResult::set_default_printer_name(
const std::string& default_printer_name) { … }
void DefaultPrinterNameResult::set_result_code(
::printing::mojom::ResultCode result_code) { … }
void DefaultPrinterNameResult::DestroyActive() { … }
size_t DefaultPrinterNameResult::Hash(size_t seed) const { … }
bool DefaultPrinterNameResult::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
PrinterListResult::PrinterListResult() : … { … }
PrinterListResult::~PrinterListResult() { … }
void PrinterListResult::set_printer_list(
std::vector<::printing::PrinterBasicInfo> printer_list) { … }
void PrinterListResult::set_result_code(
::printing::mojom::ResultCode result_code) { … }
void PrinterListResult::DestroyActive() { … }
bool PrinterListResult::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
PrinterSemanticCapsAndDefaultsResult::PrinterSemanticCapsAndDefaultsResult() : … { … }
PrinterSemanticCapsAndDefaultsResult::~PrinterSemanticCapsAndDefaultsResult() { … }
void PrinterSemanticCapsAndDefaultsResult::set_printer_caps(
const ::printing::PrinterSemanticCapsAndDefaults& printer_caps) { … }
void PrinterSemanticCapsAndDefaultsResult::set_result_code(
::printing::mojom::ResultCode result_code) { … }
void PrinterSemanticCapsAndDefaultsResult::DestroyActive() { … }
bool PrinterSemanticCapsAndDefaultsResult::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
PrinterCapsAndInfoResult::PrinterCapsAndInfoResult() : … { … }
PrinterCapsAndInfoResult::~PrinterCapsAndInfoResult() { … }
void PrinterCapsAndInfoResult::set_printer_caps_and_info(
PrinterCapsAndInfoPtr printer_caps_and_info) { … }
void PrinterCapsAndInfoResult::set_result_code(
::printing::mojom::ResultCode result_code) { … }
void PrinterCapsAndInfoResult::DestroyActive() { … }
bool PrinterCapsAndInfoResult::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
PrintSettingsResult::PrintSettingsResult() : … { … }
PrintSettingsResult::~PrintSettingsResult() { … }
void PrintSettingsResult::set_settings(
const ::printing::PrintSettings& settings) { … }
void PrintSettingsResult::set_result_code(
::printing::mojom::ResultCode result_code) { … }
void PrintSettingsResult::DestroyActive() { … }
bool PrintSettingsResult::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
const char UnsandboxedPrintBackendHost::Name_[] = …;
UnsandboxedPrintBackendHost::IPCStableHashFunction UnsandboxedPrintBackendHost::MessageToMethodInfo_(mojo::Message& message) { … }
const char* UnsandboxedPrintBackendHost::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t UnsandboxedPrintBackendHost::BindBackend_Sym::IPCStableHash() { … }
# endif
UnsandboxedPrintBackendHostProxy::UnsandboxedPrintBackendHostProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void UnsandboxedPrintBackendHostProxy::BindBackend(
::mojo::PendingReceiver<PrintBackendService> in_service) { … }
bool UnsandboxedPrintBackendHostStubDispatch::Accept(
UnsandboxedPrintBackendHost* impl,
mojo::Message* message) { … }
bool UnsandboxedPrintBackendHostStubDispatch::AcceptWithResponder(
UnsandboxedPrintBackendHost* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kUnsandboxedPrintBackendHostValidationInfo[] = …;
bool UnsandboxedPrintBackendHostRequestValidator::Accept(mojo::Message* message) { … }
const char SandboxedPrintBackendHost::Name_[] = …;
SandboxedPrintBackendHost::IPCStableHashFunction SandboxedPrintBackendHost::MessageToMethodInfo_(mojo::Message& message) { … }
const char* SandboxedPrintBackendHost::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t SandboxedPrintBackendHost::BindBackend_Sym::IPCStableHash() { … }
# endif
SandboxedPrintBackendHostProxy::SandboxedPrintBackendHostProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void SandboxedPrintBackendHostProxy::BindBackend(
::mojo::PendingReceiver<PrintBackendService> in_service) { … }
bool SandboxedPrintBackendHostStubDispatch::Accept(
SandboxedPrintBackendHost* impl,
mojo::Message* message) { … }
bool SandboxedPrintBackendHostStubDispatch::AcceptWithResponder(
SandboxedPrintBackendHost* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kSandboxedPrintBackendHostValidationInfo[] = …;
bool SandboxedPrintBackendHostRequestValidator::Accept(mojo::Message* message) { … }
const char PrintBackendService::Name_[] = …;
PrintBackendService::IPCStableHashFunction PrintBackendService::MessageToMethodInfo_(mojo::Message& message) { … }
const char* PrintBackendService::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t PrintBackendService::Init_Sym::IPCStableHash() { … }
uint32_t PrintBackendService::Poke_Sym::IPCStableHash() { … }
uint32_t PrintBackendService::EnumeratePrinters_Sym::IPCStableHash() { … }
uint32_t PrintBackendService::GetDefaultPrinterName_Sym::IPCStableHash() { … }
uint32_t PrintBackendService::FetchCapabilities_Sym::IPCStableHash() { … }
uint32_t PrintBackendService::EstablishPrintingContext_Sym::IPCStableHash() { … }
uint32_t PrintBackendService::UseDefaultSettings_Sym::IPCStableHash() { … }
uint32_t PrintBackendService::UpdatePrintSettings_Sym::IPCStableHash() { … }
uint32_t PrintBackendService::StartPrinting_Sym::IPCStableHash() { … }
uint32_t PrintBackendService::RenderPrintedDocument_Sym::IPCStableHash() { … }
uint32_t PrintBackendService::DocumentDone_Sym::IPCStableHash() { … }
uint32_t PrintBackendService::Cancel_Sym::IPCStableHash() { … }
# endif
class PrintBackendService_EnumeratePrinters_ForwardToCallback
: public mojo::MessageReceiver { … };
class PrintBackendService_GetDefaultPrinterName_ForwardToCallback
: public mojo::MessageReceiver { … };
class PrintBackendService_FetchCapabilities_ForwardToCallback
: public mojo::MessageReceiver { … };
class PrintBackendService_UseDefaultSettings_ForwardToCallback
: public mojo::MessageReceiver { … };
class PrintBackendService_UpdatePrintSettings_ForwardToCallback
: public mojo::MessageReceiver { … };
class PrintBackendService_StartPrinting_ForwardToCallback
: public mojo::MessageReceiver { … };
class PrintBackendService_RenderPrintedDocument_ForwardToCallback
: public mojo::MessageReceiver { … };
class PrintBackendService_DocumentDone_ForwardToCallback
: public mojo::MessageReceiver { … };
class PrintBackendService_Cancel_ForwardToCallback
: public mojo::MessageReceiver { … };
PrintBackendServiceProxy::PrintBackendServiceProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void PrintBackendServiceProxy::Init(
const std::string& in_locale) { … }
void PrintBackendServiceProxy::Poke(
) { … }
void PrintBackendServiceProxy::EnumeratePrinters(
EnumeratePrintersCallback callback) { … }
void PrintBackendServiceProxy::GetDefaultPrinterName(
GetDefaultPrinterNameCallback callback) { … }
void PrintBackendServiceProxy::FetchCapabilities(
const std::string& in_printer_name, FetchCapabilitiesCallback callback) { … }
void PrintBackendServiceProxy::EstablishPrintingContext(
uint32_t in_context_id) { … }
void PrintBackendServiceProxy::UseDefaultSettings(
uint32_t in_context_id, UseDefaultSettingsCallback callback) { … }
void PrintBackendServiceProxy::UpdatePrintSettings(
uint32_t in_context_id, ::base::Value::Dict in_job_settings, UpdatePrintSettingsCallback callback) { … }
void PrintBackendServiceProxy::StartPrinting(
uint32_t in_context_id, int32_t in_document_cookie, const ::std::u16string& in_document_name, const std::optional<::printing::PrintSettings>& in_settings, StartPrintingCallback callback) { … }
void PrintBackendServiceProxy::RenderPrintedDocument(
int32_t in_document_cookie, uint32_t in_page_count, ::printing::mojom::MetafileDataType in_data_type, ::base::ReadOnlySharedMemoryRegion in_serialized_doc, RenderPrintedDocumentCallback callback) { … }
void PrintBackendServiceProxy::DocumentDone(
int32_t in_document_cookie, DocumentDoneCallback callback) { … }
void PrintBackendServiceProxy::Cancel(
int32_t in_document_cookie, CancelCallback callback) { … }
class PrintBackendService_EnumeratePrinters_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool PrintBackendService_EnumeratePrinters_ForwardToCallback::Accept(
mojo::Message* message) { … }
void PrintBackendService_EnumeratePrinters_ProxyToResponder::Run(
PrinterListResultPtr in_printer_list) { … }
class PrintBackendService_GetDefaultPrinterName_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool PrintBackendService_GetDefaultPrinterName_ForwardToCallback::Accept(
mojo::Message* message) { … }
void PrintBackendService_GetDefaultPrinterName_ProxyToResponder::Run(
DefaultPrinterNameResultPtr in_printer_name) { … }
class PrintBackendService_FetchCapabilities_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool PrintBackendService_FetchCapabilities_ForwardToCallback::Accept(
mojo::Message* message) { … }
void PrintBackendService_FetchCapabilities_ProxyToResponder::Run(
PrinterCapsAndInfoResultPtr in_printer_caps_and_info) { … }
class PrintBackendService_UseDefaultSettings_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool PrintBackendService_UseDefaultSettings_ForwardToCallback::Accept(
mojo::Message* message) { … }
void PrintBackendService_UseDefaultSettings_ProxyToResponder::Run(
PrintSettingsResultPtr in_settings) { … }
class PrintBackendService_UpdatePrintSettings_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool PrintBackendService_UpdatePrintSettings_ForwardToCallback::Accept(
mojo::Message* message) { … }
void PrintBackendService_UpdatePrintSettings_ProxyToResponder::Run(
PrintSettingsResultPtr in_settings) { … }
class PrintBackendService_StartPrinting_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool PrintBackendService_StartPrinting_ForwardToCallback::Accept(
mojo::Message* message) { … }
void PrintBackendService_StartPrinting_ProxyToResponder::Run(
::printing::mojom::ResultCode in_result_code, int32_t in_job_id) { … }
class PrintBackendService_RenderPrintedDocument_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool PrintBackendService_RenderPrintedDocument_ForwardToCallback::Accept(
mojo::Message* message) { … }
void PrintBackendService_RenderPrintedDocument_ProxyToResponder::Run(
::printing::mojom::ResultCode in_result_code) { … }
class PrintBackendService_DocumentDone_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool PrintBackendService_DocumentDone_ForwardToCallback::Accept(
mojo::Message* message) { … }
void PrintBackendService_DocumentDone_ProxyToResponder::Run(
::printing::mojom::ResultCode in_result_code) { … }
class PrintBackendService_Cancel_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool PrintBackendService_Cancel_ForwardToCallback::Accept(
mojo::Message* message) { … }
void PrintBackendService_Cancel_ProxyToResponder::Run(
) { … }
bool PrintBackendServiceStubDispatch::Accept(
PrintBackendService* impl,
mojo::Message* message) { … }
bool PrintBackendServiceStubDispatch::AcceptWithResponder(
PrintBackendService* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kPrintBackendServiceValidationInfo[] = …;
bool PrintBackendServiceRequestValidator::Accept(mojo::Message* message) { … }
bool PrintBackendServiceResponseValidator::Accept(mojo::Message* message) { … }
}
namespace mojo {
bool StructTraits<::printing::mojom::PrinterCapsAndInfo::DataView, ::printing::mojom::PrinterCapsAndInfoPtr>::Read(
::printing::mojom::PrinterCapsAndInfo::DataView input,
::printing::mojom::PrinterCapsAndInfoPtr* output) { … }
bool UnionTraits<::printing::mojom::DefaultPrinterNameResult::DataView, ::printing::mojom::DefaultPrinterNameResultPtr>::Read(
::printing::mojom::DefaultPrinterNameResult::DataView input,
::printing::mojom::DefaultPrinterNameResultPtr* output) { … }
bool UnionTraits<::printing::mojom::PrinterListResult::DataView, ::printing::mojom::PrinterListResultPtr>::Read(
::printing::mojom::PrinterListResult::DataView input,
::printing::mojom::PrinterListResultPtr* output) { … }
bool UnionTraits<::printing::mojom::PrinterSemanticCapsAndDefaultsResult::DataView, ::printing::mojom::PrinterSemanticCapsAndDefaultsResultPtr>::Read(
::printing::mojom::PrinterSemanticCapsAndDefaultsResult::DataView input,
::printing::mojom::PrinterSemanticCapsAndDefaultsResultPtr* output) { … }
bool UnionTraits<::printing::mojom::PrinterCapsAndInfoResult::DataView, ::printing::mojom::PrinterCapsAndInfoResultPtr>::Read(
::printing::mojom::PrinterCapsAndInfoResult::DataView input,
::printing::mojom::PrinterCapsAndInfoResultPtr* output) { … }
bool UnionTraits<::printing::mojom::PrintSettingsResult::DataView, ::printing::mojom::PrintSettingsResultPtr>::Read(
::printing::mojom::PrintSettingsResult::DataView input,
::printing::mojom::PrintSettingsResultPtr* output) { … }
}
namespace printing::mojom {
void UnsandboxedPrintBackendHostInterceptorForTesting::BindBackend(::mojo::PendingReceiver<PrintBackendService> service) { … }
UnsandboxedPrintBackendHostAsyncWaiter::UnsandboxedPrintBackendHostAsyncWaiter(
UnsandboxedPrintBackendHost* proxy) : … { … }
UnsandboxedPrintBackendHostAsyncWaiter::~UnsandboxedPrintBackendHostAsyncWaiter() = default;
void SandboxedPrintBackendHostInterceptorForTesting::BindBackend(::mojo::PendingReceiver<PrintBackendService> service) { … }
SandboxedPrintBackendHostAsyncWaiter::SandboxedPrintBackendHostAsyncWaiter(
SandboxedPrintBackendHost* proxy) : … { … }
SandboxedPrintBackendHostAsyncWaiter::~SandboxedPrintBackendHostAsyncWaiter() = default;
void PrintBackendServiceInterceptorForTesting::Init(const std::string& locale) { … }
void PrintBackendServiceInterceptorForTesting::Poke() { … }
void PrintBackendServiceInterceptorForTesting::EnumeratePrinters(EnumeratePrintersCallback callback) { … }
void PrintBackendServiceInterceptorForTesting::GetDefaultPrinterName(GetDefaultPrinterNameCallback callback) { … }
void PrintBackendServiceInterceptorForTesting::FetchCapabilities(const std::string& printer_name, FetchCapabilitiesCallback callback) { … }
void PrintBackendServiceInterceptorForTesting::EstablishPrintingContext(uint32_t context_id) { … }
void PrintBackendServiceInterceptorForTesting::UseDefaultSettings(uint32_t context_id, UseDefaultSettingsCallback callback) { … }
void PrintBackendServiceInterceptorForTesting::UpdatePrintSettings(uint32_t context_id, ::base::Value::Dict job_settings, UpdatePrintSettingsCallback callback) { … }
void PrintBackendServiceInterceptorForTesting::StartPrinting(uint32_t context_id, int32_t document_cookie, const ::std::u16string& document_name, const std::optional<::printing::PrintSettings>& settings, StartPrintingCallback callback) { … }
void PrintBackendServiceInterceptorForTesting::RenderPrintedDocument(int32_t document_cookie, uint32_t page_count, ::printing::mojom::MetafileDataType data_type, ::base::ReadOnlySharedMemoryRegion serialized_doc, RenderPrintedDocumentCallback callback) { … }
void PrintBackendServiceInterceptorForTesting::DocumentDone(int32_t document_cookie, DocumentDoneCallback callback) { … }
void PrintBackendServiceInterceptorForTesting::Cancel(int32_t document_cookie, CancelCallback callback) { … }
PrintBackendServiceAsyncWaiter::PrintBackendServiceAsyncWaiter(
PrintBackendService* proxy) : … { … }
PrintBackendServiceAsyncWaiter::~PrintBackendServiceAsyncWaiter() = default;
void PrintBackendServiceAsyncWaiter::EnumeratePrinters(
PrinterListResultPtr* out_printer_list) { … }
PrinterListResultPtr PrintBackendServiceAsyncWaiter::EnumeratePrinters(
) { … }
void PrintBackendServiceAsyncWaiter::GetDefaultPrinterName(
DefaultPrinterNameResultPtr* out_printer_name) { … }
DefaultPrinterNameResultPtr PrintBackendServiceAsyncWaiter::GetDefaultPrinterName(
) { … }
void PrintBackendServiceAsyncWaiter::FetchCapabilities(
const std::string& printer_name, PrinterCapsAndInfoResultPtr* out_printer_caps_and_info) { … }
PrinterCapsAndInfoResultPtr PrintBackendServiceAsyncWaiter::FetchCapabilities(
const std::string& printer_name) { … }
void PrintBackendServiceAsyncWaiter::UseDefaultSettings(
uint32_t context_id, PrintSettingsResultPtr* out_settings) { … }
PrintSettingsResultPtr PrintBackendServiceAsyncWaiter::UseDefaultSettings(
uint32_t context_id) { … }
void PrintBackendServiceAsyncWaiter::UpdatePrintSettings(
uint32_t context_id, ::base::Value::Dict job_settings, PrintSettingsResultPtr* out_settings) { … }
PrintSettingsResultPtr PrintBackendServiceAsyncWaiter::UpdatePrintSettings(
uint32_t context_id, ::base::Value::Dict job_settings) { … }
void PrintBackendServiceAsyncWaiter::StartPrinting(
uint32_t context_id, int32_t document_cookie, const ::std::u16string& document_name, const std::optional<::printing::PrintSettings>& settings, ::printing::mojom::ResultCode* out_result_code, int32_t* out_job_id) { … }
void PrintBackendServiceAsyncWaiter::RenderPrintedDocument(
int32_t document_cookie, uint32_t page_count, ::printing::mojom::MetafileDataType data_type, ::base::ReadOnlySharedMemoryRegion serialized_doc, ::printing::mojom::ResultCode* out_result_code) { … }
::printing::mojom::ResultCode PrintBackendServiceAsyncWaiter::RenderPrintedDocument(
int32_t document_cookie, uint32_t page_count, ::printing::mojom::MetafileDataType data_type, ::base::ReadOnlySharedMemoryRegion serialized_doc) { … }
void PrintBackendServiceAsyncWaiter::DocumentDone(
int32_t document_cookie, ::printing::mojom::ResultCode* out_result_code) { … }
::printing::mojom::ResultCode PrintBackendServiceAsyncWaiter::DocumentDone(
int32_t document_cookie) { … }
void PrintBackendServiceAsyncWaiter::Cancel(
int32_t document_cookie) { … }
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif