blob: 6d3e7e89706c3a833bf7669ddeb9696e48e46e85 [file] [log] [blame]
// media/mojo/mojom/cdm_document_service.mojom-blink.cc is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2013 The Chromium Authors. All rights reserved.
// 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 "media/mojo/mojom/cdm_document_service.mojom-blink.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/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.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/send_message_helper.h"
#include "mojo/public/cpp/bindings/lib/proxy_to_responder.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/interfaces/bindings/interface_control_messages.mojom.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
#include "media/mojo/mojom/cdm_document_service.mojom-params-data.h"
#include "media/mojo/mojom/cdm_document_service.mojom-shared-message-ids.h"
#include "media/mojo/mojom/cdm_document_service.mojom-blink-import-headers.h"
#include "media/mojo/mojom/cdm_document_service.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"
#ifndef MEDIA_MOJO_MOJOM_CDM_DOCUMENT_SERVICE_MOJOM_BLINK_JUMBO_H_
#define MEDIA_MOJO_MOJOM_CDM_DOCUMENT_SERVICE_MOJOM_BLINK_JUMBO_H_
#endif
namespace media {
namespace mojom {
namespace blink {
const char CdmDocumentService::Name_[] = "media.mojom.CdmDocumentService";
std::pair<uint32_t, const void*> CdmDocumentService::MessageToMethodInfo_(mojo::Message& message) {
switch (message.name()) {
case internal::kCdmDocumentService_ChallengePlatform_Name: {
constexpr uint32_t value = base::MD5Hash32Constexpr(
"(Impl)media::mojom::CdmDocumentService::ChallengePlatform");
#if BUILDFLAG(IS_FUCHSIA)
return std::make_pair(value, nullptr);
#else
return std::make_pair(value, reinterpret_cast<const void*>(&CdmDocumentService::ChallengePlatform_Sym::IPCSymbol));
#endif // BUILDFLAG(IS_FUCHSIA)
}
case internal::kCdmDocumentService_GetStorageId_Name: {
constexpr uint32_t value = base::MD5Hash32Constexpr(
"(Impl)media::mojom::CdmDocumentService::GetStorageId");
#if BUILDFLAG(IS_FUCHSIA)
return std::make_pair(value, nullptr);
#else
return std::make_pair(value, reinterpret_cast<const void*>(&CdmDocumentService::GetStorageId_Sym::IPCSymbol));
#endif // BUILDFLAG(IS_FUCHSIA)
}
}
return std::make_pair(0, nullptr);
}
const char* CdmDocumentService::MessageToMethodName_(mojo::Message& message) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
bool is_response = message.has_flag(mojo::Message::kFlagIsResponse);
if (!is_response) {
switch (message.name()) {
case internal::kCdmDocumentService_ChallengePlatform_Name:
return "Receive media::mojom::CdmDocumentService::ChallengePlatform";
case internal::kCdmDocumentService_GetStorageId_Name:
return "Receive media::mojom::CdmDocumentService::GetStorageId";
}
} else {
switch (message.name()) {
case internal::kCdmDocumentService_ChallengePlatform_Name:
return "Receive reply media::mojom::CdmDocumentService::ChallengePlatform";
case internal::kCdmDocumentService_GetStorageId_Name:
return "Receive reply media::mojom::CdmDocumentService::GetStorageId";
}
}
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)
void CdmDocumentService::ChallengePlatform_Sym::IPCSymbol() {
// This method's address is used for indetifiying the mojo method name after
// symblozation. So each IPCSymbol should have a unique address.
NO_CODE_FOLDING();
}
void CdmDocumentService::GetStorageId_Sym::IPCSymbol() {
// This method's address is used for indetifiying the mojo method name after
// symblozation. So each IPCSymbol should have a unique address.
NO_CODE_FOLDING();
}
# endif // !BUILDFLAG(IS_FUCHSIA)
class CdmDocumentService_ChallengePlatform_ForwardToCallback
: public mojo::MessageReceiver {
public:
CdmDocumentService_ChallengePlatform_ForwardToCallback(
CdmDocumentService::ChallengePlatformCallback callback
) : callback_(std::move(callback)) {
}
CdmDocumentService_ChallengePlatform_ForwardToCallback(const CdmDocumentService_ChallengePlatform_ForwardToCallback&) = delete;
CdmDocumentService_ChallengePlatform_ForwardToCallback& operator=(const CdmDocumentService_ChallengePlatform_ForwardToCallback&) = delete;
bool Accept(mojo::Message* message) override;
private:
CdmDocumentService::ChallengePlatformCallback callback_;
};
class CdmDocumentService_GetStorageId_ForwardToCallback
: public mojo::MessageReceiver {
public:
CdmDocumentService_GetStorageId_ForwardToCallback(
CdmDocumentService::GetStorageIdCallback callback
) : callback_(std::move(callback)) {
}
CdmDocumentService_GetStorageId_ForwardToCallback(const CdmDocumentService_GetStorageId_ForwardToCallback&) = delete;
CdmDocumentService_GetStorageId_ForwardToCallback& operator=(const CdmDocumentService_GetStorageId_ForwardToCallback&) = delete;
bool Accept(mojo::Message* message) override;
private:
CdmDocumentService::GetStorageIdCallback callback_;
};
CdmDocumentServiceProxy::CdmDocumentServiceProxy(mojo::MessageReceiverWithResponder* receiver)
: receiver_(receiver) {
}
void CdmDocumentServiceProxy::ChallengePlatform(
const WTF::String& in_service_id, const WTF::String& in_challenge, ChallengePlatformCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send media::mojom::CdmDocumentService::ChallengePlatform", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("service_id"), in_service_id,
"<value of type const WTF::String&>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("challenge"), in_challenge,
"<value of type const WTF::String&>");
});
#endif
const bool kExpectsResponse = true;
const bool kIsSync = false;
const bool kAllowInterrupt = true;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt);
mojo::Message message(
internal::kCdmDocumentService_ChallengePlatform_Name, kFlags, 0, 0, nullptr);
mojo::internal::MessageFragment<
::media::mojom::internal::CdmDocumentService_ChallengePlatform_Params_Data> params(
message);
params.Allocate();
mojo::internal::MessageFragment<
typename decltype(params->service_id)::BaseType> service_id_fragment(
params.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_service_id, service_id_fragment);
params->service_id.Set(
service_id_fragment.is_null() ? nullptr : service_id_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
params->service_id.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null service_id in CdmDocumentService.ChallengePlatform request");
mojo::internal::MessageFragment<
typename decltype(params->challenge)::BaseType> challenge_fragment(
params.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_challenge, challenge_fragment);
params->challenge.Set(
challenge_fragment.is_null() ? nullptr : challenge_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
params->challenge.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null challenge in CdmDocumentService.ChallengePlatform request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CdmDocumentService::Name_);
message.set_method_name("ChallengePlatform");
#endif
std::unique_ptr<mojo::MessageReceiver> responder(
new CdmDocumentService_ChallengePlatform_ForwardToCallback(
std::move(callback)));
::mojo::internal::SendMessage(*receiver_, message, std::move(responder));
}
void CdmDocumentServiceProxy::GetStorageId(
uint32_t in_version, GetStorageIdCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send media::mojom::CdmDocumentService::GetStorageId", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("version"), in_version,
"<value of type uint32_t>");
});
#endif
const bool kExpectsResponse = true;
const bool kIsSync = false;
const bool kAllowInterrupt = true;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt);
mojo::Message message(
internal::kCdmDocumentService_GetStorageId_Name, kFlags, 0, 0, nullptr);
mojo::internal::MessageFragment<
::media::mojom::internal::CdmDocumentService_GetStorageId_Params_Data> params(
message);
params.Allocate();
params->version = in_version;
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CdmDocumentService::Name_);
message.set_method_name("GetStorageId");
#endif
std::unique_ptr<mojo::MessageReceiver> responder(
new CdmDocumentService_GetStorageId_ForwardToCallback(
std::move(callback)));
::mojo::internal::SendMessage(*receiver_, message, std::move(responder));
}
class CdmDocumentService_ChallengePlatform_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
public:
static CdmDocumentService::ChallengePlatformCallback CreateCallback(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
std::unique_ptr<CdmDocumentService_ChallengePlatform_ProxyToResponder> proxy(
new CdmDocumentService_ChallengePlatform_ProxyToResponder(
message, std::move(responder)));
return base::BindOnce(&CdmDocumentService_ChallengePlatform_ProxyToResponder::Run,
std::move(proxy));
}
~CdmDocumentService_ChallengePlatform_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.
responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete));
}
#endif
}
private:
CdmDocumentService_ChallengePlatform_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)
<< "CdmDocumentService::ChallengePlatformCallback 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_success, const WTF::String& in_signed_data, const WTF::String& in_signed_data_signature, const WTF::String& in_platform_key_certificate);
};
bool CdmDocumentService_ChallengePlatform_ForwardToCallback::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::CdmDocumentService_ChallengePlatform_ResponseParams_Data* params =
reinterpret_cast<
internal::CdmDocumentService_ChallengePlatform_ResponseParams_Data*>(
message->mutable_payload());
bool success = true;
bool p_success{};
WTF::String p_signed_data{};
WTF::String p_signed_data_signature{};
WTF::String p_platform_key_certificate{};
CdmDocumentService_ChallengePlatform_ResponseParamsDataView input_data_view(params, message);
if (success)
p_success = input_data_view.success();
if (success && !input_data_view.ReadSignedData(&p_signed_data))
success = false;
if (success && !input_data_view.ReadSignedDataSignature(&p_signed_data_signature))
success = false;
if (success && !input_data_view.ReadPlatformKeyCertificate(&p_platform_key_certificate))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CdmDocumentService::Name_, 0, true);
return false;
}
if (!callback_.is_null())
std::move(callback_).Run(
std::move(p_success),
std::move(p_signed_data),
std::move(p_signed_data_signature),
std::move(p_platform_key_certificate));
return true;
}
void CdmDocumentService_ChallengePlatform_ProxyToResponder::Run(
bool in_success, const WTF::String& in_signed_data, const WTF::String& in_signed_data_signature, const WTF::String& in_platform_key_certificate) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send reply media::mojom::CdmDocumentService::ChallengePlatform", "async_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("success"), in_success,
"<value of type bool>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("signed_data"), in_signed_data,
"<value of type const WTF::String&>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("signed_data_signature"), in_signed_data_signature,
"<value of type const WTF::String&>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("platform_key_certificate"), in_platform_key_certificate,
"<value of type const WTF::String&>");
});
#endif
const uint32_t kFlags = mojo::Message::kFlagIsResponse |
((is_sync_) ? mojo::Message::kFlagIsSync : 0) |
((true) ? 0 : mojo::Message::kFlagNoInterrupt);
mojo::Message message(
internal::kCdmDocumentService_ChallengePlatform_Name, kFlags, 0, 0, nullptr);
mojo::internal::MessageFragment<
::media::mojom::internal::CdmDocumentService_ChallengePlatform_ResponseParams_Data> params(
message);
params.Allocate();
params->success = in_success;
mojo::internal::MessageFragment<
typename decltype(params->signed_data)::BaseType> signed_data_fragment(
params.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_signed_data, signed_data_fragment);
params->signed_data.Set(
signed_data_fragment.is_null() ? nullptr : signed_data_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
params->signed_data.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null signed_data in ");
mojo::internal::MessageFragment<
typename decltype(params->signed_data_signature)::BaseType> signed_data_signature_fragment(
params.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_signed_data_signature, signed_data_signature_fragment);
params->signed_data_signature.Set(
signed_data_signature_fragment.is_null() ? nullptr : signed_data_signature_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
params->signed_data_signature.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null signed_data_signature in ");
mojo::internal::MessageFragment<
typename decltype(params->platform_key_certificate)::BaseType> platform_key_certificate_fragment(
params.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_platform_key_certificate, platform_key_certificate_fragment);
params->platform_key_certificate.Set(
platform_key_certificate_fragment.is_null() ? nullptr : platform_key_certificate_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
params->platform_key_certificate.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null platform_key_certificate in ");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CdmDocumentService::Name_);
message.set_method_name("ChallengePlatform");
#endif
message.set_request_id(request_id_);
message.set_trace_nonce(trace_nonce_);
::mojo::internal::SendMessage(*responder_, message);
// SendMessage 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 CdmDocumentService_GetStorageId_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
public:
static CdmDocumentService::GetStorageIdCallback CreateCallback(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
std::unique_ptr<CdmDocumentService_GetStorageId_ProxyToResponder> proxy(
new CdmDocumentService_GetStorageId_ProxyToResponder(
message, std::move(responder)));
return base::BindOnce(&CdmDocumentService_GetStorageId_ProxyToResponder::Run,
std::move(proxy));
}
~CdmDocumentService_GetStorageId_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.
responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete));
}
#endif
}
private:
CdmDocumentService_GetStorageId_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)
<< "CdmDocumentService::GetStorageIdCallback 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(
uint32_t in_version, const WTF::Vector<uint8_t>& in_storage_id);
};
bool CdmDocumentService_GetStorageId_ForwardToCallback::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::CdmDocumentService_GetStorageId_ResponseParams_Data* params =
reinterpret_cast<
internal::CdmDocumentService_GetStorageId_ResponseParams_Data*>(
message->mutable_payload());
bool success = true;
uint32_t p_version{};
WTF::Vector<uint8_t> p_storage_id{};
CdmDocumentService_GetStorageId_ResponseParamsDataView input_data_view(params, message);
if (success)
p_version = input_data_view.version();
if (success && !input_data_view.ReadStorageId(&p_storage_id))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CdmDocumentService::Name_, 1, true);
return false;
}
if (!callback_.is_null())
std::move(callback_).Run(
std::move(p_version),
std::move(p_storage_id));
return true;
}
void CdmDocumentService_GetStorageId_ProxyToResponder::Run(
uint32_t in_version, const WTF::Vector<uint8_t>& in_storage_id) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send reply media::mojom::CdmDocumentService::GetStorageId", "async_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("version"), in_version,
"<value of type uint32_t>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("storage_id"), in_storage_id,
"<value of type const WTF::Vector<uint8_t>&>");
});
#endif
const uint32_t kFlags = mojo::Message::kFlagIsResponse |
((is_sync_) ? mojo::Message::kFlagIsSync : 0) |
((true) ? 0 : mojo::Message::kFlagNoInterrupt);
mojo::Message message(
internal::kCdmDocumentService_GetStorageId_Name, kFlags, 0, 0, nullptr);
mojo::internal::MessageFragment<
::media::mojom::internal::CdmDocumentService_GetStorageId_ResponseParams_Data> params(
message);
params.Allocate();
params->version = in_version;
mojo::internal::MessageFragment<
typename decltype(params->storage_id)::BaseType>
storage_id_fragment(params.message());
const mojo::internal::ContainerValidateParams storage_id_validate_params(
0, false, nullptr);
mojo::internal::Serialize<mojo::ArrayDataView<uint8_t>>(
in_storage_id, storage_id_fragment, &storage_id_validate_params);
params->storage_id.Set(
storage_id_fragment.is_null() ? nullptr : storage_id_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
params->storage_id.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null storage_id in ");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CdmDocumentService::Name_);
message.set_method_name("GetStorageId");
#endif
message.set_request_id(request_id_);
message.set_trace_nonce(trace_nonce_);
::mojo::internal::SendMessage(*responder_, message);
// SendMessage 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 CdmDocumentServiceStubDispatch::Accept(
CdmDocumentService* impl,
mojo::Message* message) {
switch (message->header()->name) {
case internal::kCdmDocumentService_ChallengePlatform_Name: {
break;
}
case internal::kCdmDocumentService_GetStorageId_Name: {
break;
}
}
return false;
}
// static
bool CdmDocumentServiceStubDispatch::AcceptWithResponder(
CdmDocumentService* 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 (message->header()->name) {
case internal::kCdmDocumentService_ChallengePlatform_Name: {
internal::CdmDocumentService_ChallengePlatform_Params_Data* params =
reinterpret_cast<
internal::CdmDocumentService_ChallengePlatform_Params_Data*>(
message->mutable_payload());
bool success = true;
WTF::String p_service_id{};
WTF::String p_challenge{};
CdmDocumentService_ChallengePlatform_ParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadServiceId(&p_service_id))
success = false;
if (success && !input_data_view.ReadChallenge(&p_challenge))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CdmDocumentService::Name_, 0, false);
return false;
}
CdmDocumentService::ChallengePlatformCallback callback =
CdmDocumentService_ChallengePlatform_ProxyToResponder::CreateCallback(
*message, std::move(responder));
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->ChallengePlatform(
std::move(p_service_id),
std::move(p_challenge), std::move(callback));
return true;
}
case internal::kCdmDocumentService_GetStorageId_Name: {
internal::CdmDocumentService_GetStorageId_Params_Data* params =
reinterpret_cast<
internal::CdmDocumentService_GetStorageId_Params_Data*>(
message->mutable_payload());
bool success = true;
uint32_t p_version{};
CdmDocumentService_GetStorageId_ParamsDataView input_data_view(params, message);
if (success)
p_version = input_data_view.version();
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CdmDocumentService::Name_, 1, false);
return false;
}
CdmDocumentService::GetStorageIdCallback callback =
CdmDocumentService_GetStorageId_ProxyToResponder::CreateCallback(
*message, std::move(responder));
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->GetStorageId(
std::move(p_version), std::move(callback));
return true;
}
}
return false;
}
static const mojo::internal::GenericValidationInfo kCdmDocumentServiceValidationInfo[] = {
{&internal::CdmDocumentService_ChallengePlatform_Params_Data::Validate,
&internal::CdmDocumentService_ChallengePlatform_ResponseParams_Data::Validate},
{&internal::CdmDocumentService_GetStorageId_Params_Data::Validate,
&internal::CdmDocumentService_GetStorageId_ResponseParams_Data::Validate},
};
bool CdmDocumentServiceRequestValidator::Accept(mojo::Message* message) {
const char* name = ::media::mojom::blink::CdmDocumentService::Name_;
return mojo::internal::ValidateRequestGenericPacked(message, name, kCdmDocumentServiceValidationInfo);
}
bool CdmDocumentServiceResponseValidator::Accept(mojo::Message* message) {
const char* name = ::media::mojom::blink::CdmDocumentService::Name_;
return mojo::internal::ValidateResponseGenericPacked(message, name, kCdmDocumentServiceValidationInfo);
}
} // namespace blink
} // namespace mojom
} // namespace media
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 media {
namespace mojom {
namespace blink {
void CdmDocumentServiceInterceptorForTesting::ChallengePlatform(const WTF::String& service_id, const WTF::String& challenge, ChallengePlatformCallback callback) {
GetForwardingInterface()->ChallengePlatform(std::move(service_id), std::move(challenge), std::move(callback));
}
void CdmDocumentServiceInterceptorForTesting::GetStorageId(uint32_t version, GetStorageIdCallback callback) {
GetForwardingInterface()->GetStorageId(std::move(version), std::move(callback));
}
CdmDocumentServiceAsyncWaiter::CdmDocumentServiceAsyncWaiter(
CdmDocumentService* proxy) : proxy_(proxy) {}
CdmDocumentServiceAsyncWaiter::~CdmDocumentServiceAsyncWaiter() = default;
void CdmDocumentServiceAsyncWaiter::ChallengePlatform(
const WTF::String& service_id, const WTF::String& challenge, bool* out_success, WTF::String* out_signed_data, WTF::String* out_signed_data_signature, WTF::String* out_platform_key_certificate) {
base::RunLoop loop;
proxy_->ChallengePlatform(std::move(service_id),std::move(challenge),
base::BindOnce(
[](base::RunLoop* loop,
bool* out_success
,
WTF::String* out_signed_data
,
WTF::String* out_signed_data_signature
,
WTF::String* out_platform_key_certificate
,
bool success,
const WTF::String& signed_data,
const WTF::String& signed_data_signature,
const WTF::String& platform_key_certificate) {*out_success = std::move(success);*out_signed_data = std::move(signed_data);*out_signed_data_signature = std::move(signed_data_signature);*out_platform_key_certificate = std::move(platform_key_certificate);
loop->Quit();
},
&loop,
out_success,
out_signed_data,
out_signed_data_signature,
out_platform_key_certificate));
loop.Run();
}
void CdmDocumentServiceAsyncWaiter::GetStorageId(
uint32_t version, uint32_t* out_version, WTF::Vector<uint8_t>* out_storage_id) {
base::RunLoop loop;
proxy_->GetStorageId(std::move(version),
base::BindOnce(
[](base::RunLoop* loop,
uint32_t* out_version
,
WTF::Vector<uint8_t>* out_storage_id
,
uint32_t version,
const WTF::Vector<uint8_t>& storage_id) {*out_version = std::move(version);*out_storage_id = std::move(storage_id);
loop->Quit();
},
&loop,
out_version,
out_storage_id));
loop.Run();
}
} // namespace blink
} // namespace mojom
} // namespace media
#if defined(__clang__)
#pragma clang diagnostic pop
#endif