OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SERVICES_UI_PUBLIC_INTERFACES_CURSOR_CURSOR_STRUCT_TRAITS_H_ | 5 #ifndef SERVICES_UI_PUBLIC_INTERFACES_CURSOR_CURSOR_STRUCT_TRAITS_H_ |
6 #define SERVICES_UI_PUBLIC_INTERFACES_CURSOR_CURSOR_STRUCT_TRAITS_H_ | 6 #define SERVICES_UI_PUBLIC_INTERFACES_CURSOR_CURSOR_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "services/ui/public/interfaces/cursor/cursor.mojom-shared.h" | 8 #include "services/ui/public/interfaces/cursor/cursor.mojom-shared.h" |
9 #include "ui/base/cursor/cursor_data.h" | 9 #include "ui/base/cursor/cursor_data.h" |
| 10 #include "ui/base/cursor/cursor_type.h" |
10 | 11 |
11 namespace mojo { | 12 namespace mojo { |
12 | 13 |
13 template <> | 14 template <> |
14 struct EnumTraits<ui::mojom::CursorType, ui::CursorType> { | 15 struct EnumTraits<ui::mojom::CursorType, ui::CursorType> { |
15 static ui::mojom::CursorType ToMojom(ui::CursorType input); | 16 static ui::mojom::CursorType ToMojom(ui::CursorType input); |
16 static bool FromMojom(ui::mojom::CursorType input, ui::CursorType* out); | 17 static bool FromMojom(ui::mojom::CursorType input, ui::CursorType* out); |
17 }; | 18 }; |
18 | 19 |
19 template <> | 20 template <> |
| 21 struct EnumTraits<ui::mojom::CursorSize, ui::CursorSize> { |
| 22 static ui::mojom::CursorSize ToMojom(ui::CursorSize input); |
| 23 static bool FromMojom(ui::mojom::CursorSize input, ui::CursorSize* out); |
| 24 }; |
| 25 |
| 26 template <> |
20 struct StructTraits<ui::mojom::CursorDataDataView, ui::CursorData> { | 27 struct StructTraits<ui::mojom::CursorDataDataView, ui::CursorData> { |
21 static ui::CursorType cursor_type(const ui::CursorData& c) { | 28 static ui::CursorType cursor_type(const ui::CursorData& c) { |
22 return c.cursor_type(); | 29 return c.cursor_type(); |
23 } | 30 } |
24 static const base::TimeDelta& frame_delay(const ui::CursorData& c); | 31 static const base::TimeDelta& frame_delay(const ui::CursorData& c); |
25 static const gfx::Point& hotspot_in_pixels(const ui::CursorData& c); | 32 static const gfx::Point& hotspot_in_pixels(const ui::CursorData& c); |
26 static const std::vector<SkBitmap>& cursor_frames(const ui::CursorData& c); | 33 static const std::vector<SkBitmap>& cursor_frames(const ui::CursorData& c); |
27 static float scale_factor(const ui::CursorData& c) { | 34 static float scale_factor(const ui::CursorData& c) { |
28 return c.scale_factor(); | 35 return c.scale_factor(); |
29 } | 36 } |
30 static bool Read(ui::mojom::CursorDataDataView data, ui::CursorData* out); | 37 static bool Read(ui::mojom::CursorDataDataView data, ui::CursorData* out); |
31 }; | 38 }; |
32 | 39 |
33 } // namespace mojo | 40 } // namespace mojo |
34 | 41 |
35 #endif // SERVICES_UI_PUBLIC_INTERFACES_CURSOR_CURSOR_STRUCT_TRAITS_H_ | 42 #endif // SERVICES_UI_PUBLIC_INTERFACES_CURSOR_CURSOR_STRUCT_TRAITS_H_ |
OLD | NEW |