| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/dbus/ibus/ibus_lookup_table.h" | 5 #include "chromeos/dbus/ibus/ibus_lookup_table.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chromeos/dbus/ibus/ibus_object.h" | 10 #include "chromeos/dbus/ibus/ibus_object.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 const std::vector<IBusLookupTable::Entry>& candidates = table.candidates(); | 40 const std::vector<IBusLookupTable::Entry>& candidates = table.candidates(); |
| 41 dbus::MessageWriter text_writer(NULL); | 41 dbus::MessageWriter text_writer(NULL); |
| 42 ibus_lookup_table_writer.OpenArray("v", &text_writer); | 42 ibus_lookup_table_writer.OpenArray("v", &text_writer); |
| 43 bool have_labels = false; | 43 bool have_labels = false; |
| 44 for (size_t i = 0; i < candidates.size(); ++i) { | 44 for (size_t i = 0; i < candidates.size(); ++i) { |
| 45 // Write candidate string as IBusText. | 45 // Write candidate string as IBusText. |
| 46 ibus::IBusText text; | 46 ibus::IBusText text; |
| 47 text.set_text(candidates[i].value); | 47 text.set_text(candidates[i].value); |
| 48 text.set_annotation(candidates[i].annotation); | 48 text.set_annotation(candidates[i].annotation); |
| 49 text.set_description_title(candidates[i].description_title); |
| 50 text.set_description_body(candidates[i].description_body); |
| 49 AppendIBusText(text, &text_writer); | 51 AppendIBusText(text, &text_writer); |
| 50 if (!candidates[i].label.empty()) | 52 if (!candidates[i].label.empty()) |
| 51 have_labels = true; | 53 have_labels = true; |
| 52 } | 54 } |
| 53 ibus_lookup_table_writer.CloseContainer(&text_writer); | 55 ibus_lookup_table_writer.CloseContainer(&text_writer); |
| 54 | 56 |
| 55 dbus::MessageWriter label_writer(NULL); | 57 dbus::MessageWriter label_writer(NULL); |
| 56 ibus_lookup_table_writer.OpenArray("v", &label_writer); | 58 ibus_lookup_table_writer.OpenArray("v", &label_writer); |
| 57 | 59 |
| 58 // If there are not any labels, don't append labels. | 60 // If there are not any labels, don't append labels. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 192 } |
| 191 | 193 |
| 192 IBusLookupTable::Entry::Entry() { | 194 IBusLookupTable::Entry::Entry() { |
| 193 } | 195 } |
| 194 | 196 |
| 195 IBusLookupTable::Entry::~Entry() { | 197 IBusLookupTable::Entry::~Entry() { |
| 196 } | 198 } |
| 197 | 199 |
| 198 } // namespace ibus | 200 } // namespace ibus |
| 199 } // namespace chromeos | 201 } // namespace chromeos |
| OLD | NEW |