| // components/content_capture/common/content_capture.mojom-blink.cc is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2013 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wunused-private-field" |
| #endif |
| |
| #include "components/content_capture/common/content_capture.mojom-blink.h" |
| |
| #include <math.h> |
| #include <stdint.h> |
| #include <utility> |
| |
| #include "base/debug/alias.h" |
| #include "base/hash/md5_constexpr.h" |
| #include "base/run_loop.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/trace_event/trace_event.h" |
| #include "base/trace_event/typed_macros.h" |
| #include "mojo/public/cpp/bindings/lib/generated_code_util.h" |
| #include "mojo/public/cpp/bindings/lib/message_internal.h" |
| #include "mojo/public/cpp/bindings/lib/send_message_helper.h" |
| #include "mojo/public/cpp/bindings/lib/proxy_to_responder.h" |
| #include "mojo/public/cpp/bindings/lib/serialization_util.h" |
| #include "mojo/public/cpp/bindings/lib/unserialized_message_context.h" |
| #include "mojo/public/cpp/bindings/lib/validate_params.h" |
| #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| #include "mojo/public/cpp/bindings/mojo_buildflags.h" |
| #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h" |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value.h" |
| |
| #include "components/content_capture/common/content_capture.mojom-params-data.h" |
| #include "components/content_capture/common/content_capture.mojom-shared-message-ids.h" |
| |
| #include "components/content_capture/common/content_capture.mojom-blink-import-headers.h" |
| #include "components/content_capture/common/content_capture.mojom-blink-test-utils.h" |
| #include "mojo/public/cpp/bindings/lib/wtf_serialization.h" |
| |
| |
| #ifndef COMPONENTS_CONTENT_CAPTURE_COMMON_CONTENT_CAPTURE_MOJOM_BLINK_JUMBO_H_ |
| #define COMPONENTS_CONTENT_CAPTURE_COMMON_CONTENT_CAPTURE_MOJOM_BLINK_JUMBO_H_ |
| #endif |
| |
| |
| |
| namespace content_capture { |
| namespace mojom { |
| namespace blink { |
| const char ContentCaptureReceiver::Name_[] = "content_capture.mojom.ContentCaptureReceiver"; |
| |
| std::pair<uint32_t, const void*> ContentCaptureReceiver::MessageToMethodInfo_(mojo::Message& message) { |
| switch (message.name()) { |
| case internal::kContentCaptureReceiver_DidCaptureContent_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)content_capture::mojom::ContentCaptureReceiver::DidCaptureContent"); |
| #if BUILDFLAG(IS_FUCHSIA) |
| return std::make_pair(value, nullptr); |
| #else |
| return std::make_pair(value, reinterpret_cast<const void*>(&ContentCaptureReceiver::DidCaptureContent_Sym::IPCSymbol)); |
| #endif // BUILDFLAG(IS_FUCHSIA) |
| } |
| case internal::kContentCaptureReceiver_DidUpdateContent_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)content_capture::mojom::ContentCaptureReceiver::DidUpdateContent"); |
| #if BUILDFLAG(IS_FUCHSIA) |
| return std::make_pair(value, nullptr); |
| #else |
| return std::make_pair(value, reinterpret_cast<const void*>(&ContentCaptureReceiver::DidUpdateContent_Sym::IPCSymbol)); |
| #endif // BUILDFLAG(IS_FUCHSIA) |
| } |
| case internal::kContentCaptureReceiver_DidRemoveContent_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)content_capture::mojom::ContentCaptureReceiver::DidRemoveContent"); |
| #if BUILDFLAG(IS_FUCHSIA) |
| return std::make_pair(value, nullptr); |
| #else |
| return std::make_pair(value, reinterpret_cast<const void*>(&ContentCaptureReceiver::DidRemoveContent_Sym::IPCSymbol)); |
| #endif // BUILDFLAG(IS_FUCHSIA) |
| } |
| } |
| return std::make_pair(0, nullptr); |
| } |
| |
| |
| const char* ContentCaptureReceiver::MessageToMethodName_(mojo::Message& message) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| bool is_response = message.has_flag(mojo::Message::kFlagIsResponse); |
| if (!is_response) { |
| switch (message.name()) { |
| case internal::kContentCaptureReceiver_DidCaptureContent_Name: |
| return "Receive content_capture::mojom::ContentCaptureReceiver::DidCaptureContent"; |
| case internal::kContentCaptureReceiver_DidUpdateContent_Name: |
| return "Receive content_capture::mojom::ContentCaptureReceiver::DidUpdateContent"; |
| case internal::kContentCaptureReceiver_DidRemoveContent_Name: |
| return "Receive content_capture::mojom::ContentCaptureReceiver::DidRemoveContent"; |
| } |
| } else { |
| switch (message.name()) { |
| case internal::kContentCaptureReceiver_DidCaptureContent_Name: |
| return "Receive reply content_capture::mojom::ContentCaptureReceiver::DidCaptureContent"; |
| case internal::kContentCaptureReceiver_DidUpdateContent_Name: |
| return "Receive reply content_capture::mojom::ContentCaptureReceiver::DidUpdateContent"; |
| case internal::kContentCaptureReceiver_DidRemoveContent_Name: |
| return "Receive reply content_capture::mojom::ContentCaptureReceiver::DidRemoveContent"; |
| } |
| } |
| return "Receive unknown mojo message"; |
| #else |
| bool is_response = message.has_flag(mojo::Message::kFlagIsResponse); |
| if (is_response) { |
| return "Receive mojo reply"; |
| } else { |
| return "Receive mojo message"; |
| } |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| } |
| |
| #if !BUILDFLAG(IS_FUCHSIA) |
| void ContentCaptureReceiver::DidCaptureContent_Sym::IPCSymbol() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symblozation. So each IPCSymbol should have a unique address. |
| NO_CODE_FOLDING(); |
| } |
| void ContentCaptureReceiver::DidUpdateContent_Sym::IPCSymbol() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symblozation. So each IPCSymbol should have a unique address. |
| NO_CODE_FOLDING(); |
| } |
| void ContentCaptureReceiver::DidRemoveContent_Sym::IPCSymbol() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symblozation. So each IPCSymbol should have a unique address. |
| NO_CODE_FOLDING(); |
| } |
| # endif // !BUILDFLAG(IS_FUCHSIA) |
| |
| ContentCaptureReceiverProxy::ContentCaptureReceiverProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void ContentCaptureReceiverProxy::DidCaptureContent( |
| ::content_capture::mojom::blink::ContentCaptureDataPtr in_data, bool in_first_data) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send content_capture::mojom::ContentCaptureReceiver::DidCaptureContent", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("data"), in_data, |
| "<value of type ::content_capture::mojom::blink::ContentCaptureDataPtr>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("first_data"), in_first_data, |
| "<value of type bool>"); |
| }); |
| #endif |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kContentCaptureReceiver_DidCaptureContent_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::content_capture::mojom::internal::ContentCaptureReceiver_DidCaptureContent_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->data)::BaseType> data_fragment( |
| params.message()); |
| mojo::internal::Serialize<::content_capture::mojom::ContentCaptureDataDataView>( |
| in_data, data_fragment); |
| params->data.Set( |
| data_fragment.is_null() ? nullptr : data_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->data.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null data in ContentCaptureReceiver.DidCaptureContent request"); |
| params->first_data = in_first_data; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(ContentCaptureReceiver::Name_); |
| message.set_method_name("DidCaptureContent"); |
| #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::SendMessage(*receiver_, message); |
| } |
| |
| void ContentCaptureReceiverProxy::DidUpdateContent( |
| ::content_capture::mojom::blink::ContentCaptureDataPtr in_data) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send content_capture::mojom::ContentCaptureReceiver::DidUpdateContent", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("data"), in_data, |
| "<value of type ::content_capture::mojom::blink::ContentCaptureDataPtr>"); |
| }); |
| #endif |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kContentCaptureReceiver_DidUpdateContent_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::content_capture::mojom::internal::ContentCaptureReceiver_DidUpdateContent_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->data)::BaseType> data_fragment( |
| params.message()); |
| mojo::internal::Serialize<::content_capture::mojom::ContentCaptureDataDataView>( |
| in_data, data_fragment); |
| params->data.Set( |
| data_fragment.is_null() ? nullptr : data_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->data.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null data in ContentCaptureReceiver.DidUpdateContent request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(ContentCaptureReceiver::Name_); |
| message.set_method_name("DidUpdateContent"); |
| #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::SendMessage(*receiver_, message); |
| } |
| |
| void ContentCaptureReceiverProxy::DidRemoveContent( |
| const WTF::Vector<int64_t>& in_ids) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send content_capture::mojom::ContentCaptureReceiver::DidRemoveContent", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("ids"), in_ids, |
| "<value of type const WTF::Vector<int64_t>&>"); |
| }); |
| #endif |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kContentCaptureReceiver_DidRemoveContent_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::content_capture::mojom::internal::ContentCaptureReceiver_DidRemoveContent_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->ids)::BaseType> |
| ids_fragment(params.message()); |
| const mojo::internal::ContainerValidateParams ids_validate_params( |
| 0, false, nullptr); |
| mojo::internal::Serialize<mojo::ArrayDataView<int64_t>>( |
| in_ids, ids_fragment, &ids_validate_params); |
| params->ids.Set( |
| ids_fragment.is_null() ? nullptr : ids_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->ids.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null ids in ContentCaptureReceiver.DidRemoveContent request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(ContentCaptureReceiver::Name_); |
| message.set_method_name("DidRemoveContent"); |
| #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::SendMessage(*receiver_, message); |
| } |
| |
| // static |
| bool ContentCaptureReceiverStubDispatch::Accept( |
| ContentCaptureReceiver* impl, |
| mojo::Message* message) { |
| switch (message->header()->name) { |
| case internal::kContentCaptureReceiver_DidCaptureContent_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::ContentCaptureReceiver_DidCaptureContent_Params_Data* params = |
| reinterpret_cast<internal::ContentCaptureReceiver_DidCaptureContent_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::content_capture::mojom::blink::ContentCaptureDataPtr p_data{}; |
| bool p_first_data{}; |
| ContentCaptureReceiver_DidCaptureContent_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadData(&p_data)) |
| success = false; |
| if (success) |
| p_first_data = input_data_view.first_data(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| ContentCaptureReceiver::Name_, 0, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->DidCaptureContent( |
| std::move(p_data), |
| std::move(p_first_data)); |
| return true; |
| } |
| case internal::kContentCaptureReceiver_DidUpdateContent_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::ContentCaptureReceiver_DidUpdateContent_Params_Data* params = |
| reinterpret_cast<internal::ContentCaptureReceiver_DidUpdateContent_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::content_capture::mojom::blink::ContentCaptureDataPtr p_data{}; |
| ContentCaptureReceiver_DidUpdateContent_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadData(&p_data)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| ContentCaptureReceiver::Name_, 1, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->DidUpdateContent( |
| std::move(p_data)); |
| return true; |
| } |
| case internal::kContentCaptureReceiver_DidRemoveContent_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::ContentCaptureReceiver_DidRemoveContent_Params_Data* params = |
| reinterpret_cast<internal::ContentCaptureReceiver_DidRemoveContent_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| WTF::Vector<int64_t> p_ids{}; |
| ContentCaptureReceiver_DidRemoveContent_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadIds(&p_ids)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| ContentCaptureReceiver::Name_, 2, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->DidRemoveContent( |
| std::move(p_ids)); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool ContentCaptureReceiverStubDispatch::AcceptWithResponder( |
| ContentCaptureReceiver* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| [[maybe_unused]] const bool message_is_sync = |
| message->has_flag(mojo::Message::kFlagIsSync); |
| [[maybe_unused]] const uint64_t request_id = message->request_id(); |
| switch (message->header()->name) { |
| case internal::kContentCaptureReceiver_DidCaptureContent_Name: { |
| break; |
| } |
| case internal::kContentCaptureReceiver_DidUpdateContent_Name: { |
| break; |
| } |
| case internal::kContentCaptureReceiver_DidRemoveContent_Name: { |
| break; |
| } |
| } |
| return false; |
| } |
| |
| |
| static const mojo::internal::GenericValidationInfo kContentCaptureReceiverValidationInfo[] = { |
| {&internal::ContentCaptureReceiver_DidCaptureContent_Params_Data::Validate, |
| nullptr /* no response */}, |
| {&internal::ContentCaptureReceiver_DidUpdateContent_Params_Data::Validate, |
| nullptr /* no response */}, |
| {&internal::ContentCaptureReceiver_DidRemoveContent_Params_Data::Validate, |
| nullptr /* no response */}, |
| }; |
| |
| bool ContentCaptureReceiverRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::content_capture::mojom::blink::ContentCaptureReceiver::Name_; |
| return mojo::internal::ValidateRequestGenericPacked(message, name, kContentCaptureReceiverValidationInfo); |
| } |
| |
| const char ContentCaptureSender::Name_[] = "content_capture.mojom.ContentCaptureSender"; |
| |
| std::pair<uint32_t, const void*> ContentCaptureSender::MessageToMethodInfo_(mojo::Message& message) { |
| switch (message.name()) { |
| case internal::kContentCaptureSender_StartCapture_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)content_capture::mojom::ContentCaptureSender::StartCapture"); |
| #if BUILDFLAG(IS_FUCHSIA) |
| return std::make_pair(value, nullptr); |
| #else |
| return std::make_pair(value, reinterpret_cast<const void*>(&ContentCaptureSender::StartCapture_Sym::IPCSymbol)); |
| #endif // BUILDFLAG(IS_FUCHSIA) |
| } |
| case internal::kContentCaptureSender_StopCapture_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)content_capture::mojom::ContentCaptureSender::StopCapture"); |
| #if BUILDFLAG(IS_FUCHSIA) |
| return std::make_pair(value, nullptr); |
| #else |
| return std::make_pair(value, reinterpret_cast<const void*>(&ContentCaptureSender::StopCapture_Sym::IPCSymbol)); |
| #endif // BUILDFLAG(IS_FUCHSIA) |
| } |
| } |
| return std::make_pair(0, nullptr); |
| } |
| |
| |
| const char* ContentCaptureSender::MessageToMethodName_(mojo::Message& message) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| bool is_response = message.has_flag(mojo::Message::kFlagIsResponse); |
| if (!is_response) { |
| switch (message.name()) { |
| case internal::kContentCaptureSender_StartCapture_Name: |
| return "Receive content_capture::mojom::ContentCaptureSender::StartCapture"; |
| case internal::kContentCaptureSender_StopCapture_Name: |
| return "Receive content_capture::mojom::ContentCaptureSender::StopCapture"; |
| } |
| } else { |
| switch (message.name()) { |
| case internal::kContentCaptureSender_StartCapture_Name: |
| return "Receive reply content_capture::mojom::ContentCaptureSender::StartCapture"; |
| case internal::kContentCaptureSender_StopCapture_Name: |
| return "Receive reply content_capture::mojom::ContentCaptureSender::StopCapture"; |
| } |
| } |
| return "Receive unknown mojo message"; |
| #else |
| bool is_response = message.has_flag(mojo::Message::kFlagIsResponse); |
| if (is_response) { |
| return "Receive mojo reply"; |
| } else { |
| return "Receive mojo message"; |
| } |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| } |
| |
| #if !BUILDFLAG(IS_FUCHSIA) |
| void ContentCaptureSender::StartCapture_Sym::IPCSymbol() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symblozation. So each IPCSymbol should have a unique address. |
| NO_CODE_FOLDING(); |
| } |
| void ContentCaptureSender::StopCapture_Sym::IPCSymbol() { |
| // This method's address is used for indetifiying the mojo method name after |
| // symblozation. So each IPCSymbol should have a unique address. |
| NO_CODE_FOLDING(); |
| } |
| # endif // !BUILDFLAG(IS_FUCHSIA) |
| |
| ContentCaptureSenderProxy::ContentCaptureSenderProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void ContentCaptureSenderProxy::StartCapture( |
| ) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send content_capture::mojom::ContentCaptureSender::StartCapture"); |
| #endif |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kContentCaptureSender_StartCapture_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::content_capture::mojom::internal::ContentCaptureSender_StartCapture_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(ContentCaptureSender::Name_); |
| message.set_method_name("StartCapture"); |
| #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::SendMessage(*receiver_, message); |
| } |
| |
| void ContentCaptureSenderProxy::StopCapture( |
| ) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT0("mojom", "Send content_capture::mojom::ContentCaptureSender::StopCapture"); |
| #endif |
| const bool kExpectsResponse = false; |
| const bool kIsSync = false; |
| const bool kAllowInterrupt = true; |
| |
| const uint32_t kFlags = |
| ((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) | |
| ((kIsSync) ? mojo::Message::kFlagIsSync : 0) | |
| ((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt); |
| |
| mojo::Message message( |
| internal::kContentCaptureSender_StopCapture_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::content_capture::mojom::internal::ContentCaptureSender_StopCapture_Params_Data> params( |
| message); |
| params.Allocate(); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(ContentCaptureSender::Name_); |
| message.set_method_name("StopCapture"); |
| #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::SendMessage(*receiver_, message); |
| } |
| |
| // static |
| bool ContentCaptureSenderStubDispatch::Accept( |
| ContentCaptureSender* impl, |
| mojo::Message* message) { |
| switch (message->header()->name) { |
| case internal::kContentCaptureSender_StartCapture_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::ContentCaptureSender_StartCapture_Params_Data* params = |
| reinterpret_cast<internal::ContentCaptureSender_StartCapture_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ContentCaptureSender_StartCapture_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| ContentCaptureSender::Name_, 0, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->StartCapture(); |
| return true; |
| } |
| case internal::kContentCaptureSender_StopCapture_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::ContentCaptureSender_StopCapture_Params_Data* params = |
| reinterpret_cast<internal::ContentCaptureSender_StopCapture_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ContentCaptureSender_StopCapture_ParamsDataView input_data_view(params, message); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| ContentCaptureSender::Name_, 1, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->StopCapture(); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool ContentCaptureSenderStubDispatch::AcceptWithResponder( |
| ContentCaptureSender* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| [[maybe_unused]] const bool message_is_sync = |
| message->has_flag(mojo::Message::kFlagIsSync); |
| [[maybe_unused]] const uint64_t request_id = message->request_id(); |
| switch (message->header()->name) { |
| case internal::kContentCaptureSender_StartCapture_Name: { |
| break; |
| } |
| case internal::kContentCaptureSender_StopCapture_Name: { |
| break; |
| } |
| } |
| return false; |
| } |
| |
| |
| static const mojo::internal::GenericValidationInfo kContentCaptureSenderValidationInfo[] = { |
| {&internal::ContentCaptureSender_StartCapture_Params_Data::Validate, |
| nullptr /* no response */}, |
| {&internal::ContentCaptureSender_StopCapture_Params_Data::Validate, |
| nullptr /* no response */}, |
| }; |
| |
| bool ContentCaptureSenderRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::content_capture::mojom::blink::ContentCaptureSender::Name_; |
| return mojo::internal::ValidateRequestGenericPacked(message, name, kContentCaptureSenderValidationInfo); |
| } |
| |
| |
| |
| } // namespace blink |
| } // namespace mojom |
| } // namespace content_capture |
| |
| |
| 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 content_capture { |
| namespace mojom { |
| namespace blink { |
| |
| |
| void ContentCaptureReceiverInterceptorForTesting::DidCaptureContent(::content_capture::mojom::blink::ContentCaptureDataPtr data, bool first_data) { |
| GetForwardingInterface()->DidCaptureContent(std::move(data), std::move(first_data)); |
| } |
| void ContentCaptureReceiverInterceptorForTesting::DidUpdateContent(::content_capture::mojom::blink::ContentCaptureDataPtr data) { |
| GetForwardingInterface()->DidUpdateContent(std::move(data)); |
| } |
| void ContentCaptureReceiverInterceptorForTesting::DidRemoveContent(const WTF::Vector<int64_t>& ids) { |
| GetForwardingInterface()->DidRemoveContent(std::move(ids)); |
| } |
| ContentCaptureReceiverAsyncWaiter::ContentCaptureReceiverAsyncWaiter( |
| ContentCaptureReceiver* proxy) : proxy_(proxy) {} |
| |
| ContentCaptureReceiverAsyncWaiter::~ContentCaptureReceiverAsyncWaiter() = default; |
| |
| |
| |
| |
| void ContentCaptureSenderInterceptorForTesting::StartCapture() { |
| GetForwardingInterface()->StartCapture(); |
| } |
| void ContentCaptureSenderInterceptorForTesting::StopCapture() { |
| GetForwardingInterface()->StopCapture(); |
| } |
| ContentCaptureSenderAsyncWaiter::ContentCaptureSenderAsyncWaiter( |
| ContentCaptureSender* proxy) : proxy_(proxy) {} |
| |
| ContentCaptureSenderAsyncWaiter::~ContentCaptureSenderAsyncWaiter() = default; |
| |
| |
| |
| |
| |
| |
| } // namespace blink |
| } // namespace mojom |
| } // namespace content_capture |
| |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic pop |
| #endif |