| // 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" |
| #elif defined(_MSC_VER) |
| #pragma warning(push) |
| #pragma warning(disable:4056) |
| #pragma warning(disable:4065) |
| #pragma warning(disable:4756) |
| #endif |
| |
| #include "services/ui/public/interfaces/window_manager.mojom.h" |
| |
| #include <math.h> |
| #include <stdint.h> |
| #include <utility> |
| |
| #include "base/logging.h" |
| #include "base/trace_event/trace_event.h" |
| #include "mojo/public/cpp/bindings/lib/message_builder.h" |
| #include "mojo/public/cpp/bindings/lib/serialization_util.h" |
| #include "mojo/public/cpp/bindings/lib/validate_params.h" |
| #include "mojo/public/cpp/bindings/lib/validation_context.h" |
| #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h" |
| #include "cc/ipc/frame_sink_id_struct_traits.h" |
| #include "cc/ipc/local_surface_id_struct_traits.h" |
| #include "ipc/ipc_message_utils.h" |
| #include "mojo/common/common_custom_types_struct_traits.h" |
| #include "services/ui/public/interfaces/cursor/cursor_struct_traits.h" |
| #include "skia/public/interfaces/bitmap_skbitmap_struct_traits.h" |
| #include "ui/base/mojo/ui_base_types_struct_traits.h" |
| #include "ui/display/mojo/display_struct_traits.h" |
| #include "ui/events/mojo/event_struct_traits.h" |
| #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" |
| #include "ui/latency/mojo/latency_info_struct_traits.h" |
| namespace ui { |
| namespace mojom { |
| WmAccelerator::WmAccelerator() |
| : id(), |
| event_matcher() {} |
| |
| WmAccelerator::WmAccelerator( |
| uint32_t id_in, |
| ::ui::mojom::EventMatcherPtr event_matcher_in) |
| : id(std::move(id_in)), |
| event_matcher(std::move(event_matcher_in)) {} |
| |
| WmAccelerator::~WmAccelerator() = default; |
| |
| bool WmAccelerator::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| const char WindowManager::Name_[] = "ui::mojom::WindowManager"; |
| const char WindowManager::kFocusable_InitProperty[] = "init:focusable"; |
| const char WindowManager::kBounds_InitProperty[] = "init:bounds"; |
| const char WindowManager::kContainerId_InitProperty[] = "init:container_id"; |
| const char WindowManager::kDisableImmersive_InitProperty[] = "init:disable_immersive"; |
| const char WindowManager::kDisplayId_InitProperty[] = "init:display_id"; |
| const char WindowManager::kRemoveStandardFrame_InitProperty[] = "init:remove-standard-frame"; |
| const char WindowManager::kWindowIgnoredByShelf_InitProperty[] = "init:window-ignored-by-shelf"; |
| const char WindowManager::kWindowType_InitProperty[] = "init:window-type"; |
| const char WindowManager::kAlwaysOnTop_Property[] = "prop:always_on_top"; |
| const char WindowManager::kAppIcon_Property[] = "prop:app-icon"; |
| const char WindowManager::kAppID_Property[] = "prop:app-id"; |
| const char WindowManager::kExcludeFromMru_Property[] = "prop:exclude_from_mru"; |
| const char WindowManager::kImmersiveFullscreen_Property[] = "prop:immersive-fullscreen"; |
| const char WindowManager::kName_Property[] = "prop:name"; |
| const char WindowManager::kPanelAttached_Property[] = "prop:panel-attached"; |
| const char WindowManager::kPreferredSize_Property[] = "prop:preferred-size"; |
| const char WindowManager::kRenderParentTitleArea_Property[] = "render-parent-non-client-area"; |
| const char WindowManager::kResizeBehavior_Property[] = "prop:resize-behavior"; |
| const char WindowManager::kRestoreBounds_Property[] = "prop:restore-bounds"; |
| const char WindowManager::kShadowElevation_Property[] = "prop:shadow-elevation"; |
| const char WindowManager::kShelfItemType_Property[] = "prop:shelf-item-type"; |
| const char WindowManager::kShowState_Property[] = "prop:show-state"; |
| const char WindowManager::kWindowIcon_Property[] = "prop:window-icon"; |
| const char WindowManager::kWindowTitle_Property[] = "prop:window-title"; |
| |
| class WindowManager_WmMoveDragImage_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| WindowManager_WmMoveDragImage_ForwardToCallback( |
| const WindowManager::WmMoveDragImageCallback& callback |
| ) : callback_(std::move(callback)) { |
| } |
| bool Accept(mojo::Message* message) override; |
| private: |
| WindowManager::WmMoveDragImageCallback callback_; |
| DISALLOW_COPY_AND_ASSIGN(WindowManager_WmMoveDragImage_ForwardToCallback); |
| }; |
| bool WindowManager_WmMoveDragImage_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| internal::WindowManager_WmMoveDragImage_ResponseParams_Data* params = |
| reinterpret_cast<internal::WindowManager_WmMoveDragImage_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| WindowManager_WmMoveDragImage_ResponseParamsDataView input_data_view(params, &serialization_context); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmMoveDragImage response deserializer"); |
| return false; |
| } |
| if (!callback_.is_null()) { |
| mojo::internal::MessageDispatchContext context(message); |
| std::move(callback_).Run(); |
| } |
| return true; |
| } |
| |
| WindowManagerProxy::WindowManagerProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void WindowManagerProxy::OnConnect( |
| uint16_t in_client_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_OnConnect_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_OnConnect_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_OnConnect_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->client_id = in_client_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmNewDisplayAdded( |
| const display::Display& in_display, ::ui::mojom::WindowDataPtr in_root, bool in_parent_drawn, const cc::FrameSinkId& in_frame_sink_id, const base::Optional<cc::LocalSurfaceId>& in_local_surface_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmNewDisplayAdded_Params_Data); |
| size += mojo::internal::PrepareToSerialize<::display::mojom::DisplayDataView>( |
| in_display, &serialization_context); |
| size += mojo::internal::PrepareToSerialize<::ui::mojom::WindowDataDataView>( |
| in_root, &serialization_context); |
| size += mojo::internal::PrepareToSerialize<::cc::mojom::FrameSinkIdDataView>( |
| in_frame_sink_id, &serialization_context); |
| size += mojo::internal::PrepareToSerialize<::cc::mojom::LocalSurfaceIdDataView>( |
| in_local_surface_id, &serialization_context); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmNewDisplayAdded_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmNewDisplayAdded_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| typename decltype(params->display)::BaseType* display_ptr; |
| mojo::internal::Serialize<::display::mojom::DisplayDataView>( |
| in_display, builder.buffer(), &display_ptr, &serialization_context); |
| params->display.Set(display_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->display.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null display in WindowManager.WmNewDisplayAdded request"); |
| typename decltype(params->root)::BaseType* root_ptr; |
| mojo::internal::Serialize<::ui::mojom::WindowDataDataView>( |
| in_root, builder.buffer(), &root_ptr, &serialization_context); |
| params->root.Set(root_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->root.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null root in WindowManager.WmNewDisplayAdded request"); |
| params->parent_drawn = in_parent_drawn; |
| typename decltype(params->frame_sink_id)::BaseType* frame_sink_id_ptr; |
| mojo::internal::Serialize<::cc::mojom::FrameSinkIdDataView>( |
| in_frame_sink_id, builder.buffer(), &frame_sink_id_ptr, &serialization_context); |
| params->frame_sink_id.Set(frame_sink_id_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->frame_sink_id.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null frame_sink_id in WindowManager.WmNewDisplayAdded request"); |
| typename decltype(params->local_surface_id)::BaseType* local_surface_id_ptr; |
| mojo::internal::Serialize<::cc::mojom::LocalSurfaceIdDataView>( |
| in_local_surface_id, builder.buffer(), &local_surface_id_ptr, &serialization_context); |
| params->local_surface_id.Set(local_surface_id_ptr); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmDisplayRemoved( |
| int64_t in_display_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmDisplayRemoved_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmDisplayRemoved_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmDisplayRemoved_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->display_id = in_display_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmDisplayModified( |
| const display::Display& in_display) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmDisplayModified_Params_Data); |
| size += mojo::internal::PrepareToSerialize<::display::mojom::DisplayDataView>( |
| in_display, &serialization_context); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmDisplayModified_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmDisplayModified_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| typename decltype(params->display)::BaseType* display_ptr; |
| mojo::internal::Serialize<::display::mojom::DisplayDataView>( |
| in_display, builder.buffer(), &display_ptr, &serialization_context); |
| params->display.Set(display_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->display.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null display in WindowManager.WmDisplayModified request"); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmSetBounds( |
| uint32_t in_change_id, uint32_t in_window_id, const gfx::Rect& in_bounds) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmSetBounds_Params_Data); |
| size += mojo::internal::PrepareToSerialize<::gfx::mojom::RectDataView>( |
| in_bounds, &serialization_context); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmSetBounds_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmSetBounds_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->change_id = in_change_id; |
| params->window_id = in_window_id; |
| typename decltype(params->bounds)::BaseType* bounds_ptr; |
| mojo::internal::Serialize<::gfx::mojom::RectDataView>( |
| in_bounds, builder.buffer(), &bounds_ptr, &serialization_context); |
| params->bounds.Set(bounds_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->bounds.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null bounds in WindowManager.WmSetBounds request"); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmSetProperty( |
| uint32_t in_change_id, uint32_t in_window_id, const std::string& in_name, const base::Optional<std::vector<uint8_t>>& in_value) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmSetProperty_Params_Data); |
| size += mojo::internal::PrepareToSerialize<mojo::StringDataView>( |
| in_name, &serialization_context); |
| size += mojo::internal::PrepareToSerialize<mojo::ArrayDataView<uint8_t>>( |
| in_value, &serialization_context); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmSetProperty_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmSetProperty_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->change_id = in_change_id; |
| params->window_id = in_window_id; |
| typename decltype(params->name)::BaseType* name_ptr; |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_name, builder.buffer(), &name_ptr, &serialization_context); |
| params->name.Set(name_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->name.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null name in WindowManager.WmSetProperty request"); |
| typename decltype(params->value)::BaseType* value_ptr; |
| const mojo::internal::ContainerValidateParams value_validate_params( |
| 0, false, nullptr); |
| mojo::internal::Serialize<mojo::ArrayDataView<uint8_t>>( |
| in_value, builder.buffer(), &value_ptr, &value_validate_params, |
| &serialization_context); |
| params->value.Set(value_ptr); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmSetModalType( |
| uint32_t in_window_id, ui::ModalType in_type) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmSetModalType_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmSetModalType_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmSetModalType_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->window_id = in_window_id; |
| mojo::internal::Serialize<::ui::mojom::ModalType>( |
| in_type, ¶ms->type); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmSetCanFocus( |
| uint32_t in_window_id, bool in_can_focus) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmSetCanFocus_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmSetCanFocus_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmSetCanFocus_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->window_id = in_window_id; |
| params->can_focus = in_can_focus; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmCreateTopLevelWindow( |
| uint32_t in_change_id, uint16_t in_requesting_client_id, const std::unordered_map<std::string, std::vector<uint8_t>>& in_properties) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmCreateTopLevelWindow_Params_Data); |
| size += mojo::internal::PrepareToSerialize<mojo::MapDataView<mojo::StringDataView, mojo::ArrayDataView<uint8_t>>>( |
| in_properties, &serialization_context); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmCreateTopLevelWindow_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmCreateTopLevelWindow_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->change_id = in_change_id; |
| params->requesting_client_id = in_requesting_client_id; |
| typename decltype(params->properties)::BaseType* properties_ptr; |
| const mojo::internal::ContainerValidateParams properties_validate_params( |
| new mojo::internal::ContainerValidateParams(0, false, new mojo::internal::ContainerValidateParams(0, false, nullptr)), new mojo::internal::ContainerValidateParams(0, false, new mojo::internal::ContainerValidateParams(0, false, nullptr))); |
| mojo::internal::Serialize<mojo::MapDataView<mojo::StringDataView, mojo::ArrayDataView<uint8_t>>>( |
| in_properties, builder.buffer(), &properties_ptr, &properties_validate_params, |
| &serialization_context); |
| params->properties.Set(properties_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->properties.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null properties in WindowManager.WmCreateTopLevelWindow request"); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmClientJankinessChanged( |
| uint16_t in_client_id, bool in_janky) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmClientJankinessChanged_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmClientJankinessChanged_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmClientJankinessChanged_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->client_id = in_client_id; |
| params->janky = in_janky; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmBuildDragImage( |
| const gfx::Point& in_screen_location, const SkBitmap& in_drag_image, const gfx::Vector2d& in_drag_image_offset, ::ui::mojom::PointerKind in_source) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmBuildDragImage_Params_Data); |
| size += mojo::internal::PrepareToSerialize<::gfx::mojom::PointDataView>( |
| in_screen_location, &serialization_context); |
| size += mojo::internal::PrepareToSerialize<::skia::mojom::BitmapDataView>( |
| in_drag_image, &serialization_context); |
| size += mojo::internal::PrepareToSerialize<::gfx::mojom::Vector2dDataView>( |
| in_drag_image_offset, &serialization_context); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmBuildDragImage_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmBuildDragImage_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| typename decltype(params->screen_location)::BaseType* screen_location_ptr; |
| mojo::internal::Serialize<::gfx::mojom::PointDataView>( |
| in_screen_location, builder.buffer(), &screen_location_ptr, &serialization_context); |
| params->screen_location.Set(screen_location_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->screen_location.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null screen_location in WindowManager.WmBuildDragImage request"); |
| typename decltype(params->drag_image)::BaseType* drag_image_ptr; |
| mojo::internal::Serialize<::skia::mojom::BitmapDataView>( |
| in_drag_image, builder.buffer(), &drag_image_ptr, &serialization_context); |
| params->drag_image.Set(drag_image_ptr); |
| typename decltype(params->drag_image_offset)::BaseType* drag_image_offset_ptr; |
| mojo::internal::Serialize<::gfx::mojom::Vector2dDataView>( |
| in_drag_image_offset, builder.buffer(), &drag_image_offset_ptr, &serialization_context); |
| params->drag_image_offset.Set(drag_image_offset_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->drag_image_offset.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null drag_image_offset in WindowManager.WmBuildDragImage request"); |
| mojo::internal::Serialize<::ui::mojom::PointerKind>( |
| in_source, ¶ms->source); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmMoveDragImage( |
| const gfx::Point& in_screen_location, const WmMoveDragImageCallback& callback) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmMoveDragImage_Params_Data); |
| size += mojo::internal::PrepareToSerialize<::gfx::mojom::PointDataView>( |
| in_screen_location, &serialization_context); |
| constexpr uint32_t kFlags = mojo::Message::kFlagExpectsResponse; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmMoveDragImage_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmMoveDragImage_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| typename decltype(params->screen_location)::BaseType* screen_location_ptr; |
| mojo::internal::Serialize<::gfx::mojom::PointDataView>( |
| in_screen_location, builder.buffer(), &screen_location_ptr, &serialization_context); |
| params->screen_location.Set(screen_location_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->screen_location.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null screen_location in WindowManager.WmMoveDragImage request"); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new WindowManager_WmMoveDragImage_ForwardToCallback( |
| std::move(callback))); |
| ignore_result(receiver_->AcceptWithResponder(builder.message(), |
| std::move(responder))); |
| } |
| |
| void WindowManagerProxy::WmDestroyDragImage( |
| ) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmDestroyDragImage_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmDestroyDragImage_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmDestroyDragImage_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmPerformMoveLoop( |
| uint32_t in_change_id, uint32_t in_window_id, ::ui::mojom::MoveLoopSource in_source, const gfx::Point& in_cursor_location) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmPerformMoveLoop_Params_Data); |
| size += mojo::internal::PrepareToSerialize<::gfx::mojom::PointDataView>( |
| in_cursor_location, &serialization_context); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmPerformMoveLoop_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmPerformMoveLoop_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->change_id = in_change_id; |
| params->window_id = in_window_id; |
| mojo::internal::Serialize<::ui::mojom::MoveLoopSource>( |
| in_source, ¶ms->source); |
| typename decltype(params->cursor_location)::BaseType* cursor_location_ptr; |
| mojo::internal::Serialize<::gfx::mojom::PointDataView>( |
| in_cursor_location, builder.buffer(), &cursor_location_ptr, &serialization_context); |
| params->cursor_location.Set(cursor_location_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->cursor_location.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null cursor_location in WindowManager.WmPerformMoveLoop request"); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmCancelMoveLoop( |
| uint32_t in_change_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmCancelMoveLoop_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmCancelMoveLoop_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmCancelMoveLoop_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->change_id = in_change_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmDeactivateWindow( |
| uint32_t in_window_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmDeactivateWindow_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmDeactivateWindow_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmDeactivateWindow_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->window_id = in_window_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmStackAbove( |
| uint32_t in_change_id, uint32_t in_above_id, uint32_t in_below_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmStackAbove_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmStackAbove_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmStackAbove_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->change_id = in_change_id; |
| params->above_id = in_above_id; |
| params->below_id = in_below_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::WmStackAtTop( |
| uint32_t in_change_id, uint32_t in_window_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmStackAtTop_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmStackAtTop_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmStackAtTop_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->change_id = in_change_id; |
| params->window_id = in_window_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerProxy::OnAccelerator( |
| uint32_t in_ack_id, uint32_t in_accelerator_id, std::unique_ptr<ui::Event> in_event) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_OnAccelerator_Params_Data); |
| size += mojo::internal::PrepareToSerialize<::ui::mojom::EventDataView>( |
| in_event, &serialization_context); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_OnAccelerator_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_OnAccelerator_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->ack_id = in_ack_id; |
| params->accelerator_id = in_accelerator_id; |
| typename decltype(params->event)::BaseType* event_ptr; |
| mojo::internal::Serialize<::ui::mojom::EventDataView>( |
| in_event, builder.buffer(), &event_ptr, &serialization_context); |
| params->event.Set(event_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->event.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null event in WindowManager.OnAccelerator request"); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| class WindowManager_WmMoveDragImage_ProxyToResponder { |
| public: |
| static WindowManager::WmMoveDragImageCallback CreateCallback( |
| uint64_t request_id, |
| bool is_sync, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<WindowManager_WmMoveDragImage_ProxyToResponder> proxy( |
| new WindowManager_WmMoveDragImage_ProxyToResponder( |
| request_id, is_sync, std::move(responder))); |
| return base::Bind(&WindowManager_WmMoveDragImage_ProxyToResponder::Run, |
| base::Passed(&proxy)); |
| } |
| |
| ~WindowManager_WmMoveDragImage_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // Is the Service destroying the callback without running it |
| // and without first closing the pipe? |
| responder_->DCheckInvalid("The callback passed to " |
| "WindowManager::WmMoveDragImage() was never run."); |
| } |
| #endif |
| // If the Callback was dropped then deleting the responder will close |
| // the pipe so the calling application knows to stop waiting for a reply. |
| responder_ = nullptr; |
| } |
| |
| private: |
| WindowManager_WmMoveDragImage_ProxyToResponder( |
| uint64_t request_id, |
| bool is_sync, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : request_id_(request_id), |
| is_sync_(is_sync), |
| responder_(std::move(responder)) { |
| } |
| |
| void Run( |
| ); |
| |
| uint64_t request_id_; |
| bool is_sync_; |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder_; |
| |
| DISALLOW_COPY_AND_ASSIGN(WindowManager_WmMoveDragImage_ProxyToResponder); |
| }; |
| |
| void WindowManager_WmMoveDragImage_ProxyToResponder::Run( |
| ) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManager_WmMoveDragImage_ResponseParams_Data); |
| |
| uint32_t flags = (is_sync_ ? mojo::Message::kFlagIsSync : 0) | |
| mojo::Message::kFlagIsResponse; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManager_WmMoveDragImage_Name, flags, size, |
| serialization_context.associated_endpoint_count); |
| builder.message()->set_request_id(request_id_); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManager_WmMoveDragImage_ResponseParams_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| ignore_result(responder_->Accept(builder.message())); |
| // TODO(darin): Accept() returning false indicates a malformed message, and |
| // 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 WindowManagerStubDispatch::Accept( |
| WindowManager* impl, |
| mojo::Message* message) { |
| switch (message->header()->name) { |
| case internal::kWindowManager_OnConnect_Name: { |
| internal::WindowManager_OnConnect_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_OnConnect_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint16_t p_client_id{}; |
| WindowManager_OnConnect_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_client_id = input_data_view.client_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::OnConnect deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::OnConnect"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->OnConnect( |
| std::move(p_client_id)); |
| return true; |
| } |
| case internal::kWindowManager_WmNewDisplayAdded_Name: { |
| internal::WindowManager_WmNewDisplayAdded_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmNewDisplayAdded_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| display::Display p_display{}; |
| ::ui::mojom::WindowDataPtr p_root{}; |
| bool p_parent_drawn{}; |
| cc::FrameSinkId p_frame_sink_id{}; |
| base::Optional<cc::LocalSurfaceId> p_local_surface_id{}; |
| WindowManager_WmNewDisplayAdded_ParamsDataView input_data_view(params, &serialization_context); |
| |
| if (!input_data_view.ReadDisplay(&p_display)) |
| success = false; |
| if (!input_data_view.ReadRoot(&p_root)) |
| success = false; |
| p_parent_drawn = input_data_view.parent_drawn(); |
| if (!input_data_view.ReadFrameSinkId(&p_frame_sink_id)) |
| success = false; |
| if (!input_data_view.ReadLocalSurfaceId(&p_local_surface_id)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmNewDisplayAdded deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmNewDisplayAdded"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmNewDisplayAdded( |
| std::move(p_display), |
| std::move(p_root), |
| std::move(p_parent_drawn), |
| std::move(p_frame_sink_id), |
| std::move(p_local_surface_id)); |
| return true; |
| } |
| case internal::kWindowManager_WmDisplayRemoved_Name: { |
| internal::WindowManager_WmDisplayRemoved_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmDisplayRemoved_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| int64_t p_display_id{}; |
| WindowManager_WmDisplayRemoved_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_display_id = input_data_view.display_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmDisplayRemoved deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmDisplayRemoved"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmDisplayRemoved( |
| std::move(p_display_id)); |
| return true; |
| } |
| case internal::kWindowManager_WmDisplayModified_Name: { |
| internal::WindowManager_WmDisplayModified_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmDisplayModified_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| display::Display p_display{}; |
| WindowManager_WmDisplayModified_ParamsDataView input_data_view(params, &serialization_context); |
| |
| if (!input_data_view.ReadDisplay(&p_display)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmDisplayModified deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmDisplayModified"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmDisplayModified( |
| std::move(p_display)); |
| return true; |
| } |
| case internal::kWindowManager_WmSetBounds_Name: { |
| internal::WindowManager_WmSetBounds_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmSetBounds_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_change_id{}; |
| uint32_t p_window_id{}; |
| gfx::Rect p_bounds{}; |
| WindowManager_WmSetBounds_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_change_id = input_data_view.change_id(); |
| p_window_id = input_data_view.window_id(); |
| if (!input_data_view.ReadBounds(&p_bounds)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmSetBounds deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmSetBounds"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmSetBounds( |
| std::move(p_change_id), |
| std::move(p_window_id), |
| std::move(p_bounds)); |
| return true; |
| } |
| case internal::kWindowManager_WmSetProperty_Name: { |
| internal::WindowManager_WmSetProperty_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmSetProperty_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_change_id{}; |
| uint32_t p_window_id{}; |
| std::string p_name{}; |
| base::Optional<std::vector<uint8_t>> p_value{}; |
| WindowManager_WmSetProperty_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_change_id = input_data_view.change_id(); |
| p_window_id = input_data_view.window_id(); |
| if (!input_data_view.ReadName(&p_name)) |
| success = false; |
| if (!input_data_view.ReadValue(&p_value)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmSetProperty deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmSetProperty"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmSetProperty( |
| std::move(p_change_id), |
| std::move(p_window_id), |
| std::move(p_name), |
| std::move(p_value)); |
| return true; |
| } |
| case internal::kWindowManager_WmSetModalType_Name: { |
| internal::WindowManager_WmSetModalType_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmSetModalType_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_window_id{}; |
| ui::ModalType p_type{}; |
| WindowManager_WmSetModalType_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_window_id = input_data_view.window_id(); |
| if (!input_data_view.ReadType(&p_type)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmSetModalType deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmSetModalType"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmSetModalType( |
| std::move(p_window_id), |
| std::move(p_type)); |
| return true; |
| } |
| case internal::kWindowManager_WmSetCanFocus_Name: { |
| internal::WindowManager_WmSetCanFocus_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmSetCanFocus_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_window_id{}; |
| bool p_can_focus{}; |
| WindowManager_WmSetCanFocus_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_window_id = input_data_view.window_id(); |
| p_can_focus = input_data_view.can_focus(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmSetCanFocus deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmSetCanFocus"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmSetCanFocus( |
| std::move(p_window_id), |
| std::move(p_can_focus)); |
| return true; |
| } |
| case internal::kWindowManager_WmCreateTopLevelWindow_Name: { |
| internal::WindowManager_WmCreateTopLevelWindow_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmCreateTopLevelWindow_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_change_id{}; |
| uint16_t p_requesting_client_id{}; |
| std::unordered_map<std::string, std::vector<uint8_t>> p_properties{}; |
| WindowManager_WmCreateTopLevelWindow_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_change_id = input_data_view.change_id(); |
| p_requesting_client_id = input_data_view.requesting_client_id(); |
| if (!input_data_view.ReadProperties(&p_properties)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmCreateTopLevelWindow deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmCreateTopLevelWindow"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmCreateTopLevelWindow( |
| std::move(p_change_id), |
| std::move(p_requesting_client_id), |
| std::move(p_properties)); |
| return true; |
| } |
| case internal::kWindowManager_WmClientJankinessChanged_Name: { |
| internal::WindowManager_WmClientJankinessChanged_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmClientJankinessChanged_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint16_t p_client_id{}; |
| bool p_janky{}; |
| WindowManager_WmClientJankinessChanged_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_client_id = input_data_view.client_id(); |
| p_janky = input_data_view.janky(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmClientJankinessChanged deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmClientJankinessChanged"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmClientJankinessChanged( |
| std::move(p_client_id), |
| std::move(p_janky)); |
| return true; |
| } |
| case internal::kWindowManager_WmBuildDragImage_Name: { |
| internal::WindowManager_WmBuildDragImage_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmBuildDragImage_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| gfx::Point p_screen_location{}; |
| SkBitmap p_drag_image{}; |
| gfx::Vector2d p_drag_image_offset{}; |
| ::ui::mojom::PointerKind p_source{}; |
| WindowManager_WmBuildDragImage_ParamsDataView input_data_view(params, &serialization_context); |
| |
| if (!input_data_view.ReadScreenLocation(&p_screen_location)) |
| success = false; |
| if (!input_data_view.ReadDragImage(&p_drag_image)) |
| success = false; |
| if (!input_data_view.ReadDragImageOffset(&p_drag_image_offset)) |
| success = false; |
| if (!input_data_view.ReadSource(&p_source)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmBuildDragImage deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmBuildDragImage"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmBuildDragImage( |
| std::move(p_screen_location), |
| std::move(p_drag_image), |
| std::move(p_drag_image_offset), |
| std::move(p_source)); |
| return true; |
| } |
| case internal::kWindowManager_WmMoveDragImage_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmDestroyDragImage_Name: { |
| internal::WindowManager_WmDestroyDragImage_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmDestroyDragImage_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| WindowManager_WmDestroyDragImage_ParamsDataView input_data_view(params, &serialization_context); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmDestroyDragImage deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmDestroyDragImage"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmDestroyDragImage(); |
| return true; |
| } |
| case internal::kWindowManager_WmPerformMoveLoop_Name: { |
| internal::WindowManager_WmPerformMoveLoop_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmPerformMoveLoop_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_change_id{}; |
| uint32_t p_window_id{}; |
| ::ui::mojom::MoveLoopSource p_source{}; |
| gfx::Point p_cursor_location{}; |
| WindowManager_WmPerformMoveLoop_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_change_id = input_data_view.change_id(); |
| p_window_id = input_data_view.window_id(); |
| if (!input_data_view.ReadSource(&p_source)) |
| success = false; |
| if (!input_data_view.ReadCursorLocation(&p_cursor_location)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmPerformMoveLoop deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmPerformMoveLoop"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmPerformMoveLoop( |
| std::move(p_change_id), |
| std::move(p_window_id), |
| std::move(p_source), |
| std::move(p_cursor_location)); |
| return true; |
| } |
| case internal::kWindowManager_WmCancelMoveLoop_Name: { |
| internal::WindowManager_WmCancelMoveLoop_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmCancelMoveLoop_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_change_id{}; |
| WindowManager_WmCancelMoveLoop_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_change_id = input_data_view.change_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmCancelMoveLoop deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmCancelMoveLoop"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmCancelMoveLoop( |
| std::move(p_change_id)); |
| return true; |
| } |
| case internal::kWindowManager_WmDeactivateWindow_Name: { |
| internal::WindowManager_WmDeactivateWindow_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmDeactivateWindow_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_window_id{}; |
| WindowManager_WmDeactivateWindow_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_window_id = input_data_view.window_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmDeactivateWindow deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmDeactivateWindow"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmDeactivateWindow( |
| std::move(p_window_id)); |
| return true; |
| } |
| case internal::kWindowManager_WmStackAbove_Name: { |
| internal::WindowManager_WmStackAbove_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmStackAbove_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_change_id{}; |
| uint32_t p_above_id{}; |
| uint32_t p_below_id{}; |
| WindowManager_WmStackAbove_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_change_id = input_data_view.change_id(); |
| p_above_id = input_data_view.above_id(); |
| p_below_id = input_data_view.below_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmStackAbove deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmStackAbove"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmStackAbove( |
| std::move(p_change_id), |
| std::move(p_above_id), |
| std::move(p_below_id)); |
| return true; |
| } |
| case internal::kWindowManager_WmStackAtTop_Name: { |
| internal::WindowManager_WmStackAtTop_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmStackAtTop_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_change_id{}; |
| uint32_t p_window_id{}; |
| WindowManager_WmStackAtTop_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_change_id = input_data_view.change_id(); |
| p_window_id = input_data_view.window_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmStackAtTop deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmStackAtTop"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmStackAtTop( |
| std::move(p_change_id), |
| std::move(p_window_id)); |
| return true; |
| } |
| case internal::kWindowManager_OnAccelerator_Name: { |
| internal::WindowManager_OnAccelerator_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_OnAccelerator_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_ack_id{}; |
| uint32_t p_accelerator_id{}; |
| std::unique_ptr<ui::Event> p_event{}; |
| WindowManager_OnAccelerator_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_ack_id = input_data_view.ack_id(); |
| p_accelerator_id = input_data_view.accelerator_id(); |
| if (!input_data_view.ReadEvent(&p_event)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::OnAccelerator deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::OnAccelerator"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->OnAccelerator( |
| std::move(p_ack_id), |
| std::move(p_accelerator_id), |
| std::move(p_event)); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool WindowManagerStubDispatch::AcceptWithResponder( |
| WindowManager* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| switch (message->header()->name) { |
| case internal::kWindowManager_OnConnect_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmNewDisplayAdded_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmDisplayRemoved_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmDisplayModified_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmSetBounds_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmSetProperty_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmSetModalType_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmSetCanFocus_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmCreateTopLevelWindow_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmClientJankinessChanged_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmBuildDragImage_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmMoveDragImage_Name: { |
| internal::WindowManager_WmMoveDragImage_Params_Data* params = |
| reinterpret_cast<internal::WindowManager_WmMoveDragImage_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| gfx::Point p_screen_location{}; |
| WindowManager_WmMoveDragImage_ParamsDataView input_data_view(params, &serialization_context); |
| |
| if (!input_data_view.ReadScreenLocation(&p_screen_location)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManager::WmMoveDragImage deserializer"); |
| return false; |
| } |
| WindowManager::WmMoveDragImageCallback callback = |
| WindowManager_WmMoveDragImage_ProxyToResponder::CreateCallback( |
| message->request_id(), |
| message->has_flag(mojo::Message::kFlagIsSync), |
| std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManager::WmMoveDragImage"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmMoveDragImage( |
| std::move(p_screen_location), std::move(callback)); |
| return true; |
| } |
| case internal::kWindowManager_WmDestroyDragImage_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmPerformMoveLoop_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmCancelMoveLoop_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmDeactivateWindow_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmStackAbove_Name: { |
| break; |
| } |
| case internal::kWindowManager_WmStackAtTop_Name: { |
| break; |
| } |
| case internal::kWindowManager_OnAccelerator_Name: { |
| break; |
| } |
| } |
| return false; |
| } |
| |
| bool WindowManagerRequestValidator::Accept(mojo::Message* message) { |
| if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) |
| return true; |
| |
| mojo::internal::ValidationContext validation_context( |
| message->payload(), message->payload_num_bytes(), |
| message->handles()->size(), message->payload_num_interface_ids(), message, |
| "WindowManager RequestValidator"); |
| |
| switch (message->header()->name) { |
| case internal::kWindowManager_OnConnect_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_OnConnect_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmNewDisplayAdded_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmNewDisplayAdded_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmDisplayRemoved_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmDisplayRemoved_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmDisplayModified_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmDisplayModified_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmSetBounds_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmSetBounds_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmSetProperty_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmSetProperty_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmSetModalType_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmSetModalType_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmSetCanFocus_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmSetCanFocus_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmCreateTopLevelWindow_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmCreateTopLevelWindow_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmClientJankinessChanged_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmClientJankinessChanged_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmBuildDragImage_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmBuildDragImage_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmMoveDragImage_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestExpectingResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmMoveDragImage_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmDestroyDragImage_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmDestroyDragImage_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmPerformMoveLoop_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmPerformMoveLoop_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmCancelMoveLoop_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmCancelMoveLoop_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmDeactivateWindow_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmDeactivateWindow_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmStackAbove_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmStackAbove_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_WmStackAtTop_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmStackAtTop_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManager_OnAccelerator_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_OnAccelerator_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| default: |
| break; |
| } |
| |
| // Unrecognized message. |
| ReportValidationError( |
| &validation_context, |
| mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); |
| return false; |
| } |
| |
| bool WindowManagerResponseValidator::Accept(mojo::Message* message) { |
| if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) |
| return true; |
| |
| mojo::internal::ValidationContext validation_context( |
| message->payload(), message->payload_num_bytes(), |
| message->handles()->size(), message->payload_num_interface_ids(), message, |
| "WindowManager ResponseValidator"); |
| |
| if (!mojo::internal::ValidateMessageIsResponse(message, &validation_context)) |
| return false; |
| switch (message->header()->name) { |
| case internal::kWindowManager_WmMoveDragImage_Name: { |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManager_WmMoveDragImage_ResponseParams_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| default: |
| break; |
| } |
| |
| // Unrecognized message. |
| ReportValidationError( |
| &validation_context, |
| mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); |
| return false; |
| } |
| const char WindowManagerClient::Name_[] = "ui::mojom::WindowManagerClient"; |
| |
| class WindowManagerClient_AddAccelerators_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| WindowManagerClient_AddAccelerators_ForwardToCallback( |
| const WindowManagerClient::AddAcceleratorsCallback& callback |
| ) : callback_(std::move(callback)) { |
| } |
| bool Accept(mojo::Message* message) override; |
| private: |
| WindowManagerClient::AddAcceleratorsCallback callback_; |
| DISALLOW_COPY_AND_ASSIGN(WindowManagerClient_AddAccelerators_ForwardToCallback); |
| }; |
| bool WindowManagerClient_AddAccelerators_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| internal::WindowManagerClient_AddAccelerators_ResponseParams_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_AddAccelerators_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| bool p_success{}; |
| WindowManagerClient_AddAccelerators_ResponseParamsDataView input_data_view(params, &serialization_context); |
| |
| p_success = input_data_view.success(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::AddAccelerators response deserializer"); |
| return false; |
| } |
| if (!callback_.is_null()) { |
| mojo::internal::MessageDispatchContext context(message); |
| std::move(callback_).Run( |
| std::move(p_success)); |
| } |
| return true; |
| } |
| |
| class WindowManagerClient_SetDisplayRoot_ForwardToCallback |
| : public mojo::MessageReceiver { |
| public: |
| WindowManagerClient_SetDisplayRoot_ForwardToCallback( |
| const WindowManagerClient::SetDisplayRootCallback& callback |
| ) : callback_(std::move(callback)) { |
| } |
| bool Accept(mojo::Message* message) override; |
| private: |
| WindowManagerClient::SetDisplayRootCallback callback_; |
| DISALLOW_COPY_AND_ASSIGN(WindowManagerClient_SetDisplayRoot_ForwardToCallback); |
| }; |
| bool WindowManagerClient_SetDisplayRoot_ForwardToCallback::Accept( |
| mojo::Message* message) { |
| internal::WindowManagerClient_SetDisplayRoot_ResponseParams_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_SetDisplayRoot_ResponseParams_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| base::Optional<cc::FrameSinkId> p_frame_sink_id{}; |
| WindowManagerClient_SetDisplayRoot_ResponseParamsDataView input_data_view(params, &serialization_context); |
| |
| if (!input_data_view.ReadFrameSinkId(&p_frame_sink_id)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::SetDisplayRoot response deserializer"); |
| return false; |
| } |
| if (!callback_.is_null()) { |
| mojo::internal::MessageDispatchContext context(message); |
| std::move(callback_).Run( |
| std::move(p_frame_sink_id)); |
| } |
| return true; |
| } |
| |
| WindowManagerClientProxy::WindowManagerClientProxy(mojo::MessageReceiverWithResponder* receiver) |
| : receiver_(receiver) { |
| } |
| |
| void WindowManagerClientProxy::AddActivationParent( |
| uint32_t in_window_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_AddActivationParent_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_AddActivationParent_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_AddActivationParent_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->window_id = in_window_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerClientProxy::RemoveActivationParent( |
| uint32_t in_window_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_RemoveActivationParent_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_RemoveActivationParent_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_RemoveActivationParent_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->window_id = in_window_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerClientProxy::ActivateNextWindow( |
| ) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_ActivateNextWindow_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_ActivateNextWindow_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_ActivateNextWindow_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerClientProxy::SetExtendedHitArea( |
| uint32_t in_window_id, const gfx::Insets& in_hit_area) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_SetExtendedHitArea_Params_Data); |
| size += mojo::internal::PrepareToSerialize<::gfx::mojom::InsetsDataView>( |
| in_hit_area, &serialization_context); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_SetExtendedHitArea_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_SetExtendedHitArea_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->window_id = in_window_id; |
| typename decltype(params->hit_area)::BaseType* hit_area_ptr; |
| mojo::internal::Serialize<::gfx::mojom::InsetsDataView>( |
| in_hit_area, builder.buffer(), &hit_area_ptr, &serialization_context); |
| params->hit_area.Set(hit_area_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->hit_area.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null hit_area in WindowManagerClient.SetExtendedHitArea request"); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerClientProxy::AddAccelerators( |
| std::vector<WmAcceleratorPtr> in_accelerators, const AddAcceleratorsCallback& callback) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_AddAccelerators_Params_Data); |
| size += mojo::internal::PrepareToSerialize<mojo::ArrayDataView<::ui::mojom::WmAcceleratorDataView>>( |
| in_accelerators, &serialization_context); |
| constexpr uint32_t kFlags = mojo::Message::kFlagExpectsResponse; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_AddAccelerators_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_AddAccelerators_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| typename decltype(params->accelerators)::BaseType* accelerators_ptr; |
| const mojo::internal::ContainerValidateParams accelerators_validate_params( |
| 0, false, nullptr); |
| mojo::internal::Serialize<mojo::ArrayDataView<::ui::mojom::WmAcceleratorDataView>>( |
| in_accelerators, builder.buffer(), &accelerators_ptr, &accelerators_validate_params, |
| &serialization_context); |
| params->accelerators.Set(accelerators_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->accelerators.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null accelerators in WindowManagerClient.AddAccelerators request"); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new WindowManagerClient_AddAccelerators_ForwardToCallback( |
| std::move(callback))); |
| ignore_result(receiver_->AcceptWithResponder(builder.message(), |
| std::move(responder))); |
| } |
| |
| void WindowManagerClientProxy::RemoveAccelerator( |
| uint32_t in_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_RemoveAccelerator_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_RemoveAccelerator_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_RemoveAccelerator_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->id = in_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerClientProxy::SetDisplayRoot( |
| const display::Display& in_display, ::ui::mojom::WmViewportMetricsPtr in_viewport_metrics, bool in_is_primary_display, uint32_t in_window_id, const SetDisplayRootCallback& callback) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_SetDisplayRoot_Params_Data); |
| size += mojo::internal::PrepareToSerialize<::display::mojom::DisplayDataView>( |
| in_display, &serialization_context); |
| size += mojo::internal::PrepareToSerialize<::ui::mojom::WmViewportMetricsDataView>( |
| in_viewport_metrics, &serialization_context); |
| constexpr uint32_t kFlags = mojo::Message::kFlagExpectsResponse; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_SetDisplayRoot_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_SetDisplayRoot_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| typename decltype(params->display)::BaseType* display_ptr; |
| mojo::internal::Serialize<::display::mojom::DisplayDataView>( |
| in_display, builder.buffer(), &display_ptr, &serialization_context); |
| params->display.Set(display_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->display.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null display in WindowManagerClient.SetDisplayRoot request"); |
| typename decltype(params->viewport_metrics)::BaseType* viewport_metrics_ptr; |
| mojo::internal::Serialize<::ui::mojom::WmViewportMetricsDataView>( |
| in_viewport_metrics, builder.buffer(), &viewport_metrics_ptr, &serialization_context); |
| params->viewport_metrics.Set(viewport_metrics_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->viewport_metrics.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null viewport_metrics in WindowManagerClient.SetDisplayRoot request"); |
| params->is_primary_display = in_is_primary_display; |
| params->window_id = in_window_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| std::unique_ptr<mojo::MessageReceiver> responder( |
| new WindowManagerClient_SetDisplayRoot_ForwardToCallback( |
| std::move(callback))); |
| ignore_result(receiver_->AcceptWithResponder(builder.message(), |
| std::move(responder))); |
| } |
| |
| void WindowManagerClientProxy::WmResponse( |
| uint32_t in_change_id, bool in_response) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_WmResponse_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_WmResponse_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_WmResponse_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->change_id = in_change_id; |
| params->response = in_response; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerClientProxy::WmSetBoundsResponse( |
| uint32_t in_change_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_WmSetBoundsResponse_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_WmSetBoundsResponse_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_WmSetBoundsResponse_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->change_id = in_change_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerClientProxy::WmRequestClose( |
| uint32_t in_window_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_WmRequestClose_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_WmRequestClose_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_WmRequestClose_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->window_id = in_window_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerClientProxy::WmSetFrameDecorationValues( |
| ::ui::mojom::FrameDecorationValuesPtr in_values) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_WmSetFrameDecorationValues_Params_Data); |
| size += mojo::internal::PrepareToSerialize<::ui::mojom::FrameDecorationValuesDataView>( |
| in_values, &serialization_context); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_WmSetFrameDecorationValues_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_WmSetFrameDecorationValues_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| typename decltype(params->values)::BaseType* values_ptr; |
| mojo::internal::Serialize<::ui::mojom::FrameDecorationValuesDataView>( |
| in_values, builder.buffer(), &values_ptr, &serialization_context); |
| params->values.Set(values_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->values.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null values in WindowManagerClient.WmSetFrameDecorationValues request"); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerClientProxy::WmSetNonClientCursor( |
| uint32_t in_window_id, ui::CursorData in_cursor) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_WmSetNonClientCursor_Params_Data); |
| size += mojo::internal::PrepareToSerialize<::ui::mojom::CursorDataDataView>( |
| in_cursor, &serialization_context); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_WmSetNonClientCursor_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_WmSetNonClientCursor_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->window_id = in_window_id; |
| typename decltype(params->cursor)::BaseType* cursor_ptr; |
| mojo::internal::Serialize<::ui::mojom::CursorDataDataView>( |
| in_cursor, builder.buffer(), &cursor_ptr, &serialization_context); |
| params->cursor.Set(cursor_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->cursor.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null cursor in WindowManagerClient.WmSetNonClientCursor request"); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerClientProxy::OnWmCreatedTopLevelWindow( |
| uint32_t in_change_id, uint32_t in_window_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_OnWmCreatedTopLevelWindow_Params_Data); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_OnWmCreatedTopLevelWindow_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_OnWmCreatedTopLevelWindow_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->change_id = in_change_id; |
| params->window_id = in_window_id; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| |
| void WindowManagerClientProxy::OnAcceleratorAck( |
| uint32_t in_ack_id, ::ui::mojom::EventResult in_event_result, const std::unordered_map<std::string, std::vector<uint8_t>>& in_properties) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_OnAcceleratorAck_Params_Data); |
| size += mojo::internal::PrepareToSerialize<mojo::MapDataView<mojo::StringDataView, mojo::ArrayDataView<uint8_t>>>( |
| in_properties, &serialization_context); |
| constexpr uint32_t kFlags = 0; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_OnAcceleratorAck_Name, kFlags, size, |
| serialization_context.associated_endpoint_count); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_OnAcceleratorAck_Params_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->ack_id = in_ack_id; |
| mojo::internal::Serialize<::ui::mojom::EventResult>( |
| in_event_result, ¶ms->event_result); |
| typename decltype(params->properties)::BaseType* properties_ptr; |
| const mojo::internal::ContainerValidateParams properties_validate_params( |
| new mojo::internal::ContainerValidateParams(0, false, new mojo::internal::ContainerValidateParams(0, false, nullptr)), new mojo::internal::ContainerValidateParams(0, false, new mojo::internal::ContainerValidateParams(0, false, nullptr))); |
| mojo::internal::Serialize<mojo::MapDataView<mojo::StringDataView, mojo::ArrayDataView<uint8_t>>>( |
| in_properties, builder.buffer(), &properties_ptr, &properties_validate_params, |
| &serialization_context); |
| params->properties.Set(properties_ptr); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| params->properties.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null properties in WindowManagerClient.OnAcceleratorAck request"); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| // This return value may be ignored as false implies the Connector has |
| // encountered an error, which will be visible through other means. |
| ignore_result(receiver_->Accept(builder.message())); |
| } |
| class WindowManagerClient_AddAccelerators_ProxyToResponder { |
| public: |
| static WindowManagerClient::AddAcceleratorsCallback CreateCallback( |
| uint64_t request_id, |
| bool is_sync, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<WindowManagerClient_AddAccelerators_ProxyToResponder> proxy( |
| new WindowManagerClient_AddAccelerators_ProxyToResponder( |
| request_id, is_sync, std::move(responder))); |
| return base::Bind(&WindowManagerClient_AddAccelerators_ProxyToResponder::Run, |
| base::Passed(&proxy)); |
| } |
| |
| ~WindowManagerClient_AddAccelerators_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // Is the Service destroying the callback without running it |
| // and without first closing the pipe? |
| responder_->DCheckInvalid("The callback passed to " |
| "WindowManagerClient::AddAccelerators() was never run."); |
| } |
| #endif |
| // If the Callback was dropped then deleting the responder will close |
| // the pipe so the calling application knows to stop waiting for a reply. |
| responder_ = nullptr; |
| } |
| |
| private: |
| WindowManagerClient_AddAccelerators_ProxyToResponder( |
| uint64_t request_id, |
| bool is_sync, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : request_id_(request_id), |
| is_sync_(is_sync), |
| responder_(std::move(responder)) { |
| } |
| |
| void Run( |
| bool in_success); |
| |
| uint64_t request_id_; |
| bool is_sync_; |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder_; |
| |
| DISALLOW_COPY_AND_ASSIGN(WindowManagerClient_AddAccelerators_ProxyToResponder); |
| }; |
| |
| void WindowManagerClient_AddAccelerators_ProxyToResponder::Run( |
| bool in_success) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_AddAccelerators_ResponseParams_Data); |
| |
| uint32_t flags = (is_sync_ ? mojo::Message::kFlagIsSync : 0) | |
| mojo::Message::kFlagIsResponse; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_AddAccelerators_Name, flags, size, |
| serialization_context.associated_endpoint_count); |
| builder.message()->set_request_id(request_id_); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_AddAccelerators_ResponseParams_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| params->success = in_success; |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| ignore_result(responder_->Accept(builder.message())); |
| // TODO(darin): Accept() returning false indicates a malformed message, and |
| // 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 WindowManagerClient_SetDisplayRoot_ProxyToResponder { |
| public: |
| static WindowManagerClient::SetDisplayRootCallback CreateCallback( |
| uint64_t request_id, |
| bool is_sync, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| std::unique_ptr<WindowManagerClient_SetDisplayRoot_ProxyToResponder> proxy( |
| new WindowManagerClient_SetDisplayRoot_ProxyToResponder( |
| request_id, is_sync, std::move(responder))); |
| return base::Bind(&WindowManagerClient_SetDisplayRoot_ProxyToResponder::Run, |
| base::Passed(&proxy)); |
| } |
| |
| ~WindowManagerClient_SetDisplayRoot_ProxyToResponder() { |
| #if DCHECK_IS_ON() |
| if (responder_) { |
| // Is the Service destroying the callback without running it |
| // and without first closing the pipe? |
| responder_->DCheckInvalid("The callback passed to " |
| "WindowManagerClient::SetDisplayRoot() was never run."); |
| } |
| #endif |
| // If the Callback was dropped then deleting the responder will close |
| // the pipe so the calling application knows to stop waiting for a reply. |
| responder_ = nullptr; |
| } |
| |
| private: |
| WindowManagerClient_SetDisplayRoot_ProxyToResponder( |
| uint64_t request_id, |
| bool is_sync, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) |
| : request_id_(request_id), |
| is_sync_(is_sync), |
| responder_(std::move(responder)) { |
| } |
| |
| void Run( |
| const base::Optional<cc::FrameSinkId>& in_frame_sink_id); |
| |
| uint64_t request_id_; |
| bool is_sync_; |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder_; |
| |
| DISALLOW_COPY_AND_ASSIGN(WindowManagerClient_SetDisplayRoot_ProxyToResponder); |
| }; |
| |
| void WindowManagerClient_SetDisplayRoot_ProxyToResponder::Run( |
| const base::Optional<cc::FrameSinkId>& in_frame_sink_id) { |
| mojo::internal::SerializationContext serialization_context; |
| size_t size = sizeof(::ui::mojom::internal::WindowManagerClient_SetDisplayRoot_ResponseParams_Data); |
| size += mojo::internal::PrepareToSerialize<::cc::mojom::FrameSinkIdDataView>( |
| in_frame_sink_id, &serialization_context); |
| |
| uint32_t flags = (is_sync_ ? mojo::Message::kFlagIsSync : 0) | |
| mojo::Message::kFlagIsResponse; |
| mojo::internal::MessageBuilder builder( |
| internal::kWindowManagerClient_SetDisplayRoot_Name, flags, size, |
| serialization_context.associated_endpoint_count); |
| builder.message()->set_request_id(request_id_); |
| |
| auto params = |
| ::ui::mojom::internal::WindowManagerClient_SetDisplayRoot_ResponseParams_Data::New(builder.buffer()); |
| ALLOW_UNUSED_LOCAL(params); |
| typename decltype(params->frame_sink_id)::BaseType* frame_sink_id_ptr; |
| mojo::internal::Serialize<::cc::mojom::FrameSinkIdDataView>( |
| in_frame_sink_id, builder.buffer(), &frame_sink_id_ptr, &serialization_context); |
| params->frame_sink_id.Set(frame_sink_id_ptr); |
| (&serialization_context)->handles.Swap( |
| builder.message()->mutable_handles()); |
| (&serialization_context)->associated_endpoint_handles.swap( |
| *builder.message()->mutable_associated_endpoint_handles()); |
| ignore_result(responder_->Accept(builder.message())); |
| // TODO(darin): Accept() returning false indicates a malformed message, and |
| // 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 WindowManagerClientStubDispatch::Accept( |
| WindowManagerClient* impl, |
| mojo::Message* message) { |
| switch (message->header()->name) { |
| case internal::kWindowManagerClient_AddActivationParent_Name: { |
| internal::WindowManagerClient_AddActivationParent_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_AddActivationParent_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_window_id{}; |
| WindowManagerClient_AddActivationParent_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_window_id = input_data_view.window_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::AddActivationParent deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::AddActivationParent"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->AddActivationParent( |
| std::move(p_window_id)); |
| return true; |
| } |
| case internal::kWindowManagerClient_RemoveActivationParent_Name: { |
| internal::WindowManagerClient_RemoveActivationParent_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_RemoveActivationParent_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_window_id{}; |
| WindowManagerClient_RemoveActivationParent_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_window_id = input_data_view.window_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::RemoveActivationParent deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::RemoveActivationParent"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->RemoveActivationParent( |
| std::move(p_window_id)); |
| return true; |
| } |
| case internal::kWindowManagerClient_ActivateNextWindow_Name: { |
| internal::WindowManagerClient_ActivateNextWindow_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_ActivateNextWindow_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| WindowManagerClient_ActivateNextWindow_ParamsDataView input_data_view(params, &serialization_context); |
| |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::ActivateNextWindow deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::ActivateNextWindow"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->ActivateNextWindow(); |
| return true; |
| } |
| case internal::kWindowManagerClient_SetExtendedHitArea_Name: { |
| internal::WindowManagerClient_SetExtendedHitArea_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_SetExtendedHitArea_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_window_id{}; |
| gfx::Insets p_hit_area{}; |
| WindowManagerClient_SetExtendedHitArea_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_window_id = input_data_view.window_id(); |
| if (!input_data_view.ReadHitArea(&p_hit_area)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::SetExtendedHitArea deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::SetExtendedHitArea"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->SetExtendedHitArea( |
| std::move(p_window_id), |
| std::move(p_hit_area)); |
| return true; |
| } |
| case internal::kWindowManagerClient_AddAccelerators_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_RemoveAccelerator_Name: { |
| internal::WindowManagerClient_RemoveAccelerator_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_RemoveAccelerator_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_id{}; |
| WindowManagerClient_RemoveAccelerator_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_id = input_data_view.id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::RemoveAccelerator deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::RemoveAccelerator"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->RemoveAccelerator( |
| std::move(p_id)); |
| return true; |
| } |
| case internal::kWindowManagerClient_SetDisplayRoot_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_WmResponse_Name: { |
| internal::WindowManagerClient_WmResponse_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_WmResponse_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_change_id{}; |
| bool p_response{}; |
| WindowManagerClient_WmResponse_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_change_id = input_data_view.change_id(); |
| p_response = input_data_view.response(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::WmResponse deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::WmResponse"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmResponse( |
| std::move(p_change_id), |
| std::move(p_response)); |
| return true; |
| } |
| case internal::kWindowManagerClient_WmSetBoundsResponse_Name: { |
| internal::WindowManagerClient_WmSetBoundsResponse_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_WmSetBoundsResponse_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_change_id{}; |
| WindowManagerClient_WmSetBoundsResponse_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_change_id = input_data_view.change_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::WmSetBoundsResponse deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::WmSetBoundsResponse"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmSetBoundsResponse( |
| std::move(p_change_id)); |
| return true; |
| } |
| case internal::kWindowManagerClient_WmRequestClose_Name: { |
| internal::WindowManagerClient_WmRequestClose_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_WmRequestClose_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_window_id{}; |
| WindowManagerClient_WmRequestClose_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_window_id = input_data_view.window_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::WmRequestClose deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::WmRequestClose"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmRequestClose( |
| std::move(p_window_id)); |
| return true; |
| } |
| case internal::kWindowManagerClient_WmSetFrameDecorationValues_Name: { |
| internal::WindowManagerClient_WmSetFrameDecorationValues_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_WmSetFrameDecorationValues_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| ::ui::mojom::FrameDecorationValuesPtr p_values{}; |
| WindowManagerClient_WmSetFrameDecorationValues_ParamsDataView input_data_view(params, &serialization_context); |
| |
| if (!input_data_view.ReadValues(&p_values)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::WmSetFrameDecorationValues deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::WmSetFrameDecorationValues"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmSetFrameDecorationValues( |
| std::move(p_values)); |
| return true; |
| } |
| case internal::kWindowManagerClient_WmSetNonClientCursor_Name: { |
| internal::WindowManagerClient_WmSetNonClientCursor_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_WmSetNonClientCursor_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_window_id{}; |
| ui::CursorData p_cursor{}; |
| WindowManagerClient_WmSetNonClientCursor_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_window_id = input_data_view.window_id(); |
| if (!input_data_view.ReadCursor(&p_cursor)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::WmSetNonClientCursor deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::WmSetNonClientCursor"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->WmSetNonClientCursor( |
| std::move(p_window_id), |
| std::move(p_cursor)); |
| return true; |
| } |
| case internal::kWindowManagerClient_OnWmCreatedTopLevelWindow_Name: { |
| internal::WindowManagerClient_OnWmCreatedTopLevelWindow_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_OnWmCreatedTopLevelWindow_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_change_id{}; |
| uint32_t p_window_id{}; |
| WindowManagerClient_OnWmCreatedTopLevelWindow_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_change_id = input_data_view.change_id(); |
| p_window_id = input_data_view.window_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::OnWmCreatedTopLevelWindow deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::OnWmCreatedTopLevelWindow"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->OnWmCreatedTopLevelWindow( |
| std::move(p_change_id), |
| std::move(p_window_id)); |
| return true; |
| } |
| case internal::kWindowManagerClient_OnAcceleratorAck_Name: { |
| internal::WindowManagerClient_OnAcceleratorAck_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_OnAcceleratorAck_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| uint32_t p_ack_id{}; |
| ::ui::mojom::EventResult p_event_result{}; |
| std::unordered_map<std::string, std::vector<uint8_t>> p_properties{}; |
| WindowManagerClient_OnAcceleratorAck_ParamsDataView input_data_view(params, &serialization_context); |
| |
| p_ack_id = input_data_view.ack_id(); |
| if (!input_data_view.ReadEventResult(&p_event_result)) |
| success = false; |
| if (!input_data_view.ReadProperties(&p_properties)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::OnAcceleratorAck deserializer"); |
| return false; |
| } |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::OnAcceleratorAck"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->OnAcceleratorAck( |
| std::move(p_ack_id), |
| std::move(p_event_result), |
| std::move(p_properties)); |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| // static |
| bool WindowManagerClientStubDispatch::AcceptWithResponder( |
| WindowManagerClient* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { |
| switch (message->header()->name) { |
| case internal::kWindowManagerClient_AddActivationParent_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_RemoveActivationParent_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_ActivateNextWindow_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_SetExtendedHitArea_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_AddAccelerators_Name: { |
| internal::WindowManagerClient_AddAccelerators_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_AddAccelerators_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| std::vector<WmAcceleratorPtr> p_accelerators{}; |
| WindowManagerClient_AddAccelerators_ParamsDataView input_data_view(params, &serialization_context); |
| |
| if (!input_data_view.ReadAccelerators(&p_accelerators)) |
| success = false; |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::AddAccelerators deserializer"); |
| return false; |
| } |
| WindowManagerClient::AddAcceleratorsCallback callback = |
| WindowManagerClient_AddAccelerators_ProxyToResponder::CreateCallback( |
| message->request_id(), |
| message->has_flag(mojo::Message::kFlagIsSync), |
| std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::AddAccelerators"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->AddAccelerators( |
| std::move(p_accelerators), std::move(callback)); |
| return true; |
| } |
| case internal::kWindowManagerClient_RemoveAccelerator_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_SetDisplayRoot_Name: { |
| internal::WindowManagerClient_SetDisplayRoot_Params_Data* params = |
| reinterpret_cast<internal::WindowManagerClient_SetDisplayRoot_Params_Data*>( |
| message->mutable_payload()); |
| |
| mojo::internal::SerializationContext serialization_context; |
| serialization_context.handles.Swap((message)->mutable_handles()); |
| serialization_context.associated_endpoint_handles.swap( |
| *(message)->mutable_associated_endpoint_handles()); |
| bool success = true; |
| display::Display p_display{}; |
| ::ui::mojom::WmViewportMetricsPtr p_viewport_metrics{}; |
| bool p_is_primary_display{}; |
| uint32_t p_window_id{}; |
| WindowManagerClient_SetDisplayRoot_ParamsDataView input_data_view(params, &serialization_context); |
| |
| if (!input_data_view.ReadDisplay(&p_display)) |
| success = false; |
| if (!input_data_view.ReadViewportMetrics(&p_viewport_metrics)) |
| success = false; |
| p_is_primary_display = input_data_view.is_primary_display(); |
| p_window_id = input_data_view.window_id(); |
| if (!success) { |
| ReportValidationErrorForMessage( |
| message, |
| mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, |
| "WindowManagerClient::SetDisplayRoot deserializer"); |
| return false; |
| } |
| WindowManagerClient::SetDisplayRootCallback callback = |
| WindowManagerClient_SetDisplayRoot_ProxyToResponder::CreateCallback( |
| message->request_id(), |
| message->has_flag(mojo::Message::kFlagIsSync), |
| std::move(responder)); |
| // A null |impl| means no implementation was bound. |
| assert(impl); |
| TRACE_EVENT0("mojom", "WindowManagerClient::SetDisplayRoot"); |
| mojo::internal::MessageDispatchContext context(message); |
| impl->SetDisplayRoot( |
| std::move(p_display), |
| std::move(p_viewport_metrics), |
| std::move(p_is_primary_display), |
| std::move(p_window_id), std::move(callback)); |
| return true; |
| } |
| case internal::kWindowManagerClient_WmResponse_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_WmSetBoundsResponse_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_WmRequestClose_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_WmSetFrameDecorationValues_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_WmSetNonClientCursor_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_OnWmCreatedTopLevelWindow_Name: { |
| break; |
| } |
| case internal::kWindowManagerClient_OnAcceleratorAck_Name: { |
| break; |
| } |
| } |
| return false; |
| } |
| |
| bool WindowManagerClientRequestValidator::Accept(mojo::Message* message) { |
| if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) |
| return true; |
| |
| mojo::internal::ValidationContext validation_context( |
| message->payload(), message->payload_num_bytes(), |
| message->handles()->size(), message->payload_num_interface_ids(), message, |
| "WindowManagerClient RequestValidator"); |
| |
| switch (message->header()->name) { |
| case internal::kWindowManagerClient_AddActivationParent_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_AddActivationParent_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_RemoveActivationParent_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_RemoveActivationParent_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_ActivateNextWindow_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_ActivateNextWindow_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_SetExtendedHitArea_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_SetExtendedHitArea_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_AddAccelerators_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestExpectingResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_AddAccelerators_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_RemoveAccelerator_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_RemoveAccelerator_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_SetDisplayRoot_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestExpectingResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_SetDisplayRoot_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_WmResponse_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_WmResponse_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_WmSetBoundsResponse_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_WmSetBoundsResponse_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_WmRequestClose_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_WmRequestClose_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_WmSetFrameDecorationValues_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_WmSetFrameDecorationValues_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_WmSetNonClientCursor_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_WmSetNonClientCursor_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_OnWmCreatedTopLevelWindow_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_OnWmCreatedTopLevelWindow_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_OnAcceleratorAck_Name: { |
| if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( |
| message, &validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_OnAcceleratorAck_Params_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| default: |
| break; |
| } |
| |
| // Unrecognized message. |
| ReportValidationError( |
| &validation_context, |
| mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); |
| return false; |
| } |
| |
| bool WindowManagerClientResponseValidator::Accept(mojo::Message* message) { |
| if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) |
| return true; |
| |
| mojo::internal::ValidationContext validation_context( |
| message->payload(), message->payload_num_bytes(), |
| message->handles()->size(), message->payload_num_interface_ids(), message, |
| "WindowManagerClient ResponseValidator"); |
| |
| if (!mojo::internal::ValidateMessageIsResponse(message, &validation_context)) |
| return false; |
| switch (message->header()->name) { |
| case internal::kWindowManagerClient_AddAccelerators_Name: { |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_AddAccelerators_ResponseParams_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| case internal::kWindowManagerClient_SetDisplayRoot_Name: { |
| if (!mojo::internal::ValidateMessagePayload< |
| internal::WindowManagerClient_SetDisplayRoot_ResponseParams_Data>( |
| message, &validation_context)) { |
| return false; |
| } |
| return true; |
| } |
| default: |
| break; |
| } |
| |
| // Unrecognized message. |
| ReportValidationError( |
| &validation_context, |
| mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); |
| return false; |
| } |
| } // namespace mojom |
| } // namespace ui |
| |
| namespace mojo { |
| |
| |
| // static |
| bool StructTraits<::ui::mojom::WmAccelerator::DataView, ::ui::mojom::WmAcceleratorPtr>::Read( |
| ::ui::mojom::WmAccelerator::DataView input, |
| ::ui::mojom::WmAcceleratorPtr* output) { |
| bool success = true; |
| ::ui::mojom::WmAcceleratorPtr result(::ui::mojom::WmAccelerator::New()); |
| |
| result->id = input.id(); |
| if (!input.ReadEventMatcher(&result->event_matcher)) |
| success = false; |
| *output = std::move(result); |
| return success; |
| } |
| |
| } // namespace mojo |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic pop |
| #elif defined(_MSC_VER) |
| #pragma warning(pop) |
| #endif |