1 // Copyright 2013 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.
5 #include "chromeos/ime/candidate_window.h"
8 #include "base/logging.h"
9 #include "base/values.h"
12 namespace input_method {
15 // The default entry number of a page in CandidateWindow.
16 const int kDefaultPageSize = 9;
19 CandidateWindow::CandidateWindow()
20 : property_(new CandidateWindowProperty) {
23 CandidateWindow::~CandidateWindow() {
26 bool CandidateWindow::IsEqual(const CandidateWindow& cw) const {
27 if (page_size() != cw.page_size() ||
28 cursor_position() != cw.cursor_position() ||
29 is_cursor_visible() != cw.is_cursor_visible() ||
30 orientation() != cw.orientation() ||
31 show_window_at_composition() != cw.show_window_at_composition() ||
32 candidates_.size() != cw.candidates_.size())
35 for (size_t i = 0; i < candidates_.size(); ++i) {
36 const Entry& left = candidates_[i];
37 const Entry& right = cw.candidates_[i];
38 if (left.value != right.value ||
39 left.label != right.label ||
40 left.annotation != right.annotation ||
41 left.description_title != right.description_title ||
42 left.description_body != right.description_body)
48 void CandidateWindow::CopyFrom(const CandidateWindow& cw) {
49 SetProperty(cw.GetProperty());
51 candidates_ = cw.candidates_;
55 // When the default values are changed, please modify
56 // InputMethodEngine::CandidateWindowProperty too.
57 CandidateWindow::CandidateWindowProperty::CandidateWindowProperty()
58 : page_size(kDefaultPageSize),
60 is_cursor_visible(true),
62 show_window_at_composition(false) {
65 CandidateWindow::CandidateWindowProperty::~CandidateWindowProperty() {
68 CandidateWindow::Entry::Entry() {
71 CandidateWindow::Entry::~Entry() {
74 } // namespace input_method
75 } // namespace chromeos