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 "dbus/message.h" | 9 #include "dbus/message.h" |
10 #include "chromeos/dbus/ibus/ibus_text.h" | 10 #include "chromeos/dbus/ibus/ibus_text.h" |
11 #include "chromeos/dbus/ibus/ibus_object.h" | 11 #include "chromeos/dbus/ibus/ibus_object.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 // TODO(nona): Remove ibus namespace after complete libibus removal. | 14 // TODO(nona): Remove ibus namespace after complete libibus removal. |
15 namespace ibus { | 15 namespace ibus { |
16 | 16 |
| 17 namespace { |
| 18 // The default entry number of a page in IBusLookupTable. |
| 19 const int kDefaultPageSize = 9; |
| 20 } // namespace |
| 21 |
17 void AppendIBusLookupTable(const IBusLookupTable& table, | 22 void AppendIBusLookupTable(const IBusLookupTable& table, |
18 dbus::MessageWriter* writer) { | 23 dbus::MessageWriter* writer) { |
19 IBusObjectWriter ibus_lookup_table_writer("IBusLookupTable", | 24 IBusObjectWriter ibus_lookup_table_writer("IBusLookupTable", |
20 "uubbiavav", | 25 "uubbiavav", |
21 writer); | 26 writer); |
22 ibus_lookup_table_writer.AppendUint32(table.page_size()); | 27 ibus_lookup_table_writer.AppendUint32(table.page_size()); |
23 ibus_lookup_table_writer.AppendUint32(table.cursor_position()); | 28 ibus_lookup_table_writer.AppendUint32(table.cursor_position()); |
24 ibus_lookup_table_writer.AppendBool(table.is_cursor_visible()); | 29 ibus_lookup_table_writer.AppendBool(table.is_cursor_visible()); |
25 ibus_lookup_table_writer.AppendBool(false); // Not used in Chrome. | 30 ibus_lookup_table_writer.AppendBool(false); // Not used in Chrome. |
26 ibus_lookup_table_writer.AppendInt32(static_cast<int32>(table.orientation())); | 31 ibus_lookup_table_writer.AppendInt32(static_cast<int32>(table.orientation())); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 return false; | 195 return false; |
191 } | 196 } |
192 (*candidates)[i].label = label_text; | 197 (*candidates)[i].label = label_text; |
193 } | 198 } |
194 return true; | 199 return true; |
195 } | 200 } |
196 | 201 |
197 /////////////////////////////////////////////////////////////////////////////// | 202 /////////////////////////////////////////////////////////////////////////////// |
198 // IBusLookupTable | 203 // IBusLookupTable |
199 IBusLookupTable::IBusLookupTable() | 204 IBusLookupTable::IBusLookupTable() |
200 : page_size_(0), | 205 : page_size_(kDefaultPageSize), |
201 cursor_position_(0), | 206 cursor_position_(0), |
202 is_cursor_visible_(true), | 207 is_cursor_visible_(true), |
203 orientation_(IBUS_LOOKUP_TABLE_ORIENTATION_HORIZONTAL) { | 208 orientation_(IBUS_LOOKUP_TABLE_ORIENTATION_HORIZONTAL) { |
204 } | 209 } |
205 | 210 |
206 IBusLookupTable::~IBusLookupTable() { | 211 IBusLookupTable::~IBusLookupTable() { |
207 } | 212 } |
208 | 213 |
209 } // namespace ibus | 214 } // namespace ibus |
210 } // namespace chromeos | 215 } // namespace chromeos |
OLD | NEW |