| OLD | NEW | 
| (Empty) |  | 
 |   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 | 
 |   3 // found in the LICENSE file. | 
 |   4  | 
 |   5 #ifndef SERVICES_UI_PUBLIC_INTERFACES_IME_IME_STRUCT_TRAITS_H_ | 
 |   6 #define SERVICES_UI_PUBLIC_INTERFACES_IME_IME_STRUCT_TRAITS_H_ | 
 |   7  | 
 |   8 #include "base/strings/utf_string_conversions.h" | 
 |   9 #include "services/ui/public/interfaces/ime/ime.mojom-shared.h" | 
 |  10 #include "ui/base/ime/composition_text.h" | 
 |  11 #include "ui/base/ime/composition_underline.h" | 
 |  12  | 
 |  13 namespace mojo { | 
 |  14  | 
 |  15 template <> | 
 |  16 struct StructTraits<ui::mojom::CompositionUnderlineDataView, | 
 |  17                     ui::CompositionUnderline> { | 
 |  18   static uint32_t start_offset(const ui::CompositionUnderline& c) { | 
 |  19     return c.start_offset; | 
 |  20   } | 
 |  21   static uint32_t end_offset(const ui::CompositionUnderline& c) { | 
 |  22     return c.end_offset; | 
 |  23   } | 
 |  24   static uint32_t color(const ui::CompositionUnderline& c) { return c.color; } | 
 |  25   static uint32_t thick(const ui::CompositionUnderline& c) { return c.thick; } | 
 |  26   static uint32_t background_color(const ui::CompositionUnderline& c) { | 
 |  27     return c.background_color; | 
 |  28   } | 
 |  29   static bool Read(ui::mojom::CompositionUnderlineDataView data, | 
 |  30                    ui::CompositionUnderline* out); | 
 |  31 }; | 
 |  32  | 
 |  33 template <> | 
 |  34 struct StructTraits<ui::mojom::CompositionTextDataView, ui::CompositionText> { | 
 |  35   static std::string text(const ui::CompositionText& c) { | 
 |  36     return base::UTF16ToUTF8(c.text); | 
 |  37   } | 
 |  38   static ui::CompositionUnderlines underlines(const ui::CompositionText& c) { | 
 |  39     return c.underlines; | 
 |  40   } | 
 |  41   static gfx::Range selection(const ui::CompositionText& c) { | 
 |  42     return c.selection; | 
 |  43   } | 
 |  44   static bool Read(ui::mojom::CompositionTextDataView data, | 
 |  45                    ui::CompositionText* out); | 
 |  46 }; | 
 |  47  | 
 |  48 }  // namespace mojo | 
 |  49  | 
 |  50 #endif  // SERVICES_UI_PUBLIC_INTERFACES_IME_IME_STRUCT_TRAITS_H_ | 
| OLD | NEW |