blob: 0fdba424c3dacf045517dcdabb4e8cf69b33f416 [file] [log] [blame]
// media/capture/video/chromeos/mojom/cros_camera_service.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 "media/capture/video/chromeos/mojom/cros_camera_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 "media/capture/video/chromeos/mojom/cros_camera_service.mojom-params-data.h"
#include "media/capture/video/chromeos/mojom/cros_camera_service.mojom-shared-message-ids.h"
#include "media/capture/video/chromeos/mojom/cros_camera_service.mojom-import-headers.h"
#include "media/capture/video/chromeos/mojom/cros_camera_service.mojom-test-utils.h"
namespace cros::mojom {
const char CameraHalDispatcher::Name_[] = "cros.mojom.CameraHalDispatcher";
CameraHalDispatcher::IPCStableHashFunction CameraHalDispatcher::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
switch (static_cast<messages::CameraHalDispatcher>(message.name())) {
case messages::CameraHalDispatcher::kRegisterClientWithToken: {
return &CameraHalDispatcher::RegisterClientWithToken_Sym::IPCStableHash;
}
}
#endif // !BUILDFLAG(IS_FUCHSIA)
return nullptr;
}
const char* CameraHalDispatcher::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::CameraHalDispatcher>(message.name())) {
case messages::CameraHalDispatcher::kRegisterClientWithToken:
return "Receive cros::mojom::CameraHalDispatcher::RegisterClientWithToken";
}
} else {
switch (static_cast<messages::CameraHalDispatcher>(message.name())) {
case messages::CameraHalDispatcher::kRegisterClientWithToken:
return "Receive reply cros::mojom::CameraHalDispatcher::RegisterClientWithToken";
}
}
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 CameraHalDispatcher::RegisterClientWithToken_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CameraHalDispatcher::RegisterClientWithToken");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)
class CameraHalDispatcher_RegisterClientWithToken_ForwardToCallback
: public mojo::MessageReceiver {
public:
CameraHalDispatcher_RegisterClientWithToken_ForwardToCallback(
CameraHalDispatcher::RegisterClientWithTokenCallback callback
) : callback_(std::move(callback)) {
}
CameraHalDispatcher_RegisterClientWithToken_ForwardToCallback(const CameraHalDispatcher_RegisterClientWithToken_ForwardToCallback&) = delete;
CameraHalDispatcher_RegisterClientWithToken_ForwardToCallback& operator=(const CameraHalDispatcher_RegisterClientWithToken_ForwardToCallback&) = delete;
bool Accept(mojo::Message* message) override;
private:
CameraHalDispatcher::RegisterClientWithTokenCallback callback_;
};
CameraHalDispatcherProxy::CameraHalDispatcherProxy(mojo::MessageReceiverWithResponder* receiver)
: receiver_(receiver) {
}
void CameraHalDispatcherProxy::RegisterClientWithToken(
::mojo::PendingRemote<::cros::mojom::CameraHalClient> in_client, CameraClientType in_type, const ::base::UnguessableToken& in_auth_token, RegisterClientWithTokenCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send cros::mojom::CameraHalDispatcher::RegisterClientWithToken", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("client"), in_client,
"<value of type ::mojo::PendingRemote<::cros::mojom::CameraHalClient>>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("type"), in_type,
"<value of type CameraClientType>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("auth_token"), in_auth_token,
"<value of type const ::base::UnguessableToken&>");
});
#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(
base::to_underlying(messages::CameraHalDispatcher::kRegisterClientWithToken), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CameraHalDispatcher_RegisterClientWithToken_Params_Data> params(
message);
params.Allocate();
mojo::internal::Serialize<mojo::InterfacePtrDataView<::cros::mojom::CameraHalClientInterfaceBase>>(
in_client, &params->client, &params.message());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
!mojo::internal::IsHandleOrInterfaceValid(params->client),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
"invalid client in CameraHalDispatcher.RegisterClientWithToken request");
mojo::internal::Serialize<::cros::mojom::CameraClientType>(
in_type, &params->type);
mojo::internal::MessageFragment<
typename decltype(params->auth_token)::BaseType> auth_token_fragment(
params.message());
mojo::internal::Serialize<::mojo_base::mojom::UnguessableTokenDataView>(
in_auth_token, auth_token_fragment);
params->auth_token.Set(
auth_token_fragment.is_null() ? nullptr : auth_token_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
params->auth_token.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null auth_token in CameraHalDispatcher.RegisterClientWithToken request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CameraHalDispatcher::Name_);
message.set_method_name("RegisterClientWithToken");
#endif
std::unique_ptr<mojo::MessageReceiver> responder(
new CameraHalDispatcher_RegisterClientWithToken_ForwardToCallback(
std::move(callback)));
::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
}
class CameraHalDispatcher_RegisterClientWithToken_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
public:
static CameraHalDispatcher::RegisterClientWithTokenCallback CreateCallback(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
std::unique_ptr<CameraHalDispatcher_RegisterClientWithToken_ProxyToResponder> proxy(
new CameraHalDispatcher_RegisterClientWithToken_ProxyToResponder(
message, std::move(responder)));
return base::BindOnce(&CameraHalDispatcher_RegisterClientWithToken_ProxyToResponder::Run,
std::move(proxy));
}
~CameraHalDispatcher_RegisterClientWithToken_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:
CameraHalDispatcher_RegisterClientWithToken_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)
<< "CameraHalDispatcher::RegisterClientWithTokenCallback 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(
int32_t in_result);
};
bool CameraHalDispatcher_RegisterClientWithToken_ForwardToCallback::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::CameraHalDispatcher_RegisterClientWithToken_ResponseParams_Data* params =
reinterpret_cast<
internal::CameraHalDispatcher_RegisterClientWithToken_ResponseParams_Data*>(
message->mutable_payload());
// Validation for CameraHalDispatcher.5
bool success = true;
int32_t p_result{};
CameraHalDispatcher_RegisterClientWithToken_ResponseParamsDataView input_data_view(params, message);
if (success)
p_result = input_data_view.result();
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CameraHalDispatcher::Name_, 5, true);
return false;
}
if (!callback_.is_null())
std::move(callback_).Run(
std::move(p_result));
return true;
}
void CameraHalDispatcher_RegisterClientWithToken_ProxyToResponder::Run(
int32_t in_result) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send reply cros::mojom::CameraHalDispatcher::RegisterClientWithToken", "async_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("result"), in_result,
"<value of type int32_t>");
});
#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(
base::to_underlying(messages::CameraHalDispatcher::kRegisterClientWithToken), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CameraHalDispatcher_RegisterClientWithToken_ResponseParams_Data> params(
message);
params.Allocate();
params->result = in_result;
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CameraHalDispatcher::Name_);
message.set_method_name("RegisterClientWithToken");
#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 CameraHalDispatcherStubDispatch::Accept(
CameraHalDispatcher* impl,
mojo::Message* message) {
switch (static_cast<messages::CameraHalDispatcher>(message->header()->name)) {
case messages::CameraHalDispatcher::kRegisterClientWithToken: {
break;
}
}
return false;
}
// static
bool CameraHalDispatcherStubDispatch::AcceptWithResponder(
CameraHalDispatcher* 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::CameraHalDispatcher>(message->header()->name)) {
case messages::CameraHalDispatcher::kRegisterClientWithToken: {
internal::CameraHalDispatcher_RegisterClientWithToken_Params_Data* params =
reinterpret_cast<
internal::CameraHalDispatcher_RegisterClientWithToken_Params_Data*>(
message->mutable_payload());
// Validation for CameraHalDispatcher.5
bool success = true;
::mojo::PendingRemote<::cros::mojom::CameraHalClient> p_client{};
CameraClientType p_type{};
::base::UnguessableToken p_auth_token{};
CameraHalDispatcher_RegisterClientWithToken_ParamsDataView input_data_view(params, message);
if (success) {
p_client =
input_data_view.TakeClient<decltype(p_client)>();
}
if (success && !input_data_view.ReadType(&p_type))
success = false;
if (success && !input_data_view.ReadAuthToken(&p_auth_token))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CameraHalDispatcher::Name_, 5, false);
return false;
}
CameraHalDispatcher::RegisterClientWithTokenCallback callback =
CameraHalDispatcher_RegisterClientWithToken_ProxyToResponder::CreateCallback(
*message, std::move(responder));
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->RegisterClientWithToken(
std::move(p_client),
std::move(p_type),
std::move(p_auth_token), std::move(callback));
return true;
}
}
return false;
}
namespace {
} // namespace
static const std::pair<uint32_t, mojo::internal::GenericValidationInfo> kCameraHalDispatcherValidationInfo[] = {
{base::to_underlying(messages::CameraHalDispatcher::kRegisterClientWithToken),
{ &internal::CameraHalDispatcher_RegisterClientWithToken_Params_Data::Validate,
&internal::CameraHalDispatcher_RegisterClientWithToken_ResponseParams_Data::Validate}},
};
bool CameraHalDispatcherRequestValidator::Accept(mojo::Message* message) {
const char* name = ::cros::mojom::CameraHalDispatcher::Name_;
return mojo::internal::ValidateRequestGeneric(message, name, kCameraHalDispatcherValidationInfo);
}
bool CameraHalDispatcherResponseValidator::Accept(mojo::Message* message) {
const char* name = ::cros::mojom::CameraHalDispatcher::Name_;
return mojo::internal::ValidateResponseGeneric(message, name, kCameraHalDispatcherValidationInfo);
}
const char CrosCameraServiceObserver::Name_[] = "cros.mojom.CrosCameraServiceObserver";
CrosCameraServiceObserver::IPCStableHashFunction CrosCameraServiceObserver::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
switch (static_cast<messages::CrosCameraServiceObserver>(message.name())) {
case messages::CrosCameraServiceObserver::kCameraDeviceActivityChange: {
return &CrosCameraServiceObserver::CameraDeviceActivityChange_Sym::IPCStableHash;
}
case messages::CrosCameraServiceObserver::kCameraPrivacySwitchStateChange: {
return &CrosCameraServiceObserver::CameraPrivacySwitchStateChange_Sym::IPCStableHash;
}
case messages::CrosCameraServiceObserver::kCameraSWPrivacySwitchStateChange: {
return &CrosCameraServiceObserver::CameraSWPrivacySwitchStateChange_Sym::IPCStableHash;
}
case messages::CrosCameraServiceObserver::kCameraEffectChange: {
return &CrosCameraServiceObserver::CameraEffectChange_Sym::IPCStableHash;
}
}
#endif // !BUILDFLAG(IS_FUCHSIA)
return nullptr;
}
const char* CrosCameraServiceObserver::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::CrosCameraServiceObserver>(message.name())) {
case messages::CrosCameraServiceObserver::kCameraDeviceActivityChange:
return "Receive cros::mojom::CrosCameraServiceObserver::CameraDeviceActivityChange";
case messages::CrosCameraServiceObserver::kCameraPrivacySwitchStateChange:
return "Receive cros::mojom::CrosCameraServiceObserver::CameraPrivacySwitchStateChange";
case messages::CrosCameraServiceObserver::kCameraSWPrivacySwitchStateChange:
return "Receive cros::mojom::CrosCameraServiceObserver::CameraSWPrivacySwitchStateChange";
case messages::CrosCameraServiceObserver::kCameraEffectChange:
return "Receive cros::mojom::CrosCameraServiceObserver::CameraEffectChange";
}
} else {
switch (static_cast<messages::CrosCameraServiceObserver>(message.name())) {
case messages::CrosCameraServiceObserver::kCameraDeviceActivityChange:
return "Receive reply cros::mojom::CrosCameraServiceObserver::CameraDeviceActivityChange";
case messages::CrosCameraServiceObserver::kCameraPrivacySwitchStateChange:
return "Receive reply cros::mojom::CrosCameraServiceObserver::CameraPrivacySwitchStateChange";
case messages::CrosCameraServiceObserver::kCameraSWPrivacySwitchStateChange:
return "Receive reply cros::mojom::CrosCameraServiceObserver::CameraSWPrivacySwitchStateChange";
case messages::CrosCameraServiceObserver::kCameraEffectChange:
return "Receive reply cros::mojom::CrosCameraServiceObserver::CameraEffectChange";
}
}
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 CrosCameraServiceObserver::CameraDeviceActivityChange_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CrosCameraServiceObserver::CameraDeviceActivityChange");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t CrosCameraServiceObserver::CameraPrivacySwitchStateChange_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CrosCameraServiceObserver::CameraPrivacySwitchStateChange");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t CrosCameraServiceObserver::CameraSWPrivacySwitchStateChange_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CrosCameraServiceObserver::CameraSWPrivacySwitchStateChange");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t CrosCameraServiceObserver::CameraEffectChange_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CrosCameraServiceObserver::CameraEffectChange");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)
CrosCameraServiceObserverProxy::CrosCameraServiceObserverProxy(mojo::MessageReceiverWithResponder* receiver)
: receiver_(receiver) {
}
void CrosCameraServiceObserverProxy::CameraDeviceActivityChange(
int32_t in_camera_id, bool in_opened, CameraClientType in_type) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send cros::mojom::CrosCameraServiceObserver::CameraDeviceActivityChange", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("camera_id"), in_camera_id,
"<value of type int32_t>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("opened"), in_opened,
"<value of type bool>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("type"), in_type,
"<value of type CameraClientType>");
});
#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(
base::to_underlying(messages::CrosCameraServiceObserver::kCameraDeviceActivityChange), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraServiceObserver_CameraDeviceActivityChange_Params_Data> params(
message);
params.Allocate();
params->camera_id = in_camera_id;
params->opened = in_opened;
mojo::internal::Serialize<::cros::mojom::CameraClientType>(
in_type, &params->type);
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraServiceObserver::Name_);
message.set_method_name("CameraDeviceActivityChange");
#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 CrosCameraServiceObserverProxy::CameraPrivacySwitchStateChange(
CameraPrivacySwitchState in_state, int32_t in_camera_id) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send cros::mojom::CrosCameraServiceObserver::CameraPrivacySwitchStateChange", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("state"), in_state,
"<value of type CameraPrivacySwitchState>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("camera_id"), in_camera_id,
"<value of type int32_t>");
});
#endif
const bool kExpectsResponse = false;
const bool kIsSync = false;
const bool kAllowInterrupt = true;
const bool is_urgent = false;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::CrosCameraServiceObserver::kCameraPrivacySwitchStateChange), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraServiceObserver_CameraPrivacySwitchStateChange_Params_Data> params(
message);
params.Allocate();
mojo::internal::Serialize<::cros::mojom::CameraPrivacySwitchState>(
in_state, &params->state);
params->camera_id = in_camera_id;
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraServiceObserver::Name_);
message.set_method_name("CameraPrivacySwitchStateChange");
#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 CrosCameraServiceObserverProxy::CameraSWPrivacySwitchStateChange(
CameraPrivacySwitchState in_state) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send cros::mojom::CrosCameraServiceObserver::CameraSWPrivacySwitchStateChange", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("state"), in_state,
"<value of type CameraPrivacySwitchState>");
});
#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(
base::to_underlying(messages::CrosCameraServiceObserver::kCameraSWPrivacySwitchStateChange), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraServiceObserver_CameraSWPrivacySwitchStateChange_Params_Data> params(
message);
params.Allocate();
mojo::internal::Serialize<::cros::mojom::CameraPrivacySwitchState>(
in_state, &params->state);
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraServiceObserver::Name_);
message.set_method_name("CameraSWPrivacySwitchStateChange");
#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 CrosCameraServiceObserverProxy::CameraEffectChange(
::cros::mojom::EffectsConfigPtr in_config) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send cros::mojom::CrosCameraServiceObserver::CameraEffectChange", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("config"), in_config,
"<value of type ::cros::mojom::EffectsConfigPtr>");
});
#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(
base::to_underlying(messages::CrosCameraServiceObserver::kCameraEffectChange), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraServiceObserver_CameraEffectChange_Params_Data> params(
message);
params.Allocate();
mojo::internal::MessageFragment<
typename decltype(params->config)::BaseType> config_fragment(
params.message());
mojo::internal::Serialize<::cros::mojom::EffectsConfigDataView>(
in_config, config_fragment);
params->config.Set(
config_fragment.is_null() ? nullptr : config_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
params->config.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null config in CrosCameraServiceObserver.CameraEffectChange request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraServiceObserver::Name_);
message.set_method_name("CameraEffectChange");
#endif
// This return value may be ignored as false implies the Connector has
// encountered an error, which will be visible through other means.
::mojo::internal::SendMojoMessage(*receiver_, message);
}
// static
bool CrosCameraServiceObserverStubDispatch::Accept(
CrosCameraServiceObserver* impl,
mojo::Message* message) {
switch (static_cast<messages::CrosCameraServiceObserver>(message->header()->name)) {
case messages::CrosCameraServiceObserver::kCameraDeviceActivityChange: {
DCHECK(message->is_serialized());
internal::CrosCameraServiceObserver_CameraDeviceActivityChange_Params_Data* params =
reinterpret_cast<internal::CrosCameraServiceObserver_CameraDeviceActivityChange_Params_Data*>(
message->mutable_payload());
// Validation for CrosCameraServiceObserver.0
bool success = true;
int32_t p_camera_id{};
bool p_opened{};
CameraClientType p_type{};
CrosCameraServiceObserver_CameraDeviceActivityChange_ParamsDataView input_data_view(params, message);
if (success)
p_camera_id = input_data_view.camera_id();
if (success)
p_opened = input_data_view.opened();
if (success && !input_data_view.ReadType(&p_type))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraServiceObserver::Name_, 0, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->CameraDeviceActivityChange(
std::move(p_camera_id),
std::move(p_opened),
std::move(p_type));
return true;
}
case messages::CrosCameraServiceObserver::kCameraPrivacySwitchStateChange: {
DCHECK(message->is_serialized());
internal::CrosCameraServiceObserver_CameraPrivacySwitchStateChange_Params_Data* params =
reinterpret_cast<internal::CrosCameraServiceObserver_CameraPrivacySwitchStateChange_Params_Data*>(
message->mutable_payload());
// Validation for CrosCameraServiceObserver.1
bool success = true;
CameraPrivacySwitchState p_state{};
int32_t p_camera_id{};
CrosCameraServiceObserver_CameraPrivacySwitchStateChange_ParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadState(&p_state))
success = false;
if (success)
p_camera_id = input_data_view.camera_id();
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraServiceObserver::Name_, 1, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->CameraPrivacySwitchStateChange(
std::move(p_state),
std::move(p_camera_id));
return true;
}
case messages::CrosCameraServiceObserver::kCameraSWPrivacySwitchStateChange: {
DCHECK(message->is_serialized());
internal::CrosCameraServiceObserver_CameraSWPrivacySwitchStateChange_Params_Data* params =
reinterpret_cast<internal::CrosCameraServiceObserver_CameraSWPrivacySwitchStateChange_Params_Data*>(
message->mutable_payload());
// Validation for CrosCameraServiceObserver.2
bool success = true;
CameraPrivacySwitchState p_state{};
CrosCameraServiceObserver_CameraSWPrivacySwitchStateChange_ParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadState(&p_state))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraServiceObserver::Name_, 2, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->CameraSWPrivacySwitchStateChange(
std::move(p_state));
return true;
}
case messages::CrosCameraServiceObserver::kCameraEffectChange: {
DCHECK(message->is_serialized());
internal::CrosCameraServiceObserver_CameraEffectChange_Params_Data* params =
reinterpret_cast<internal::CrosCameraServiceObserver_CameraEffectChange_Params_Data*>(
message->mutable_payload());
// Validation for CrosCameraServiceObserver.3
bool success = true;
::cros::mojom::EffectsConfigPtr p_config{};
CrosCameraServiceObserver_CameraEffectChange_ParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadConfig(&p_config))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraServiceObserver::Name_, 3, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->CameraEffectChange(
std::move(p_config));
return true;
}
}
return false;
}
// static
bool CrosCameraServiceObserverStubDispatch::AcceptWithResponder(
CrosCameraServiceObserver* 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::CrosCameraServiceObserver>(message->header()->name)) {
case messages::CrosCameraServiceObserver::kCameraDeviceActivityChange: {
break;
}
case messages::CrosCameraServiceObserver::kCameraPrivacySwitchStateChange: {
break;
}
case messages::CrosCameraServiceObserver::kCameraSWPrivacySwitchStateChange: {
break;
}
case messages::CrosCameraServiceObserver::kCameraEffectChange: {
break;
}
}
return false;
}
namespace {
} // namespace
static const mojo::internal::GenericValidationInfo kCrosCameraServiceObserverValidationInfo[] = {
{ &internal::CrosCameraServiceObserver_CameraDeviceActivityChange_Params_Data::Validate,
nullptr /* no response */},
{ &internal::CrosCameraServiceObserver_CameraPrivacySwitchStateChange_Params_Data::Validate,
nullptr /* no response */},
{ &internal::CrosCameraServiceObserver_CameraSWPrivacySwitchStateChange_Params_Data::Validate,
nullptr /* no response */},
{ &internal::CrosCameraServiceObserver_CameraEffectChange_Params_Data::Validate,
nullptr /* no response */},
};
bool CrosCameraServiceObserverRequestValidator::Accept(mojo::Message* message) {
const char* name = ::cros::mojom::CrosCameraServiceObserver::Name_;
return mojo::internal::ValidateRequestGenericPacked(message, name, kCrosCameraServiceObserverValidationInfo);
}
const char CrosCameraService::Name_[] = "cros.mojom.CrosCameraService";
CrosCameraService::IPCStableHashFunction CrosCameraService::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
switch (static_cast<messages::CrosCameraService>(message.name())) {
case messages::CrosCameraService::kGetCameraModule: {
return &CrosCameraService::GetCameraModule_Sym::IPCStableHash;
}
case messages::CrosCameraService::kSetTracingEnabled: {
return &CrosCameraService::SetTracingEnabled_Sym::IPCStableHash;
}
case messages::CrosCameraService::kSetAutoFramingState: {
return &CrosCameraService::SetAutoFramingState_Sym::IPCStableHash;
}
case messages::CrosCameraService::kGetCameraSWPrivacySwitchState: {
return &CrosCameraService::GetCameraSWPrivacySwitchState_Sym::IPCStableHash;
}
case messages::CrosCameraService::kSetCameraSWPrivacySwitchState: {
return &CrosCameraService::SetCameraSWPrivacySwitchState_Sym::IPCStableHash;
}
case messages::CrosCameraService::kGetAutoFramingSupported: {
return &CrosCameraService::GetAutoFramingSupported_Sym::IPCStableHash;
}
case messages::CrosCameraService::kSetCameraEffect: {
return &CrosCameraService::SetCameraEffect_Sym::IPCStableHash;
}
case messages::CrosCameraService::kAddCrosCameraServiceObserver: {
return &CrosCameraService::AddCrosCameraServiceObserver_Sym::IPCStableHash;
}
}
#endif // !BUILDFLAG(IS_FUCHSIA)
return nullptr;
}
const char* CrosCameraService::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::CrosCameraService>(message.name())) {
case messages::CrosCameraService::kGetCameraModule:
return "Receive cros::mojom::CrosCameraService::GetCameraModule";
case messages::CrosCameraService::kSetTracingEnabled:
return "Receive cros::mojom::CrosCameraService::SetTracingEnabled";
case messages::CrosCameraService::kSetAutoFramingState:
return "Receive cros::mojom::CrosCameraService::SetAutoFramingState";
case messages::CrosCameraService::kGetCameraSWPrivacySwitchState:
return "Receive cros::mojom::CrosCameraService::GetCameraSWPrivacySwitchState";
case messages::CrosCameraService::kSetCameraSWPrivacySwitchState:
return "Receive cros::mojom::CrosCameraService::SetCameraSWPrivacySwitchState";
case messages::CrosCameraService::kGetAutoFramingSupported:
return "Receive cros::mojom::CrosCameraService::GetAutoFramingSupported";
case messages::CrosCameraService::kSetCameraEffect:
return "Receive cros::mojom::CrosCameraService::SetCameraEffect";
case messages::CrosCameraService::kAddCrosCameraServiceObserver:
return "Receive cros::mojom::CrosCameraService::AddCrosCameraServiceObserver";
}
} else {
switch (static_cast<messages::CrosCameraService>(message.name())) {
case messages::CrosCameraService::kGetCameraModule:
return "Receive reply cros::mojom::CrosCameraService::GetCameraModule";
case messages::CrosCameraService::kSetTracingEnabled:
return "Receive reply cros::mojom::CrosCameraService::SetTracingEnabled";
case messages::CrosCameraService::kSetAutoFramingState:
return "Receive reply cros::mojom::CrosCameraService::SetAutoFramingState";
case messages::CrosCameraService::kGetCameraSWPrivacySwitchState:
return "Receive reply cros::mojom::CrosCameraService::GetCameraSWPrivacySwitchState";
case messages::CrosCameraService::kSetCameraSWPrivacySwitchState:
return "Receive reply cros::mojom::CrosCameraService::SetCameraSWPrivacySwitchState";
case messages::CrosCameraService::kGetAutoFramingSupported:
return "Receive reply cros::mojom::CrosCameraService::GetAutoFramingSupported";
case messages::CrosCameraService::kSetCameraEffect:
return "Receive reply cros::mojom::CrosCameraService::SetCameraEffect";
case messages::CrosCameraService::kAddCrosCameraServiceObserver:
return "Receive reply cros::mojom::CrosCameraService::AddCrosCameraServiceObserver";
}
}
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 CrosCameraService::GetCameraModule_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CrosCameraService::GetCameraModule");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t CrosCameraService::SetTracingEnabled_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CrosCameraService::SetTracingEnabled");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t CrosCameraService::SetAutoFramingState_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CrosCameraService::SetAutoFramingState");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t CrosCameraService::GetCameraSWPrivacySwitchState_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CrosCameraService::GetCameraSWPrivacySwitchState");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t CrosCameraService::SetCameraSWPrivacySwitchState_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CrosCameraService::SetCameraSWPrivacySwitchState");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t CrosCameraService::GetAutoFramingSupported_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CrosCameraService::GetAutoFramingSupported");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t CrosCameraService::SetCameraEffect_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CrosCameraService::SetCameraEffect");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t CrosCameraService::AddCrosCameraServiceObserver_Sym::IPCStableHash() {
// This method's address is used for indetifiying 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 accross different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
constexpr uint32_t kHash = base::MD5Hash32Constexpr(
"(Impl)cros::mojom::CrosCameraService::AddCrosCameraServiceObserver");
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)
class CrosCameraService_GetCameraModule_ForwardToCallback
: public mojo::MessageReceiver {
public:
CrosCameraService_GetCameraModule_ForwardToCallback(
CrosCameraService::GetCameraModuleCallback callback
) : callback_(std::move(callback)) {
}
CrosCameraService_GetCameraModule_ForwardToCallback(const CrosCameraService_GetCameraModule_ForwardToCallback&) = delete;
CrosCameraService_GetCameraModule_ForwardToCallback& operator=(const CrosCameraService_GetCameraModule_ForwardToCallback&) = delete;
bool Accept(mojo::Message* message) override;
private:
CrosCameraService::GetCameraModuleCallback callback_;
};
class CrosCameraService_GetCameraSWPrivacySwitchState_ForwardToCallback
: public mojo::MessageReceiver {
public:
CrosCameraService_GetCameraSWPrivacySwitchState_ForwardToCallback(
CrosCameraService::GetCameraSWPrivacySwitchStateCallback callback
) : callback_(std::move(callback)) {
}
CrosCameraService_GetCameraSWPrivacySwitchState_ForwardToCallback(const CrosCameraService_GetCameraSWPrivacySwitchState_ForwardToCallback&) = delete;
CrosCameraService_GetCameraSWPrivacySwitchState_ForwardToCallback& operator=(const CrosCameraService_GetCameraSWPrivacySwitchState_ForwardToCallback&) = delete;
bool Accept(mojo::Message* message) override;
private:
CrosCameraService::GetCameraSWPrivacySwitchStateCallback callback_;
};
class CrosCameraService_GetAutoFramingSupported_ForwardToCallback
: public mojo::MessageReceiver {
public:
CrosCameraService_GetAutoFramingSupported_ForwardToCallback(
CrosCameraService::GetAutoFramingSupportedCallback callback
) : callback_(std::move(callback)) {
}
CrosCameraService_GetAutoFramingSupported_ForwardToCallback(const CrosCameraService_GetAutoFramingSupported_ForwardToCallback&) = delete;
CrosCameraService_GetAutoFramingSupported_ForwardToCallback& operator=(const CrosCameraService_GetAutoFramingSupported_ForwardToCallback&) = delete;
bool Accept(mojo::Message* message) override;
private:
CrosCameraService::GetAutoFramingSupportedCallback callback_;
};
class CrosCameraService_SetCameraEffect_ForwardToCallback
: public mojo::MessageReceiver {
public:
CrosCameraService_SetCameraEffect_ForwardToCallback(
CrosCameraService::SetCameraEffectCallback callback
) : callback_(std::move(callback)) {
}
CrosCameraService_SetCameraEffect_ForwardToCallback(const CrosCameraService_SetCameraEffect_ForwardToCallback&) = delete;
CrosCameraService_SetCameraEffect_ForwardToCallback& operator=(const CrosCameraService_SetCameraEffect_ForwardToCallback&) = delete;
bool Accept(mojo::Message* message) override;
private:
CrosCameraService::SetCameraEffectCallback callback_;
};
CrosCameraServiceProxy::CrosCameraServiceProxy(mojo::MessageReceiverWithResponder* receiver)
: receiver_(receiver) {
}
void CrosCameraServiceProxy::GetCameraModule(
CameraClientType in_type, GetCameraModuleCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send cros::mojom::CrosCameraService::GetCameraModule", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("type"), in_type,
"<value of type CameraClientType>");
});
#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(
base::to_underlying(messages::CrosCameraService::kGetCameraModule), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraService_GetCameraModule_Params_Data> params(
message);
params.Allocate();
mojo::internal::Serialize<::cros::mojom::CameraClientType>(
in_type, &params->type);
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraService::Name_);
message.set_method_name("GetCameraModule");
#endif
std::unique_ptr<mojo::MessageReceiver> responder(
new CrosCameraService_GetCameraModule_ForwardToCallback(
std::move(callback)));
::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
}
void CrosCameraServiceProxy::SetTracingEnabled(
bool in_enabled) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send cros::mojom::CrosCameraService::SetTracingEnabled", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("enabled"), in_enabled,
"<value of type bool>");
});
#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(
base::to_underlying(messages::CrosCameraService::kSetTracingEnabled), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraService_SetTracingEnabled_Params_Data> params(
message);
params.Allocate();
params->enabled = in_enabled;
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraService::Name_);
message.set_method_name("SetTracingEnabled");
#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 CrosCameraServiceProxy::SetAutoFramingState(
CameraAutoFramingState in_state) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send cros::mojom::CrosCameraService::SetAutoFramingState", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("state"), in_state,
"<value of type CameraAutoFramingState>");
});
#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(
base::to_underlying(messages::CrosCameraService::kSetAutoFramingState), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraService_SetAutoFramingState_Params_Data> params(
message);
params.Allocate();
mojo::internal::Serialize<::cros::mojom::CameraAutoFramingState>(
in_state, &params->state);
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraService::Name_);
message.set_method_name("SetAutoFramingState");
#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 CrosCameraServiceProxy::GetCameraSWPrivacySwitchState(
GetCameraSWPrivacySwitchStateCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT0("mojom", "Send cros::mojom::CrosCameraService::GetCameraSWPrivacySwitchState");
#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(
base::to_underlying(messages::CrosCameraService::kGetCameraSWPrivacySwitchState), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraService_GetCameraSWPrivacySwitchState_Params_Data> params(
message);
params.Allocate();
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraService::Name_);
message.set_method_name("GetCameraSWPrivacySwitchState");
#endif
std::unique_ptr<mojo::MessageReceiver> responder(
new CrosCameraService_GetCameraSWPrivacySwitchState_ForwardToCallback(
std::move(callback)));
::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
}
void CrosCameraServiceProxy::SetCameraSWPrivacySwitchState(
CameraPrivacySwitchState in_state) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send cros::mojom::CrosCameraService::SetCameraSWPrivacySwitchState", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("state"), in_state,
"<value of type CameraPrivacySwitchState>");
});
#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(
base::to_underlying(messages::CrosCameraService::kSetCameraSWPrivacySwitchState), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraService_SetCameraSWPrivacySwitchState_Params_Data> params(
message);
params.Allocate();
mojo::internal::Serialize<::cros::mojom::CameraPrivacySwitchState>(
in_state, &params->state);
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraService::Name_);
message.set_method_name("SetCameraSWPrivacySwitchState");
#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 CrosCameraServiceProxy::GetAutoFramingSupported(
GetAutoFramingSupportedCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT0("mojom", "Send cros::mojom::CrosCameraService::GetAutoFramingSupported");
#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(
base::to_underlying(messages::CrosCameraService::kGetAutoFramingSupported), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraService_GetAutoFramingSupported_Params_Data> params(
message);
params.Allocate();
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraService::Name_);
message.set_method_name("GetAutoFramingSupported");
#endif
std::unique_ptr<mojo::MessageReceiver> responder(
new CrosCameraService_GetAutoFramingSupported_ForwardToCallback(
std::move(callback)));
::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
}
void CrosCameraServiceProxy::SetCameraEffect(
::cros::mojom::EffectsConfigPtr in_config, SetCameraEffectCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send cros::mojom::CrosCameraService::SetCameraEffect", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("config"), in_config,
"<value of type ::cros::mojom::EffectsConfigPtr>");
});
#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(
base::to_underlying(messages::CrosCameraService::kSetCameraEffect), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraService_SetCameraEffect_Params_Data> params(
message);
params.Allocate();
mojo::internal::MessageFragment<
typename decltype(params->config)::BaseType> config_fragment(
params.message());
mojo::internal::Serialize<::cros::mojom::EffectsConfigDataView>(
in_config, config_fragment);
params->config.Set(
config_fragment.is_null() ? nullptr : config_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
params->config.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null config in CrosCameraService.SetCameraEffect request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraService::Name_);
message.set_method_name("SetCameraEffect");
#endif
std::unique_ptr<mojo::MessageReceiver> responder(
new CrosCameraService_SetCameraEffect_ForwardToCallback(
std::move(callback)));
::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
}
void CrosCameraServiceProxy::AddCrosCameraServiceObserver(
::mojo::PendingRemote<CrosCameraServiceObserver> in_observer) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send cros::mojom::CrosCameraService::AddCrosCameraServiceObserver", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("observer"), in_observer,
"<value of type ::mojo::PendingRemote<CrosCameraServiceObserver>>");
});
#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(
base::to_underlying(messages::CrosCameraService::kAddCrosCameraServiceObserver), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraService_AddCrosCameraServiceObserver_Params_Data> params(
message);
params.Allocate();
mojo::internal::Serialize<mojo::InterfacePtrDataView<::cros::mojom::CrosCameraServiceObserverInterfaceBase>>(
in_observer, &params->observer, &params.message());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
!mojo::internal::IsHandleOrInterfaceValid(params->observer),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
"invalid observer in CrosCameraService.AddCrosCameraServiceObserver request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraService::Name_);
message.set_method_name("AddCrosCameraServiceObserver");
#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);
}
class CrosCameraService_GetCameraModule_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
public:
static CrosCameraService::GetCameraModuleCallback CreateCallback(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
std::unique_ptr<CrosCameraService_GetCameraModule_ProxyToResponder> proxy(
new CrosCameraService_GetCameraModule_ProxyToResponder(
message, std::move(responder)));
return base::BindOnce(&CrosCameraService_GetCameraModule_ProxyToResponder::Run,
std::move(proxy));
}
~CrosCameraService_GetCameraModule_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:
CrosCameraService_GetCameraModule_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)
<< "CrosCameraService::GetCameraModuleCallback was destroyed without "
<< "first either being run or its corresponding binding being closed. "
<< "It is an error to drop response callbacks which still correspond "
<< "to an open interface pipe.";
}
#endif
void Run(
::mojo::PendingRemote<::cros::mojom::CameraModule> in_camera_module_receiver);
};
bool CrosCameraService_GetCameraModule_ForwardToCallback::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::CrosCameraService_GetCameraModule_ResponseParams_Data* params =
reinterpret_cast<
internal::CrosCameraService_GetCameraModule_ResponseParams_Data*>(
message->mutable_payload());
// Validation for CrosCameraService.0
bool success = true;
::mojo::PendingRemote<::cros::mojom::CameraModule> p_camera_module_receiver{};
CrosCameraService_GetCameraModule_ResponseParamsDataView input_data_view(params, message);
if (success) {
p_camera_module_receiver =
input_data_view.TakeCameraModuleReceiver<decltype(p_camera_module_receiver)>();
}
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraService::Name_, 0, true);
return false;
}
if (!callback_.is_null())
std::move(callback_).Run(
std::move(p_camera_module_receiver));
return true;
}
void CrosCameraService_GetCameraModule_ProxyToResponder::Run(
::mojo::PendingRemote<::cros::mojom::CameraModule> in_camera_module_receiver) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send reply cros::mojom::CrosCameraService::GetCameraModule", "async_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("camera_module_receiver"), in_camera_module_receiver,
"<value of type ::mojo::PendingRemote<::cros::mojom::CameraModule>>");
});
#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(
base::to_underlying(messages::CrosCameraService::kGetCameraModule), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraService_GetCameraModule_ResponseParams_Data> params(
message);
params.Allocate();
mojo::internal::Serialize<mojo::InterfacePtrDataView<::cros::mojom::CameraModuleInterfaceBase>>(
in_camera_module_receiver, &params->camera_module_receiver, &params.message());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
!mojo::internal::IsHandleOrInterfaceValid(params->camera_module_receiver),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
"invalid camera_module_receiver in ");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraService::Name_);
message.set_method_name("GetCameraModule");
#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 CrosCameraService_GetCameraSWPrivacySwitchState_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
public:
static CrosCameraService::GetCameraSWPrivacySwitchStateCallback CreateCallback(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
std::unique_ptr<CrosCameraService_GetCameraSWPrivacySwitchState_ProxyToResponder> proxy(
new CrosCameraService_GetCameraSWPrivacySwitchState_ProxyToResponder(
message, std::move(responder)));
return base::BindOnce(&CrosCameraService_GetCameraSWPrivacySwitchState_ProxyToResponder::Run,
std::move(proxy));
}
~CrosCameraService_GetCameraSWPrivacySwitchState_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:
CrosCameraService_GetCameraSWPrivacySwitchState_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)
<< "CrosCameraService::GetCameraSWPrivacySwitchStateCallback 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(
CameraPrivacySwitchState in_state);
};
bool CrosCameraService_GetCameraSWPrivacySwitchState_ForwardToCallback::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::CrosCameraService_GetCameraSWPrivacySwitchState_ResponseParams_Data* params =
reinterpret_cast<
internal::CrosCameraService_GetCameraSWPrivacySwitchState_ResponseParams_Data*>(
message->mutable_payload());
// Validation for CrosCameraService.3
bool success = true;
CameraPrivacySwitchState p_state{};
CrosCameraService_GetCameraSWPrivacySwitchState_ResponseParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadState(&p_state))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraService::Name_, 3, true);
return false;
}
if (!callback_.is_null())
std::move(callback_).Run(
std::move(p_state));
return true;
}
void CrosCameraService_GetCameraSWPrivacySwitchState_ProxyToResponder::Run(
CameraPrivacySwitchState in_state) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send reply cros::mojom::CrosCameraService::GetCameraSWPrivacySwitchState", "async_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("state"), in_state,
"<value of type CameraPrivacySwitchState>");
});
#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(
base::to_underlying(messages::CrosCameraService::kGetCameraSWPrivacySwitchState), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraService_GetCameraSWPrivacySwitchState_ResponseParams_Data> params(
message);
params.Allocate();
mojo::internal::Serialize<::cros::mojom::CameraPrivacySwitchState>(
in_state, &params->state);
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraService::Name_);
message.set_method_name("GetCameraSWPrivacySwitchState");
#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 CrosCameraService_GetAutoFramingSupported_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
public:
static CrosCameraService::GetAutoFramingSupportedCallback CreateCallback(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
std::unique_ptr<CrosCameraService_GetAutoFramingSupported_ProxyToResponder> proxy(
new CrosCameraService_GetAutoFramingSupported_ProxyToResponder(
message, std::move(responder)));
return base::BindOnce(&CrosCameraService_GetAutoFramingSupported_ProxyToResponder::Run,
std::move(proxy));
}
~CrosCameraService_GetAutoFramingSupported_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:
CrosCameraService_GetAutoFramingSupported_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)
<< "CrosCameraService::GetAutoFramingSupportedCallback 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_supported);
};
bool CrosCameraService_GetAutoFramingSupported_ForwardToCallback::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::CrosCameraService_GetAutoFramingSupported_ResponseParams_Data* params =
reinterpret_cast<
internal::CrosCameraService_GetAutoFramingSupported_ResponseParams_Data*>(
message->mutable_payload());
// Validation for CrosCameraService.5
bool success = true;
bool p_supported{};
CrosCameraService_GetAutoFramingSupported_ResponseParamsDataView input_data_view(params, message);
if (success)
p_supported = input_data_view.supported();
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraService::Name_, 5, true);
return false;
}
if (!callback_.is_null())
std::move(callback_).Run(
std::move(p_supported));
return true;
}
void CrosCameraService_GetAutoFramingSupported_ProxyToResponder::Run(
bool in_supported) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send reply cros::mojom::CrosCameraService::GetAutoFramingSupported", "async_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("supported"), in_supported,
"<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(
base::to_underlying(messages::CrosCameraService::kGetAutoFramingSupported), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraService_GetAutoFramingSupported_ResponseParams_Data> params(
message);
params.Allocate();
params->supported = in_supported;
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraService::Name_);
message.set_method_name("GetAutoFramingSupported");
#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 CrosCameraService_SetCameraEffect_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
public:
static CrosCameraService::SetCameraEffectCallback CreateCallback(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
std::unique_ptr<CrosCameraService_SetCameraEffect_ProxyToResponder> proxy(
new CrosCameraService_SetCameraEffect_ProxyToResponder(
message, std::move(responder)));
return base::BindOnce(&CrosCameraService_SetCameraEffect_ProxyToResponder::Run,
std::move(proxy));
}
~CrosCameraService_SetCameraEffect_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:
CrosCameraService_SetCameraEffect_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)
<< "CrosCameraService::SetCameraEffectCallback 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(
::cros::mojom::SetEffectResult in_result);
};
bool CrosCameraService_SetCameraEffect_ForwardToCallback::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::CrosCameraService_SetCameraEffect_ResponseParams_Data* params =
reinterpret_cast<
internal::CrosCameraService_SetCameraEffect_ResponseParams_Data*>(
message->mutable_payload());
// Validation for CrosCameraService.6
bool success = true;
::cros::mojom::SetEffectResult p_result{};
CrosCameraService_SetCameraEffect_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,
CrosCameraService::Name_, 6, true);
return false;
}
if (!callback_.is_null())
std::move(callback_).Run(
std::move(p_result));
return true;
}
void CrosCameraService_SetCameraEffect_ProxyToResponder::Run(
::cros::mojom::SetEffectResult in_result) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send reply cros::mojom::CrosCameraService::SetCameraEffect", "async_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("result"), in_result,
"<value of type ::cros::mojom::SetEffectResult>");
});
#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(
base::to_underlying(messages::CrosCameraService::kSetCameraEffect), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::cros::mojom::internal::CrosCameraService_SetCameraEffect_ResponseParams_Data> params(
message);
params.Allocate();
mojo::internal::Serialize<::cros::mojom::SetEffectResult>(
in_result, &params->result);
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(CrosCameraService::Name_);
message.set_method_name("SetCameraEffect");
#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 CrosCameraServiceStubDispatch::Accept(
CrosCameraService* impl,
mojo::Message* message) {
switch (static_cast<messages::CrosCameraService>(message->header()->name)) {
case messages::CrosCameraService::kGetCameraModule: {
break;
}
case messages::CrosCameraService::kSetTracingEnabled: {
DCHECK(message->is_serialized());
internal::CrosCameraService_SetTracingEnabled_Params_Data* params =
reinterpret_cast<internal::CrosCameraService_SetTracingEnabled_Params_Data*>(
message->mutable_payload());
// Validation for CrosCameraService.1
bool success = true;
bool p_enabled{};
CrosCameraService_SetTracingEnabled_ParamsDataView input_data_view(params, message);
if (success)
p_enabled = input_data_view.enabled();
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraService::Name_, 1, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->SetTracingEnabled(
std::move(p_enabled));
return true;
}
case messages::CrosCameraService::kSetAutoFramingState: {
DCHECK(message->is_serialized());
internal::CrosCameraService_SetAutoFramingState_Params_Data* params =
reinterpret_cast<internal::CrosCameraService_SetAutoFramingState_Params_Data*>(
message->mutable_payload());
// Validation for CrosCameraService.2
bool success = true;
CameraAutoFramingState p_state{};
CrosCameraService_SetAutoFramingState_ParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadState(&p_state))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraService::Name_, 2, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->SetAutoFramingState(
std::move(p_state));
return true;
}
case messages::CrosCameraService::kGetCameraSWPrivacySwitchState: {
break;
}
case messages::CrosCameraService::kSetCameraSWPrivacySwitchState: {
DCHECK(message->is_serialized());
internal::CrosCameraService_SetCameraSWPrivacySwitchState_Params_Data* params =
reinterpret_cast<internal::CrosCameraService_SetCameraSWPrivacySwitchState_Params_Data*>(
message->mutable_payload());
// Validation for CrosCameraService.4
bool success = true;
CameraPrivacySwitchState p_state{};
CrosCameraService_SetCameraSWPrivacySwitchState_ParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadState(&p_state))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraService::Name_, 4, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->SetCameraSWPrivacySwitchState(
std::move(p_state));
return true;
}
case messages::CrosCameraService::kGetAutoFramingSupported: {
break;
}
case messages::CrosCameraService::kSetCameraEffect: {
break;
}
case messages::CrosCameraService::kAddCrosCameraServiceObserver: {
DCHECK(message->is_serialized());
internal::CrosCameraService_AddCrosCameraServiceObserver_Params_Data* params =
reinterpret_cast<internal::CrosCameraService_AddCrosCameraServiceObserver_Params_Data*>(
message->mutable_payload());
// Validation for CrosCameraService.7
bool success = true;
::mojo::PendingRemote<CrosCameraServiceObserver> p_observer{};
CrosCameraService_AddCrosCameraServiceObserver_ParamsDataView input_data_view(params, message);
if (success) {
p_observer =
input_data_view.TakeObserver<decltype(p_observer)>();
}
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraService::Name_, 7, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->AddCrosCameraServiceObserver(
std::move(p_observer));
return true;
}
}
return false;
}
// static
bool CrosCameraServiceStubDispatch::AcceptWithResponder(
CrosCameraService* 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::CrosCameraService>(message->header()->name)) {
case messages::CrosCameraService::kGetCameraModule: {
internal::CrosCameraService_GetCameraModule_Params_Data* params =
reinterpret_cast<
internal::CrosCameraService_GetCameraModule_Params_Data*>(
message->mutable_payload());
// Validation for CrosCameraService.0
bool success = true;
CameraClientType p_type{};
CrosCameraService_GetCameraModule_ParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadType(&p_type))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraService::Name_, 0, false);
return false;
}
CrosCameraService::GetCameraModuleCallback callback =
CrosCameraService_GetCameraModule_ProxyToResponder::CreateCallback(
*message, std::move(responder));
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->GetCameraModule(
std::move(p_type), std::move(callback));
return true;
}
case messages::CrosCameraService::kSetTracingEnabled: {
break;
}
case messages::CrosCameraService::kSetAutoFramingState: {
break;
}
case messages::CrosCameraService::kGetCameraSWPrivacySwitchState: {
internal::CrosCameraService_GetCameraSWPrivacySwitchState_Params_Data* params =
reinterpret_cast<
internal::CrosCameraService_GetCameraSWPrivacySwitchState_Params_Data*>(
message->mutable_payload());
// Validation for CrosCameraService.3
bool success = true;
CrosCameraService_GetCameraSWPrivacySwitchState_ParamsDataView input_data_view(params, message);
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraService::Name_, 3, false);
return false;
}
CrosCameraService::GetCameraSWPrivacySwitchStateCallback callback =
CrosCameraService_GetCameraSWPrivacySwitchState_ProxyToResponder::CreateCallback(
*message, std::move(responder));
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->GetCameraSWPrivacySwitchState(std::move(callback));
return true;
}
case messages::CrosCameraService::kSetCameraSWPrivacySwitchState: {
break;
}
case messages::CrosCameraService::kGetAutoFramingSupported: {
internal::CrosCameraService_GetAutoFramingSupported_Params_Data* params =
reinterpret_cast<
internal::CrosCameraService_GetAutoFramingSupported_Params_Data*>(
message->mutable_payload());
// Validation for CrosCameraService.5
bool success = true;
CrosCameraService_GetAutoFramingSupported_ParamsDataView input_data_view(params, message);
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraService::Name_, 5, false);
return false;
}
CrosCameraService::GetAutoFramingSupportedCallback callback =
CrosCameraService_GetAutoFramingSupported_ProxyToResponder::CreateCallback(
*message, std::move(responder));
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->GetAutoFramingSupported(std::move(callback));
return true;
}
case messages::CrosCameraService::kSetCameraEffect: {
internal::CrosCameraService_SetCameraEffect_Params_Data* params =
reinterpret_cast<
internal::CrosCameraService_SetCameraEffect_Params_Data*>(
message->mutable_payload());
// Validation for CrosCameraService.6
bool success = true;
::cros::mojom::EffectsConfigPtr p_config{};
CrosCameraService_SetCameraEffect_ParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadConfig(&p_config))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
CrosCameraService::Name_, 6, false);
return false;
}
CrosCameraService::SetCameraEffectCallback callback =
CrosCameraService_SetCameraEffect_ProxyToResponder::CreateCallback(
*message, std::move(responder));
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->SetCameraEffect(
std::move(p_config), std::move(callback));
return true;
}
case messages::CrosCameraService::kAddCrosCameraServiceObserver: {
break;
}
}
return false;
}
namespace {
} // namespace
static const mojo::internal::GenericValidationInfo kCrosCameraServiceValidationInfo[] = {
{ &internal::CrosCameraService_GetCameraModule_Params_Data::Validate,
&internal::CrosCameraService_GetCameraModule_ResponseParams_Data::Validate},
{ &internal::CrosCameraService_SetTracingEnabled_Params_Data::Validate,
nullptr /* no response */},
{ &internal::CrosCameraService_SetAutoFramingState_Params_Data::Validate,
nullptr /* no response */},
{ &internal::CrosCameraService_GetCameraSWPrivacySwitchState_Params_Data::Validate,
&internal::CrosCameraService_GetCameraSWPrivacySwitchState_ResponseParams_Data::Validate},
{ &internal::CrosCameraService_SetCameraSWPrivacySwitchState_Params_Data::Validate,
nullptr /* no response */},
{ &internal::CrosCameraService_GetAutoFramingSupported_Params_Data::Validate,
&internal::CrosCameraService_GetAutoFramingSupported_ResponseParams_Data::Validate},
{ &internal::CrosCameraService_SetCameraEffect_Params_Data::Validate,
&internal::CrosCameraService_SetCameraEffect_ResponseParams_Data::Validate},
{ &internal::CrosCameraService_AddCrosCameraServiceObserver_Params_Data::Validate,
nullptr /* no response */},
};
bool CrosCameraServiceRequestValidator::Accept(mojo::Message* message) {
const char* name = ::cros::mojom::CrosCameraService::Name_;
return mojo::internal::ValidateRequestGenericPacked(message, name, kCrosCameraServiceValidationInfo);
}
bool CrosCameraServiceResponseValidator::Accept(mojo::Message* message) {
const char* name = ::cros::mojom::CrosCameraService::Name_;
return mojo::internal::ValidateResponseGenericPacked(message, name, kCrosCameraServiceValidationInfo);
}
} // cros::mojom
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 cros::mojom {
void CameraHalDispatcherInterceptorForTesting::RegisterClientWithToken(::mojo::PendingRemote<::cros::mojom::CameraHalClient> client, CameraClientType type, const ::base::UnguessableToken& auth_token, RegisterClientWithTokenCallback callback) {
GetForwardingInterface()->RegisterClientWithToken(std::move(client), std::move(type), std::move(auth_token), std::move(callback));
}
CameraHalDispatcherAsyncWaiter::CameraHalDispatcherAsyncWaiter(
CameraHalDispatcher* proxy) : proxy_(proxy) {}
CameraHalDispatcherAsyncWaiter::~CameraHalDispatcherAsyncWaiter() = default;
void CameraHalDispatcherAsyncWaiter::RegisterClientWithToken(
::mojo::PendingRemote<::cros::mojom::CameraHalClient> client, CameraClientType type, const ::base::UnguessableToken& auth_token, int32_t* out_result) {
base::RunLoop loop;
proxy_->RegisterClientWithToken(std::move(client),std::move(type),std::move(auth_token),
base::BindOnce(
[](base::RunLoop* loop,
int32_t* out_result
,
int32_t result) {*out_result = std::move(result);
loop->Quit();
},
&loop,
out_result));
loop.Run();
}
int32_t CameraHalDispatcherAsyncWaiter::RegisterClientWithToken(
::mojo::PendingRemote<::cros::mojom::CameraHalClient> client, CameraClientType type, const ::base::UnguessableToken& auth_token) {
int32_t async_wait_result;
RegisterClientWithToken(std::move(client),std::move(type),std::move(auth_token),&async_wait_result);
return async_wait_result;
}
void CrosCameraServiceObserverInterceptorForTesting::CameraDeviceActivityChange(int32_t camera_id, bool opened, CameraClientType type) {
GetForwardingInterface()->CameraDeviceActivityChange(std::move(camera_id), std::move(opened), std::move(type));
}
void CrosCameraServiceObserverInterceptorForTesting::CameraPrivacySwitchStateChange(CameraPrivacySwitchState state, int32_t camera_id) {
GetForwardingInterface()->CameraPrivacySwitchStateChange(std::move(state), std::move(camera_id));
}
void CrosCameraServiceObserverInterceptorForTesting::CameraSWPrivacySwitchStateChange(CameraPrivacySwitchState state) {
GetForwardingInterface()->CameraSWPrivacySwitchStateChange(std::move(state));
}
void CrosCameraServiceObserverInterceptorForTesting::CameraEffectChange(::cros::mojom::EffectsConfigPtr config) {
GetForwardingInterface()->CameraEffectChange(std::move(config));
}
CrosCameraServiceObserverAsyncWaiter::CrosCameraServiceObserverAsyncWaiter(
CrosCameraServiceObserver* proxy) : proxy_(proxy) {}
CrosCameraServiceObserverAsyncWaiter::~CrosCameraServiceObserverAsyncWaiter() = default;
void CrosCameraServiceInterceptorForTesting::GetCameraModule(CameraClientType type, GetCameraModuleCallback callback) {
GetForwardingInterface()->GetCameraModule(std::move(type), std::move(callback));
}
void CrosCameraServiceInterceptorForTesting::SetTracingEnabled(bool enabled) {
GetForwardingInterface()->SetTracingEnabled(std::move(enabled));
}
void CrosCameraServiceInterceptorForTesting::SetAutoFramingState(CameraAutoFramingState state) {
GetForwardingInterface()->SetAutoFramingState(std::move(state));
}
void CrosCameraServiceInterceptorForTesting::GetCameraSWPrivacySwitchState(GetCameraSWPrivacySwitchStateCallback callback) {
GetForwardingInterface()->GetCameraSWPrivacySwitchState(std::move(callback));
}
void CrosCameraServiceInterceptorForTesting::SetCameraSWPrivacySwitchState(CameraPrivacySwitchState state) {
GetForwardingInterface()->SetCameraSWPrivacySwitchState(std::move(state));
}
void CrosCameraServiceInterceptorForTesting::GetAutoFramingSupported(GetAutoFramingSupportedCallback callback) {
GetForwardingInterface()->GetAutoFramingSupported(std::move(callback));
}
void CrosCameraServiceInterceptorForTesting::SetCameraEffect(::cros::mojom::EffectsConfigPtr config, SetCameraEffectCallback callback) {
GetForwardingInterface()->SetCameraEffect(std::move(config), std::move(callback));
}
void CrosCameraServiceInterceptorForTesting::AddCrosCameraServiceObserver(::mojo::PendingRemote<CrosCameraServiceObserver> observer) {
GetForwardingInterface()->AddCrosCameraServiceObserver(std::move(observer));
}
CrosCameraServiceAsyncWaiter::CrosCameraServiceAsyncWaiter(
CrosCameraService* proxy) : proxy_(proxy) {}
CrosCameraServiceAsyncWaiter::~CrosCameraServiceAsyncWaiter() = default;
void CrosCameraServiceAsyncWaiter::GetCameraModule(
CameraClientType type, ::mojo::PendingRemote<::cros::mojom::CameraModule>* out_camera_module_receiver) {
base::RunLoop loop;
proxy_->GetCameraModule(std::move(type),
base::BindOnce(
[](base::RunLoop* loop,
::mojo::PendingRemote<::cros::mojom::CameraModule>* out_camera_module_receiver
,
::mojo::PendingRemote<::cros::mojom::CameraModule> camera_module_receiver) {*out_camera_module_receiver = std::move(camera_module_receiver);
loop->Quit();
},
&loop,
out_camera_module_receiver));
loop.Run();
}
::mojo::PendingRemote<::cros::mojom::CameraModule> CrosCameraServiceAsyncWaiter::GetCameraModule(
CameraClientType type) {
::mojo::PendingRemote<::cros::mojom::CameraModule> async_wait_result;
GetCameraModule(std::move(type),&async_wait_result);
return async_wait_result;
}
void CrosCameraServiceAsyncWaiter::GetCameraSWPrivacySwitchState(
CameraPrivacySwitchState* out_state) {
base::RunLoop loop;
proxy_->GetCameraSWPrivacySwitchState(
base::BindOnce(
[](base::RunLoop* loop,
CameraPrivacySwitchState* out_state
,
CameraPrivacySwitchState state) {*out_state = std::move(state);
loop->Quit();
},
&loop,
out_state));
loop.Run();
}
CameraPrivacySwitchState CrosCameraServiceAsyncWaiter::GetCameraSWPrivacySwitchState(
) {
CameraPrivacySwitchState async_wait_result;
GetCameraSWPrivacySwitchState(&async_wait_result);
return async_wait_result;
}
void CrosCameraServiceAsyncWaiter::GetAutoFramingSupported(
bool* out_supported) {
base::RunLoop loop;
proxy_->GetAutoFramingSupported(
base::BindOnce(
[](base::RunLoop* loop,
bool* out_supported
,
bool supported) {*out_supported = std::move(supported);
loop->Quit();
},
&loop,
out_supported));
loop.Run();
}
bool CrosCameraServiceAsyncWaiter::GetAutoFramingSupported(
) {
bool async_wait_result;
GetAutoFramingSupported(&async_wait_result);
return async_wait_result;
}
void CrosCameraServiceAsyncWaiter::SetCameraEffect(
::cros::mojom::EffectsConfigPtr config, ::cros::mojom::SetEffectResult* out_result) {
base::RunLoop loop;
proxy_->SetCameraEffect(std::move(config),
base::BindOnce(
[](base::RunLoop* loop,
::cros::mojom::SetEffectResult* out_result
,
::cros::mojom::SetEffectResult result) {*out_result = std::move(result);
loop->Quit();
},
&loop,
out_result));
loop.Run();
}
::cros::mojom::SetEffectResult CrosCameraServiceAsyncWaiter::SetCameraEffect(
::cros::mojom::EffectsConfigPtr config) {
::cros::mojom::SetEffectResult async_wait_result;
SetCameraEffect(std::move(config),&async_wait_result);
return async_wait_result;
}
} // cros::mojom
#if defined(__clang__)
#pragma clang diagnostic pop
#endif