| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_IME_IME_STRUCT_TRAITS_H_ | 5 #ifndef SERVICES_UI_PUBLIC_INTERFACES_IME_IME_STRUCT_TRAITS_H_ |
| 6 #define SERVICES_UI_PUBLIC_INTERFACES_IME_IME_STRUCT_TRAITS_H_ | 6 #define SERVICES_UI_PUBLIC_INTERFACES_IME_IME_STRUCT_TRAITS_H_ |
| 7 | 7 |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "services/ui/public/interfaces/ime/ime.mojom-shared.h" | 9 #include "services/ui/public/interfaces/ime/ime.mojom-shared.h" |
| 10 #include "ui/base/ime/composition_text.h" | 10 #include "ui/base/ime/composition_text.h" |
| 11 #include "ui/base/ime/composition_underline.h" | 11 #include "ui/base/ime/composition_underline.h" |
| 12 #include "ui/base/ime/text_input_mode.h" |
| 13 #include "ui/base/ime/text_input_type.h" |
| 12 | 14 |
| 13 namespace mojo { | 15 namespace mojo { |
| 14 | 16 |
| 15 template <> | 17 template <> |
| 16 struct StructTraits<ui::mojom::CompositionUnderlineDataView, | 18 struct StructTraits<ui::mojom::CompositionUnderlineDataView, |
| 17 ui::CompositionUnderline> { | 19 ui::CompositionUnderline> { |
| 18 static uint32_t start_offset(const ui::CompositionUnderline& c) { | 20 static uint32_t start_offset(const ui::CompositionUnderline& c) { |
| 19 return c.start_offset; | 21 return c.start_offset; |
| 20 } | 22 } |
| 21 static uint32_t end_offset(const ui::CompositionUnderline& c) { | 23 static uint32_t end_offset(const ui::CompositionUnderline& c) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 static ui::CompositionUnderlines underlines(const ui::CompositionText& c) { | 40 static ui::CompositionUnderlines underlines(const ui::CompositionText& c) { |
| 39 return c.underlines; | 41 return c.underlines; |
| 40 } | 42 } |
| 41 static gfx::Range selection(const ui::CompositionText& c) { | 43 static gfx::Range selection(const ui::CompositionText& c) { |
| 42 return c.selection; | 44 return c.selection; |
| 43 } | 45 } |
| 44 static bool Read(ui::mojom::CompositionTextDataView data, | 46 static bool Read(ui::mojom::CompositionTextDataView data, |
| 45 ui::CompositionText* out); | 47 ui::CompositionText* out); |
| 46 }; | 48 }; |
| 47 | 49 |
| 50 template <> |
| 51 struct EnumTraits<ui::mojom::TextInputMode, ui::TextInputMode> { |
| 52 static ui::mojom::TextInputMode ToMojom(ui::TextInputMode text_input_mode); |
| 53 static bool FromMojom(ui::mojom::TextInputMode input, ui::TextInputMode* out); |
| 54 }; |
| 55 |
| 56 template <> |
| 57 struct EnumTraits<ui::mojom::TextInputType, ui::TextInputType> { |
| 58 static ui::mojom::TextInputType ToMojom(ui::TextInputType text_input_type); |
| 59 static bool FromMojom(ui::mojom::TextInputType input, ui::TextInputType* out); |
| 60 }; |
| 61 |
| 48 } // namespace mojo | 62 } // namespace mojo |
| 49 | 63 |
| 50 #endif // SERVICES_UI_PUBLIC_INTERFACES_IME_IME_STRUCT_TRAITS_H_ | 64 #endif // SERVICES_UI_PUBLIC_INTERFACES_IME_IME_STRUCT_TRAITS_H_ |
| OLD | NEW |