Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: services/ui/public/interfaces/ime/ime_struct_traits.cc

Issue 2839243002: IME for Mus: Structs and StructTraits for IME Candidate Window. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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() == ui::mojom::CandidateWindowPosition::COMPOSITION;
27 return true;
28 }
29
30 // static
31 bool StructTraits<ui::mojom::CandidateWindowEntryDataView,
32 ui::CandidateWindow::Entry>::
33 Read(ui::mojom::CandidateWindowEntryDataView data,
34 ui::CandidateWindow::Entry* out) {
35 return !data.is_null() && data.ReadValue(&out->value) &&
36 data.ReadLabel(&out->label) && data.ReadAnnotation(&out->annotation) &&
37 data.ReadDescriptionTitle(&out->description_title) &&
38 data.ReadDescriptionBody(&out->description_body);
39 }
40
41 // static
12 bool StructTraits<ui::mojom::CompositionUnderlineDataView, 42 bool StructTraits<ui::mojom::CompositionUnderlineDataView,
13 ui::CompositionUnderline>:: 43 ui::CompositionUnderline>::
14 Read(ui::mojom::CompositionUnderlineDataView data, 44 Read(ui::mojom::CompositionUnderlineDataView data,
15 ui::CompositionUnderline* out) { 45 ui::CompositionUnderline* out) {
16 if (data.is_null()) 46 if (data.is_null())
17 return false; 47 return false;
18 out->start_offset = data.start_offset(); 48 out->start_offset = data.start_offset();
19 out->end_offset = data.end_offset(); 49 out->end_offset = data.end_offset();
20 out->color = data.color(); 50 out->color = data.color();
21 out->thick = data.thick(); 51 out->thick = data.thick();
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 *out = ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE; 243 *out = ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE;
214 return true; 244 return true;
215 case ui::mojom::TextInputType::DATETIME_FIELD: 245 case ui::mojom::TextInputType::DATETIME_FIELD:
216 *out = ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD; 246 *out = ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD;
217 return true; 247 return true;
218 } 248 }
219 return false; 249 return false;
220 } 250 }
221 251
222 } // namespace mojo 252 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698