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