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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 } | 177 } |
178 return true; | 178 return true; |
179 } | 179 } |
180 | 180 |
181 /////////////////////////////////////////////////////////////////////////////// | 181 /////////////////////////////////////////////////////////////////////////////// |
182 // IBusLookupTable | 182 // IBusLookupTable |
183 IBusLookupTable::IBusLookupTable() | 183 IBusLookupTable::IBusLookupTable() |
184 : page_size_(kDefaultPageSize), | 184 : page_size_(kDefaultPageSize), |
185 cursor_position_(0), | 185 cursor_position_(0), |
186 is_cursor_visible_(true), | 186 is_cursor_visible_(true), |
187 orientation_(IBUS_LOOKUP_TABLE_ORIENTATION_HORIZONTAL), | 187 orientation_(HORIZONTAL), |
188 show_window_at_composition_(false) { | 188 show_window_at_composition_(false) { |
189 } | 189 } |
190 | 190 |
191 IBusLookupTable::~IBusLookupTable() { | 191 IBusLookupTable::~IBusLookupTable() { |
192 } | 192 } |
193 | 193 |
| 194 bool IBusLookupTable::IsEqual(const IBusLookupTable& table) const { |
| 195 if (page_size_ != table.page_size_ || |
| 196 cursor_position_ != table.cursor_position_ || |
| 197 is_cursor_visible_ != table.is_cursor_visible_ || |
| 198 orientation_ != table.orientation_ || |
| 199 show_window_at_composition_ != table.show_window_at_composition_ || |
| 200 candidates_.size() != table.candidates_.size()) |
| 201 return false; |
| 202 |
| 203 for (size_t i = 0; i < candidates_.size(); ++i) { |
| 204 const Entry& left = candidates_[i]; |
| 205 const Entry& right = table.candidates_[i]; |
| 206 if (left.value != right.value || |
| 207 left.label != right.label || |
| 208 left.annotation != right.annotation || |
| 209 left.description_title != right.description_title || |
| 210 left.description_body != right.description_body) |
| 211 return false; |
| 212 } |
| 213 return true; |
| 214 } |
| 215 |
| 216 void IBusLookupTable::CopyFrom(const IBusLookupTable& table) { |
| 217 page_size_ = table.page_size_; |
| 218 cursor_position_ = table.cursor_position_; |
| 219 is_cursor_visible_ = table.is_cursor_visible_; |
| 220 orientation_ = table.orientation_; |
| 221 show_window_at_composition_ = table.show_window_at_composition_; |
| 222 candidates_.clear(); |
| 223 candidates_ = table.candidates_; |
| 224 } |
| 225 |
194 IBusLookupTable::Entry::Entry() { | 226 IBusLookupTable::Entry::Entry() { |
195 } | 227 } |
196 | 228 |
197 IBusLookupTable::Entry::~Entry() { | 229 IBusLookupTable::Entry::~Entry() { |
198 } | 230 } |
199 | 231 |
200 } // namespace ibus | 232 } // namespace ibus |
201 } // namespace chromeos | 233 } // namespace chromeos |
OLD | NEW |