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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 << "4th argument should be boolean."; | 111 << "4th argument should be boolean."; |
112 return false; | 112 return false; |
113 } | 113 } |
114 | 114 |
115 int32 orientation = 0; | 115 int32 orientation = 0; |
116 if (!ibus_object_reader.PopInt32(&orientation)) { | 116 if (!ibus_object_reader.PopInt32(&orientation)) { |
117 LOG(ERROR) << "Invalid variant structure[IBusLookupTable]: " | 117 LOG(ERROR) << "Invalid variant structure[IBusLookupTable]: " |
118 << "5th argument should be int32."; | 118 << "5th argument should be int32."; |
119 return false; | 119 return false; |
120 } | 120 } |
| 121 |
| 122 // Original IBus spec has third orientation IBUS_ORIENTATION_SYSTEM but it |
| 123 // was not supported in Chrome OS. Thus do not cast from integer to enum. |
121 table->set_orientation( | 124 table->set_orientation( |
122 static_cast<IBusLookupTable::Orientation>(orientation)); | 125 orientation == IBusLookupTable::HORIZONTAL ? |
| 126 IBusLookupTable::HORIZONTAL : IBusLookupTable::VERTICAL); |
123 | 127 |
124 dbus::MessageReader text_array_reader(NULL); | 128 dbus::MessageReader text_array_reader(NULL); |
125 if (!ibus_object_reader.PopArray(&text_array_reader)) { | 129 if (!ibus_object_reader.PopArray(&text_array_reader)) { |
126 LOG(ERROR) << "Invalid variant structure[IBusLookupTable]: " | 130 LOG(ERROR) << "Invalid variant structure[IBusLookupTable]: " |
127 << "6th argument should be array."; | 131 << "6th argument should be array."; |
128 return false; | 132 return false; |
129 } | 133 } |
130 | 134 |
131 std::vector<IBusLookupTable::Entry>* candidates = table->mutable_candidates(); | 135 std::vector<IBusLookupTable::Entry>* candidates = table->mutable_candidates(); |
132 while (text_array_reader.HasMoreData()) { | 136 while (text_array_reader.HasMoreData()) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 candidates_ = table.candidates_; | 225 candidates_ = table.candidates_; |
222 } | 226 } |
223 | 227 |
224 IBusLookupTable::Entry::Entry() { | 228 IBusLookupTable::Entry::Entry() { |
225 } | 229 } |
226 | 230 |
227 IBusLookupTable::Entry::~Entry() { | 231 IBusLookupTable::Entry::~Entry() { |
228 } | 232 } |
229 | 233 |
230 } // namespace chromeos | 234 } // namespace chromeos |
OLD | NEW |