| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chromeos/dbus/ibus/ibus_lookup_table.h" | |
| 6 | |
| 7 #include <string> | |
| 8 #include "base/logging.h" | |
| 9 #include "base/values.h" | |
| 10 | |
| 11 namespace chromeos { | |
| 12 | |
| 13 namespace { | |
| 14 // The default entry number of a page in IBusLookupTable. | |
| 15 const int kDefaultPageSize = 9; | |
| 16 } // namespace | |
| 17 | |
| 18 /////////////////////////////////////////////////////////////////////////////// | |
| 19 // IBusLookupTable | |
| 20 IBusLookupTable::IBusLookupTable() | |
| 21 : property_(new CandidateWindowProperty) { | |
| 22 } | |
| 23 | |
| 24 IBusLookupTable::~IBusLookupTable() { | |
| 25 } | |
| 26 | |
| 27 bool IBusLookupTable::IsEqual(const IBusLookupTable& table) const { | |
| 28 if (page_size() != table.page_size() || | |
| 29 cursor_position() != table.cursor_position() || | |
| 30 is_cursor_visible() != table.is_cursor_visible() || | |
| 31 orientation() != table.orientation() || | |
| 32 show_window_at_composition() != table.show_window_at_composition() || | |
| 33 candidates_.size() != table.candidates_.size()) | |
| 34 return false; | |
| 35 | |
| 36 for (size_t i = 0; i < candidates_.size(); ++i) { | |
| 37 const Entry& left = candidates_[i]; | |
| 38 const Entry& right = table.candidates_[i]; | |
| 39 if (left.value != right.value || | |
| 40 left.label != right.label || | |
| 41 left.annotation != right.annotation || | |
| 42 left.description_title != right.description_title || | |
| 43 left.description_body != right.description_body) | |
| 44 return false; | |
| 45 } | |
| 46 return true; | |
| 47 } | |
| 48 | |
| 49 void IBusLookupTable::CopyFrom(const IBusLookupTable& table) { | |
| 50 SetProperty(table.GetProperty()); | |
| 51 candidates_.clear(); | |
| 52 candidates_ = table.candidates_; | |
| 53 } | |
| 54 | |
| 55 | |
| 56 // When the default values are changed, please modify | |
| 57 // InputMethodEngine::CandidateWindowProperty too. | |
| 58 IBusLookupTable::CandidateWindowProperty::CandidateWindowProperty() | |
| 59 : page_size(kDefaultPageSize), | |
| 60 cursor_position(0), | |
| 61 is_cursor_visible(true), | |
| 62 is_vertical(false), | |
| 63 show_window_at_composition(false) { | |
| 64 } | |
| 65 | |
| 66 IBusLookupTable::CandidateWindowProperty::~CandidateWindowProperty() { | |
| 67 } | |
| 68 | |
| 69 IBusLookupTable::Entry::Entry() { | |
| 70 } | |
| 71 | |
| 72 IBusLookupTable::Entry::~Entry() { | |
| 73 } | |
| 74 | |
| 75 } // namespace chromeos | |
| OLD | NEW |