| // ui/webui/resources/cr_components/help_bubble/help_bubble.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 "ui/webui/resources/cr_components/help_bubble/help_bubble.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 "ui/webui/resources/cr_components/help_bubble/help_bubble.mojom-params-data.h" |
| #include "ui/webui/resources/cr_components/help_bubble/help_bubble.mojom-shared-message-ids.h" |
| |
| #include "ui/webui/resources/cr_components/help_bubble/help_bubble.mojom-blink-import-headers.h" |
| #include "ui/webui/resources/cr_components/help_bubble/help_bubble.mojom-blink-test-utils.h" |
| #include "mojo/public/cpp/bindings/lib/wtf_serialization.h" |
| |
| |
| #ifndef UI_WEBUI_RESOURCES_CR_COMPONENTS_HELP_BUBBLE_HELP_BUBBLE_MOJOM_BLINK_JUMBO_H_ |
| #define UI_WEBUI_RESOURCES_CR_COMPONENTS_HELP_BUBBLE_HELP_BUBBLE_MOJOM_BLINK_JUMBO_H_ |
| #endif |
| |
| |
| |
| namespace help_bubble { |
| namespace mojom { |
| namespace blink { |
| HelpBubbleButtonParams::HelpBubbleButtonParams() |
| : text(), |
| is_default(false) {} |
| |
| HelpBubbleButtonParams::HelpBubbleButtonParams( |
| const WTF::String& text_in, |
| bool is_default_in) |
| : text(std::move(text_in)), |
| is_default(std::move(is_default_in)) {} |
| |
| HelpBubbleButtonParams::~HelpBubbleButtonParams() = default; |
| size_t HelpBubbleButtonParams::Hash(size_t seed) const { |
| seed = mojo::internal::WTFHash(seed, this->text); |
| seed = mojo::internal::WTFHash(seed, this->is_default); |
| return seed; |
| } |
| |
| void HelpBubbleButtonParams::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "text"), this->text, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type const WTF::String&>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "is_default"), this->is_default, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type bool>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool HelpBubbleButtonParams::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| HelpBubbleParams::HelpBubbleParams() |
| : native_identifier(), |
| position(HelpBubblePosition::BELOW), |
| title_text(), |
| body_text(), |
| buttons() {} |
| |
| HelpBubbleParams::HelpBubbleParams( |
| const WTF::String& native_identifier_in, |
| HelpBubblePosition position_in, |
| const WTF::String& title_text_in, |
| const WTF::String& body_text_in, |
| WTF::Vector<HelpBubbleButtonParamsPtr> buttons_in) |
| : native_identifier(std::move(native_identifier_in)), |
| position(std::move(position_in)), |
| title_text(std::move(title_text_in)), |
| body_text(std::move(body_text_in)), |
| buttons(std::move(buttons_in)) {} |
| |
| HelpBubbleParams::~HelpBubbleParams() = default; |
| |
| void HelpBubbleParams::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "native_identifier"), this->native_identifier, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type const WTF::String&>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "position"), this->position, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type HelpBubblePosition>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "title_text"), this->title_text, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type const WTF::String&>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "body_text"), this->body_text, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type const WTF::String&>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "buttons"), this->buttons, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type WTF::Vector<HelpBubbleButtonParamsPtr>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool HelpBubbleParams::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| const char HelpBubbleHandlerFactory::Name_[] = "help_bubble.mojom.HelpBubbleHandlerFactory"; |
| |
| std::pair<uint32_t, const void*> HelpBubbleHandlerFactory::MessageToMethodInfo_(mojo::Message& message) { |
| switch (message.name()) { |
| case internal::kHelpBubbleHandlerFactory_CreateHelpBubbleHandler_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)help_bubble::mojom::HelpBubbleHandlerFactory::CreateHelpBubbleHandler"); |
| return std::make_pair(value, reinterpret_cast<const void*>(&HelpBubbleHandlerFactory::CreateHelpBubbleHandler_Sym::IPCSymbol)); |
| } |
| } |
| return std::make_pair(0, nullptr); |
| } |
| |
| |
| const char* HelpBubbleHandlerFactory::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::kHelpBubbleHandlerFactory_CreateHelpBubbleHandler_Name: |
| return "Receive help_bubble::mojom::HelpBubbleHandlerFactory::CreateHelpBubbleHandler"; |
| } |
| } else { |
| switch (message.name()) { |
| case internal::kHelpBubbleHandlerFactory_CreateHelpBubbleHandler_Name: |
| return "Receive reply help_bubble::mojom::HelpBubbleHandlerFactory::CreateHelpBubbleHandler"; |
| } |
| } |
| 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) |
| } |
| void HelpBubbleHandlerFactory::CreateHelpBubbleHandler_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(); |
| } |
| |
| HelpBubbleHandlerFactoryProxy::HelpBubbleHandlerFactoryProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void HelpBubbleHandlerFactoryProxy::CreateHelpBubbleHandler( |
| ::mojo::PendingRemote<HelpBubbleClient> in_client, ::mojo::PendingReceiver<HelpBubbleHandler> in_handler) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send help_bubble::mojom::HelpBubbleHandlerFactory::CreateHelpBubbleHandler", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("client"), in_client, |
| "<value of type ::mojo::PendingRemote<HelpBubbleClient>>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("handler"), in_handler, |
| "<value of type ::mojo::PendingReceiver<HelpBubbleHandler>>"); |
| }); |
| #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::kHelpBubbleHandlerFactory_CreateHelpBubbleHandler_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::help_bubble::mojom::internal::HelpBubbleHandlerFactory_CreateHelpBubbleHandler_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::Serialize<mojo::InterfacePtrDataView<::help_bubble::mojom::HelpBubbleClientInterfaceBase>>( |
| in_client, ¶ms->client, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->client), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid client in HelpBubbleHandlerFactory.CreateHelpBubbleHandler request"); |
| mojo::internal::Serialize<mojo::InterfaceRequestDataView<::help_bubble::mojom::HelpBubbleHandlerInterfaceBase>>( |
| in_handler, ¶ms->handler, ¶ms.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(params->handler), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid handler in HelpBubbleHandlerFactory.CreateHelpBubbleHandler request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(HelpBubbleHandlerFactory::Name_); |
| message.set_method_name("CreateHelpBubbleHandler"); |
| #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 HelpBubbleHandlerFactoryStubDispatch::Accept( |
| HelpBubbleHandlerFactory* impl, |
| mojo::Message* message) { |
| switch (message->header()->name) { |
| case internal::kHelpBubbleHandlerFactory_CreateHelpBubbleHandler_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::HelpBubbleHandlerFactory_CreateHelpBubbleHandler_Params_Data* params = |
| reinterpret_cast<internal::HelpBubbleHandlerFactory_CreateHelpBubbleHandler_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| ::mojo::PendingRemote<HelpBubbleClient> p_client{}; |
| ::mojo::PendingReceiver<HelpBubbleHandler> p_handler{}; |
| HelpBubbleHandlerFactory_CreateHelpBubbleHandler_ParamsDataView input_data_view(params, message); |
| |
| if (success) { |
| p_client = |
| input_data_view.TakeClient<decltype(p_client)>(); |
| } |
| if (success) { |
| p_handler = |
| input_data_view.TakeHandler<decltype(p_handler)>(); |
| } |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| HelpBubbleHandlerFactory::Name_, 0, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->CreateHelpBubbleHandler( |
| std::move(p_client), |
| std::move(p_handler)); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool HelpBubbleHandlerFactoryStubDispatch::AcceptWithResponder( |
| HelpBubbleHandlerFactory* 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::kHelpBubbleHandlerFactory_CreateHelpBubbleHandler_Name: { |
| break; |
| } |
| } |
| return false; |
| } |
| |
| |
| static const std::pair<uint32_t, mojo::internal::GenericValidationInfo> kHelpBubbleHandlerFactoryValidationInfo[] = { |
| {internal::kHelpBubbleHandlerFactory_CreateHelpBubbleHandler_Name, |
| {&internal::HelpBubbleHandlerFactory_CreateHelpBubbleHandler_Params_Data::Validate, |
| nullptr /* no response */}}, |
| }; |
| |
| bool HelpBubbleHandlerFactoryRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::help_bubble::mojom::blink::HelpBubbleHandlerFactory::Name_; |
| return mojo::internal::ValidateRequestGeneric(message, name, kHelpBubbleHandlerFactoryValidationInfo); |
| } |
| |
| const char HelpBubbleHandler::Name_[] = "help_bubble.mojom.HelpBubbleHandler"; |
| |
| std::pair<uint32_t, const void*> HelpBubbleHandler::MessageToMethodInfo_(mojo::Message& message) { |
| switch (message.name()) { |
| case internal::kHelpBubbleHandler_HelpBubbleAnchorVisibilityChanged_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)help_bubble::mojom::HelpBubbleHandler::HelpBubbleAnchorVisibilityChanged"); |
| return std::make_pair(value, reinterpret_cast<const void*>(&HelpBubbleHandler::HelpBubbleAnchorVisibilityChanged_Sym::IPCSymbol)); |
| } |
| case internal::kHelpBubbleHandler_HelpBubbleButtonPressed_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)help_bubble::mojom::HelpBubbleHandler::HelpBubbleButtonPressed"); |
| return std::make_pair(value, reinterpret_cast<const void*>(&HelpBubbleHandler::HelpBubbleButtonPressed_Sym::IPCSymbol)); |
| } |
| case internal::kHelpBubbleHandler_HelpBubbleClosed_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)help_bubble::mojom::HelpBubbleHandler::HelpBubbleClosed"); |
| return std::make_pair(value, reinterpret_cast<const void*>(&HelpBubbleHandler::HelpBubbleClosed_Sym::IPCSymbol)); |
| } |
| } |
| return std::make_pair(0, nullptr); |
| } |
| |
| |
| const char* HelpBubbleHandler::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::kHelpBubbleHandler_HelpBubbleAnchorVisibilityChanged_Name: |
| return "Receive help_bubble::mojom::HelpBubbleHandler::HelpBubbleAnchorVisibilityChanged"; |
| case internal::kHelpBubbleHandler_HelpBubbleButtonPressed_Name: |
| return "Receive help_bubble::mojom::HelpBubbleHandler::HelpBubbleButtonPressed"; |
| case internal::kHelpBubbleHandler_HelpBubbleClosed_Name: |
| return "Receive help_bubble::mojom::HelpBubbleHandler::HelpBubbleClosed"; |
| } |
| } else { |
| switch (message.name()) { |
| case internal::kHelpBubbleHandler_HelpBubbleAnchorVisibilityChanged_Name: |
| return "Receive reply help_bubble::mojom::HelpBubbleHandler::HelpBubbleAnchorVisibilityChanged"; |
| case internal::kHelpBubbleHandler_HelpBubbleButtonPressed_Name: |
| return "Receive reply help_bubble::mojom::HelpBubbleHandler::HelpBubbleButtonPressed"; |
| case internal::kHelpBubbleHandler_HelpBubbleClosed_Name: |
| return "Receive reply help_bubble::mojom::HelpBubbleHandler::HelpBubbleClosed"; |
| } |
| } |
| 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) |
| } |
| void HelpBubbleHandler::HelpBubbleAnchorVisibilityChanged_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 HelpBubbleHandler::HelpBubbleButtonPressed_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 HelpBubbleHandler::HelpBubbleClosed_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(); |
| } |
| |
| HelpBubbleHandlerProxy::HelpBubbleHandlerProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void HelpBubbleHandlerProxy::HelpBubbleAnchorVisibilityChanged( |
| const WTF::String& in_native_identifier, bool in_visible) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send help_bubble::mojom::HelpBubbleHandler::HelpBubbleAnchorVisibilityChanged", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("native_identifier"), in_native_identifier, |
| "<value of type const WTF::String&>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("visible"), in_visible, |
| "<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::kHelpBubbleHandler_HelpBubbleAnchorVisibilityChanged_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::help_bubble::mojom::internal::HelpBubbleHandler_HelpBubbleAnchorVisibilityChanged_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->native_identifier)::BaseType> native_identifier_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_native_identifier, native_identifier_fragment); |
| params->native_identifier.Set( |
| native_identifier_fragment.is_null() ? nullptr : native_identifier_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->native_identifier.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null native_identifier in HelpBubbleHandler.HelpBubbleAnchorVisibilityChanged request"); |
| params->visible = in_visible; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(HelpBubbleHandler::Name_); |
| message.set_method_name("HelpBubbleAnchorVisibilityChanged"); |
| #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 HelpBubbleHandlerProxy::HelpBubbleButtonPressed( |
| const WTF::String& in_native_identifier, uint8_t in_button_index) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send help_bubble::mojom::HelpBubbleHandler::HelpBubbleButtonPressed", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("native_identifier"), in_native_identifier, |
| "<value of type const WTF::String&>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("button_index"), in_button_index, |
| "<value of type uint8_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::kHelpBubbleHandler_HelpBubbleButtonPressed_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::help_bubble::mojom::internal::HelpBubbleHandler_HelpBubbleButtonPressed_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->native_identifier)::BaseType> native_identifier_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_native_identifier, native_identifier_fragment); |
| params->native_identifier.Set( |
| native_identifier_fragment.is_null() ? nullptr : native_identifier_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->native_identifier.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null native_identifier in HelpBubbleHandler.HelpBubbleButtonPressed request"); |
| params->button_index = in_button_index; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(HelpBubbleHandler::Name_); |
| message.set_method_name("HelpBubbleButtonPressed"); |
| #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 HelpBubbleHandlerProxy::HelpBubbleClosed( |
| const WTF::String& in_native_identifier, bool in_by_user) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send help_bubble::mojom::HelpBubbleHandler::HelpBubbleClosed", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("native_identifier"), in_native_identifier, |
| "<value of type const WTF::String&>"); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("by_user"), in_by_user, |
| "<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::kHelpBubbleHandler_HelpBubbleClosed_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::help_bubble::mojom::internal::HelpBubbleHandler_HelpBubbleClosed_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->native_identifier)::BaseType> native_identifier_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_native_identifier, native_identifier_fragment); |
| params->native_identifier.Set( |
| native_identifier_fragment.is_null() ? nullptr : native_identifier_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->native_identifier.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null native_identifier in HelpBubbleHandler.HelpBubbleClosed request"); |
| params->by_user = in_by_user; |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(HelpBubbleHandler::Name_); |
| message.set_method_name("HelpBubbleClosed"); |
| #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 HelpBubbleHandlerStubDispatch::Accept( |
| HelpBubbleHandler* impl, |
| mojo::Message* message) { |
| switch (message->header()->name) { |
| case internal::kHelpBubbleHandler_HelpBubbleAnchorVisibilityChanged_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::HelpBubbleHandler_HelpBubbleAnchorVisibilityChanged_Params_Data* params = |
| reinterpret_cast<internal::HelpBubbleHandler_HelpBubbleAnchorVisibilityChanged_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| WTF::String p_native_identifier{}; |
| bool p_visible{}; |
| HelpBubbleHandler_HelpBubbleAnchorVisibilityChanged_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadNativeIdentifier(&p_native_identifier)) |
| success = false; |
| if (success) |
| p_visible = input_data_view.visible(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| HelpBubbleHandler::Name_, 0, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->HelpBubbleAnchorVisibilityChanged( |
| std::move(p_native_identifier), |
| std::move(p_visible)); |
| return true; |
| } |
| case internal::kHelpBubbleHandler_HelpBubbleButtonPressed_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::HelpBubbleHandler_HelpBubbleButtonPressed_Params_Data* params = |
| reinterpret_cast<internal::HelpBubbleHandler_HelpBubbleButtonPressed_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| WTF::String p_native_identifier{}; |
| uint8_t p_button_index{}; |
| HelpBubbleHandler_HelpBubbleButtonPressed_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadNativeIdentifier(&p_native_identifier)) |
| success = false; |
| if (success) |
| p_button_index = input_data_view.button_index(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| HelpBubbleHandler::Name_, 1, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->HelpBubbleButtonPressed( |
| std::move(p_native_identifier), |
| std::move(p_button_index)); |
| return true; |
| } |
| case internal::kHelpBubbleHandler_HelpBubbleClosed_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::HelpBubbleHandler_HelpBubbleClosed_Params_Data* params = |
| reinterpret_cast<internal::HelpBubbleHandler_HelpBubbleClosed_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| WTF::String p_native_identifier{}; |
| bool p_by_user{}; |
| HelpBubbleHandler_HelpBubbleClosed_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadNativeIdentifier(&p_native_identifier)) |
| success = false; |
| if (success) |
| p_by_user = input_data_view.by_user(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| HelpBubbleHandler::Name_, 2, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->HelpBubbleClosed( |
| std::move(p_native_identifier), |
| std::move(p_by_user)); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool HelpBubbleHandlerStubDispatch::AcceptWithResponder( |
| HelpBubbleHandler* 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::kHelpBubbleHandler_HelpBubbleAnchorVisibilityChanged_Name: { |
| break; |
| } |
| case internal::kHelpBubbleHandler_HelpBubbleButtonPressed_Name: { |
| break; |
| } |
| case internal::kHelpBubbleHandler_HelpBubbleClosed_Name: { |
| break; |
| } |
| } |
| return false; |
| } |
| |
| |
| static const std::pair<uint32_t, mojo::internal::GenericValidationInfo> kHelpBubbleHandlerValidationInfo[] = { |
| {internal::kHelpBubbleHandler_HelpBubbleAnchorVisibilityChanged_Name, |
| {&internal::HelpBubbleHandler_HelpBubbleAnchorVisibilityChanged_Params_Data::Validate, |
| nullptr /* no response */}}, |
| {internal::kHelpBubbleHandler_HelpBubbleButtonPressed_Name, |
| {&internal::HelpBubbleHandler_HelpBubbleButtonPressed_Params_Data::Validate, |
| nullptr /* no response */}}, |
| {internal::kHelpBubbleHandler_HelpBubbleClosed_Name, |
| {&internal::HelpBubbleHandler_HelpBubbleClosed_Params_Data::Validate, |
| nullptr /* no response */}}, |
| }; |
| |
| bool HelpBubbleHandlerRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::help_bubble::mojom::blink::HelpBubbleHandler::Name_; |
| return mojo::internal::ValidateRequestGeneric(message, name, kHelpBubbleHandlerValidationInfo); |
| } |
| |
| const char HelpBubbleClient::Name_[] = "help_bubble.mojom.HelpBubbleClient"; |
| |
| std::pair<uint32_t, const void*> HelpBubbleClient::MessageToMethodInfo_(mojo::Message& message) { |
| switch (message.name()) { |
| case internal::kHelpBubbleClient_ShowHelpBubble_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)help_bubble::mojom::HelpBubbleClient::ShowHelpBubble"); |
| return std::make_pair(value, reinterpret_cast<const void*>(&HelpBubbleClient::ShowHelpBubble_Sym::IPCSymbol)); |
| } |
| case internal::kHelpBubbleClient_ToggleFocusForAccessibility_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)help_bubble::mojom::HelpBubbleClient::ToggleFocusForAccessibility"); |
| return std::make_pair(value, reinterpret_cast<const void*>(&HelpBubbleClient::ToggleFocusForAccessibility_Sym::IPCSymbol)); |
| } |
| case internal::kHelpBubbleClient_HideHelpBubble_Name: { |
| constexpr uint32_t value = base::MD5Hash32Constexpr( |
| "(Impl)help_bubble::mojom::HelpBubbleClient::HideHelpBubble"); |
| return std::make_pair(value, reinterpret_cast<const void*>(&HelpBubbleClient::HideHelpBubble_Sym::IPCSymbol)); |
| } |
| } |
| return std::make_pair(0, nullptr); |
| } |
| |
| |
| const char* HelpBubbleClient::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::kHelpBubbleClient_ShowHelpBubble_Name: |
| return "Receive help_bubble::mojom::HelpBubbleClient::ShowHelpBubble"; |
| case internal::kHelpBubbleClient_ToggleFocusForAccessibility_Name: |
| return "Receive help_bubble::mojom::HelpBubbleClient::ToggleFocusForAccessibility"; |
| case internal::kHelpBubbleClient_HideHelpBubble_Name: |
| return "Receive help_bubble::mojom::HelpBubbleClient::HideHelpBubble"; |
| } |
| } else { |
| switch (message.name()) { |
| case internal::kHelpBubbleClient_ShowHelpBubble_Name: |
| return "Receive reply help_bubble::mojom::HelpBubbleClient::ShowHelpBubble"; |
| case internal::kHelpBubbleClient_ToggleFocusForAccessibility_Name: |
| return "Receive reply help_bubble::mojom::HelpBubbleClient::ToggleFocusForAccessibility"; |
| case internal::kHelpBubbleClient_HideHelpBubble_Name: |
| return "Receive reply help_bubble::mojom::HelpBubbleClient::HideHelpBubble"; |
| } |
| } |
| 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) |
| } |
| void HelpBubbleClient::ShowHelpBubble_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 HelpBubbleClient::ToggleFocusForAccessibility_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 HelpBubbleClient::HideHelpBubble_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(); |
| } |
| |
| HelpBubbleClientProxy::HelpBubbleClientProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void HelpBubbleClientProxy::ShowHelpBubble( |
| HelpBubbleParamsPtr in_params) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send help_bubble::mojom::HelpBubbleClient::ShowHelpBubble", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("params"), in_params, |
| "<value of type HelpBubbleParamsPtr>"); |
| }); |
| #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::kHelpBubbleClient_ShowHelpBubble_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::help_bubble::mojom::internal::HelpBubbleClient_ShowHelpBubble_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->params)::BaseType> params_fragment( |
| params.message()); |
| mojo::internal::Serialize<::help_bubble::mojom::HelpBubbleParamsDataView>( |
| in_params, params_fragment); |
| params->params.Set( |
| params_fragment.is_null() ? nullptr : params_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->params.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null params in HelpBubbleClient.ShowHelpBubble request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(HelpBubbleClient::Name_); |
| message.set_method_name("ShowHelpBubble"); |
| #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 HelpBubbleClientProxy::ToggleFocusForAccessibility( |
| const WTF::String& in_native_identifier) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send help_bubble::mojom::HelpBubbleClient::ToggleFocusForAccessibility", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("native_identifier"), in_native_identifier, |
| "<value of type const WTF::String&>"); |
| }); |
| #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::kHelpBubbleClient_ToggleFocusForAccessibility_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::help_bubble::mojom::internal::HelpBubbleClient_ToggleFocusForAccessibility_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->native_identifier)::BaseType> native_identifier_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_native_identifier, native_identifier_fragment); |
| params->native_identifier.Set( |
| native_identifier_fragment.is_null() ? nullptr : native_identifier_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->native_identifier.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null native_identifier in HelpBubbleClient.ToggleFocusForAccessibility request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(HelpBubbleClient::Name_); |
| message.set_method_name("ToggleFocusForAccessibility"); |
| #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 HelpBubbleClientProxy::HideHelpBubble( |
| const WTF::String& in_native_identifier) { |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| TRACE_EVENT1( |
| "mojom", "Send help_bubble::mojom::HelpBubbleClient::HideHelpBubble", "input_parameters", |
| [&](perfetto::TracedValue context){ |
| auto dict = std::move(context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem("native_identifier"), in_native_identifier, |
| "<value of type const WTF::String&>"); |
| }); |
| #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::kHelpBubbleClient_HideHelpBubble_Name, kFlags, 0, 0, nullptr); |
| mojo::internal::MessageFragment< |
| ::help_bubble::mojom::internal::HelpBubbleClient_HideHelpBubble_Params_Data> params( |
| message); |
| params.Allocate(); |
| mojo::internal::MessageFragment< |
| typename decltype(params->native_identifier)::BaseType> native_identifier_fragment( |
| params.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_native_identifier, native_identifier_fragment); |
| params->native_identifier.Set( |
| native_identifier_fragment.is_null() ? nullptr : native_identifier_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->native_identifier.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null native_identifier in HelpBubbleClient.HideHelpBubble request"); |
| |
| #if defined(ENABLE_IPC_FUZZER) |
| message.set_interface_name(HelpBubbleClient::Name_); |
| message.set_method_name("HideHelpBubble"); |
| #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 HelpBubbleClientStubDispatch::Accept( |
| HelpBubbleClient* impl, |
| mojo::Message* message) { |
| switch (message->header()->name) { |
| case internal::kHelpBubbleClient_ShowHelpBubble_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::HelpBubbleClient_ShowHelpBubble_Params_Data* params = |
| reinterpret_cast<internal::HelpBubbleClient_ShowHelpBubble_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| HelpBubbleParamsPtr p_params{}; |
| HelpBubbleClient_ShowHelpBubble_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadParams(&p_params)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| HelpBubbleClient::Name_, 0, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->ShowHelpBubble( |
| std::move(p_params)); |
| return true; |
| } |
| case internal::kHelpBubbleClient_ToggleFocusForAccessibility_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::HelpBubbleClient_ToggleFocusForAccessibility_Params_Data* params = |
| reinterpret_cast<internal::HelpBubbleClient_ToggleFocusForAccessibility_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| WTF::String p_native_identifier{}; |
| HelpBubbleClient_ToggleFocusForAccessibility_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadNativeIdentifier(&p_native_identifier)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| HelpBubbleClient::Name_, 1, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->ToggleFocusForAccessibility( |
| std::move(p_native_identifier)); |
| return true; |
| } |
| case internal::kHelpBubbleClient_HideHelpBubble_Name: { |
| |
| DCHECK(message->is_serialized()); |
| internal::HelpBubbleClient_HideHelpBubble_Params_Data* params = |
| reinterpret_cast<internal::HelpBubbleClient_HideHelpBubble_Params_Data*>( |
| message->mutable_payload()); |
| |
| bool success = true; |
| WTF::String p_native_identifier{}; |
| HelpBubbleClient_HideHelpBubble_ParamsDataView input_data_view(params, message); |
| |
| if (success && !input_data_view.ReadNativeIdentifier(&p_native_identifier)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| HelpBubbleClient::Name_, 2, false); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| DCHECK(impl); |
| impl->HideHelpBubble( |
| std::move(p_native_identifier)); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool HelpBubbleClientStubDispatch::AcceptWithResponder( |
| HelpBubbleClient* 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::kHelpBubbleClient_ShowHelpBubble_Name: { |
| break; |
| } |
| case internal::kHelpBubbleClient_ToggleFocusForAccessibility_Name: { |
| break; |
| } |
| case internal::kHelpBubbleClient_HideHelpBubble_Name: { |
| break; |
| } |
| } |
| return false; |
| } |
| |
| |
| static const std::pair<uint32_t, mojo::internal::GenericValidationInfo> kHelpBubbleClientValidationInfo[] = { |
| {internal::kHelpBubbleClient_ShowHelpBubble_Name, |
| {&internal::HelpBubbleClient_ShowHelpBubble_Params_Data::Validate, |
| nullptr /* no response */}}, |
| {internal::kHelpBubbleClient_ToggleFocusForAccessibility_Name, |
| {&internal::HelpBubbleClient_ToggleFocusForAccessibility_Params_Data::Validate, |
| nullptr /* no response */}}, |
| {internal::kHelpBubbleClient_HideHelpBubble_Name, |
| {&internal::HelpBubbleClient_HideHelpBubble_Params_Data::Validate, |
| nullptr /* no response */}}, |
| }; |
| |
| bool HelpBubbleClientRequestValidator::Accept(mojo::Message* message) { |
| const char* name = ::help_bubble::mojom::blink::HelpBubbleClient::Name_; |
| return mojo::internal::ValidateRequestGeneric(message, name, kHelpBubbleClientValidationInfo); |
| } |
| |
| |
| |
| } // namespace blink |
| } // namespace mojom |
| } // namespace help_bubble |
| |
| |
| namespace mojo { |
| |
| |
| // static |
| bool StructTraits<::help_bubble::mojom::blink::HelpBubbleButtonParams::DataView, ::help_bubble::mojom::blink::HelpBubbleButtonParamsPtr>::Read( |
| ::help_bubble::mojom::blink::HelpBubbleButtonParams::DataView input, |
| ::help_bubble::mojom::blink::HelpBubbleButtonParamsPtr* output) { |
| bool success = true; |
| ::help_bubble::mojom::blink::HelpBubbleButtonParamsPtr result(::help_bubble::mojom::blink::HelpBubbleButtonParams::New()); |
| |
| if (success && !input.ReadText(&result->text)) |
| success = false; |
| if (success) |
| result->is_default = input.is_default(); |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::help_bubble::mojom::blink::HelpBubbleParams::DataView, ::help_bubble::mojom::blink::HelpBubbleParamsPtr>::Read( |
| ::help_bubble::mojom::blink::HelpBubbleParams::DataView input, |
| ::help_bubble::mojom::blink::HelpBubbleParamsPtr* output) { |
| bool success = true; |
| ::help_bubble::mojom::blink::HelpBubbleParamsPtr result(::help_bubble::mojom::blink::HelpBubbleParams::New()); |
| |
| if (success && !input.ReadNativeIdentifier(&result->native_identifier)) |
| success = false; |
| if (success && !input.ReadPosition(&result->position)) |
| success = false; |
| if (success && !input.ReadTitleText(&result->title_text)) |
| success = false; |
| if (success && !input.ReadBodyText(&result->body_text)) |
| success = false; |
| if (success && !input.ReadButtons(&result->buttons)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| } // namespace mojo |
| |
| |
| // Symbols declared in the -test-utils.h header are defined here instead of a |
| // separate .cc file to save compile time. |
| |
| |
| namespace help_bubble { |
| namespace mojom { |
| namespace blink { |
| |
| |
| void HelpBubbleHandlerFactoryInterceptorForTesting::CreateHelpBubbleHandler(::mojo::PendingRemote<HelpBubbleClient> client, ::mojo::PendingReceiver<HelpBubbleHandler> handler) { |
| GetForwardingInterface()->CreateHelpBubbleHandler(std::move(client), std::move(handler)); |
| } |
| HelpBubbleHandlerFactoryAsyncWaiter::HelpBubbleHandlerFactoryAsyncWaiter( |
| HelpBubbleHandlerFactory* proxy) : proxy_(proxy) {} |
| |
| HelpBubbleHandlerFactoryAsyncWaiter::~HelpBubbleHandlerFactoryAsyncWaiter() = default; |
| |
| |
| |
| |
| void HelpBubbleHandlerInterceptorForTesting::HelpBubbleAnchorVisibilityChanged(const WTF::String& native_identifier, bool visible) { |
| GetForwardingInterface()->HelpBubbleAnchorVisibilityChanged(std::move(native_identifier), std::move(visible)); |
| } |
| void HelpBubbleHandlerInterceptorForTesting::HelpBubbleButtonPressed(const WTF::String& native_identifier, uint8_t button_index) { |
| GetForwardingInterface()->HelpBubbleButtonPressed(std::move(native_identifier), std::move(button_index)); |
| } |
| void HelpBubbleHandlerInterceptorForTesting::HelpBubbleClosed(const WTF::String& native_identifier, bool by_user) { |
| GetForwardingInterface()->HelpBubbleClosed(std::move(native_identifier), std::move(by_user)); |
| } |
| HelpBubbleHandlerAsyncWaiter::HelpBubbleHandlerAsyncWaiter( |
| HelpBubbleHandler* proxy) : proxy_(proxy) {} |
| |
| HelpBubbleHandlerAsyncWaiter::~HelpBubbleHandlerAsyncWaiter() = default; |
| |
| |
| |
| |
| void HelpBubbleClientInterceptorForTesting::ShowHelpBubble(HelpBubbleParamsPtr params) { |
| GetForwardingInterface()->ShowHelpBubble(std::move(params)); |
| } |
| void HelpBubbleClientInterceptorForTesting::ToggleFocusForAccessibility(const WTF::String& native_identifier) { |
| GetForwardingInterface()->ToggleFocusForAccessibility(std::move(native_identifier)); |
| } |
| void HelpBubbleClientInterceptorForTesting::HideHelpBubble(const WTF::String& native_identifier) { |
| GetForwardingInterface()->HideHelpBubble(std::move(native_identifier)); |
| } |
| HelpBubbleClientAsyncWaiter::HelpBubbleClientAsyncWaiter( |
| HelpBubbleClient* proxy) : proxy_(proxy) {} |
| |
| HelpBubbleClientAsyncWaiter::~HelpBubbleClientAsyncWaiter() = default; |
| |
| |
| |
| |
| |
| |
| } // namespace blink |
| } // namespace mojom |
| } // namespace help_bubble |
| |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic pop |
| #endif |