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 #include "services/ui/public/interfaces/ime/ime_struct_traits.h" | 5 #include "services/ui/public/interfaces/ime/ime_struct_traits.h" |
6 | 6 |
7 #include "ui/gfx/range/mojo/range_struct_traits.h" | 7 #include "ui/gfx/range/mojo/range_struct_traits.h" |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 | 10 |
11 // static | 11 // static |
| 12 bool StructTraits<ui::mojom::CandidateWindowPropertiesDataView, |
| 13 ui::CandidateWindow::CandidateWindowProperty>:: |
| 14 Read(ui::mojom::CandidateWindowPropertiesDataView data, |
| 15 ui::CandidateWindow::CandidateWindowProperty* out) { |
| 16 if (data.is_null()) |
| 17 return false; |
| 18 if (!data.ReadAuxiliaryText(&out->auxiliary_text)) |
| 19 return false; |
| 20 out->page_size = data.page_size(); |
| 21 out->is_vertical = data.vertical(); |
| 22 out->is_auxiliary_text_visible = data.auxiliary_text_visible(); |
| 23 out->cursor_position = data.cursor_position(); |
| 24 out->is_cursor_visible = data.cursor_visible(); |
| 25 out->show_window_at_composition = |
| 26 data.window_position() == |
| 27 ui::mojom::CandidateWindowPosition::kComposition; |
| 28 return true; |
| 29 } |
| 30 |
| 31 // static |
| 32 bool StructTraits<ui::mojom::CandidateWindowEntryDataView, |
| 33 ui::CandidateWindow::Entry>:: |
| 34 Read(ui::mojom::CandidateWindowEntryDataView data, |
| 35 ui::CandidateWindow::Entry* out) { |
| 36 return !data.is_null() && data.ReadValue(&out->value) && |
| 37 data.ReadLabel(&out->label) && data.ReadAnnotation(&out->annotation) && |
| 38 data.ReadDescriptionTitle(&out->description_title) && |
| 39 data.ReadDescriptionBody(&out->description_body); |
| 40 } |
| 41 |
| 42 // static |
12 bool StructTraits<ui::mojom::CompositionUnderlineDataView, | 43 bool StructTraits<ui::mojom::CompositionUnderlineDataView, |
13 ui::CompositionUnderline>:: | 44 ui::CompositionUnderline>:: |
14 Read(ui::mojom::CompositionUnderlineDataView data, | 45 Read(ui::mojom::CompositionUnderlineDataView data, |
15 ui::CompositionUnderline* out) { | 46 ui::CompositionUnderline* out) { |
16 if (data.is_null()) | 47 if (data.is_null()) |
17 return false; | 48 return false; |
18 out->start_offset = data.start_offset(); | 49 out->start_offset = data.start_offset(); |
19 out->end_offset = data.end_offset(); | 50 out->end_offset = data.end_offset(); |
20 out->color = data.color(); | 51 out->color = data.color(); |
21 out->thick = data.thick(); | 52 out->thick = data.thick(); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 *out = ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE; | 244 *out = ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE; |
214 return true; | 245 return true; |
215 case ui::mojom::TextInputType::DATETIME_FIELD: | 246 case ui::mojom::TextInputType::DATETIME_FIELD: |
216 *out = ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD; | 247 *out = ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD; |
217 return true; | 248 return true; |
218 } | 249 } |
219 return false; | 250 return false; |
220 } | 251 } |
221 | 252 |
222 } // namespace mojo | 253 } // namespace mojo |
OLD | NEW |