| // 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/cursor/cursor.mojom-blink.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 "mojo/public/cpp/bindings/lib/wtf_serialization.h" |
| namespace ui { |
| namespace mojom { |
| namespace blink { |
| CursorData::CursorData() |
| : cursor_type(), |
| frame_delay(), |
| hotspot_in_pixels(), |
| cursor_frames(), |
| scale_factor() {} |
| |
| CursorData::CursorData( |
| CursorType cursor_type_in, |
| ::mojo::common::mojom::blink::TimeDeltaPtr frame_delay_in, |
| ::gfx::mojom::blink::PointPtr hotspot_in_pixels_in, |
| WTF::Vector<::skia::mojom::blink::BitmapPtr> cursor_frames_in, |
| float scale_factor_in) |
| : cursor_type(std::move(cursor_type_in)), |
| frame_delay(std::move(frame_delay_in)), |
| hotspot_in_pixels(std::move(hotspot_in_pixels_in)), |
| cursor_frames(std::move(cursor_frames_in)), |
| scale_factor(std::move(scale_factor_in)) {} |
| |
| CursorData::~CursorData() = default; |
| |
| bool CursorData::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| } // namespace blink |
| } // namespace mojom |
| } // namespace ui |
| |
| namespace mojo { |
| |
| |
| // static |
| bool StructTraits<::ui::mojom::blink::CursorData::DataView, ::ui::mojom::blink::CursorDataPtr>::Read( |
| ::ui::mojom::blink::CursorData::DataView input, |
| ::ui::mojom::blink::CursorDataPtr* output) { |
| bool success = true; |
| ::ui::mojom::blink::CursorDataPtr result(::ui::mojom::blink::CursorData::New()); |
| |
| if (!input.ReadCursorType(&result->cursor_type)) |
| success = false; |
| if (!input.ReadFrameDelay(&result->frame_delay)) |
| success = false; |
| if (!input.ReadHotspotInPixels(&result->hotspot_in_pixels)) |
| success = false; |
| if (!input.ReadCursorFrames(&result->cursor_frames)) |
| success = false; |
| result->scale_factor = input.scale_factor(); |
| *output = std::move(result); |
| return success; |
| } |
| |
| } // namespace mojo |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic pop |
| #elif defined(_MSC_VER) |
| #pragma warning(pop) |
| #endif |