OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 "ui/base/ime/candidate_window.h" | |
6 | |
7 #include <string> | |
8 #include "base/logging.h" | |
9 #include "base/values.h" | |
10 | |
11 namespace ui { | |
12 | |
13 namespace { | |
14 // The default entry number of a page in CandidateWindow. | |
15 const int kDefaultPageSize = 9; | |
16 } // namespace | |
17 | |
18 CandidateWindow::CandidateWindow() | |
19 : property_(new CandidateWindowProperty) { | |
20 } | |
21 | |
22 CandidateWindow::~CandidateWindow() { | |
23 } | |
24 | |
25 bool CandidateWindow::IsEqual(const CandidateWindow& cw) const { | |
26 if (page_size() != cw.page_size() || | |
27 cursor_position() != cw.cursor_position() || | |
28 is_cursor_visible() != cw.is_cursor_visible() || | |
29 orientation() != cw.orientation() || | |
30 show_window_at_composition() != cw.show_window_at_composition() || | |
31 is_auxiliary_text_visible() != cw.is_auxiliary_text_visible() || | |
32 auxiliary_text() != cw.auxiliary_text() || | |
33 candidates_.size() != cw.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 = cw.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 CandidateWindow::CopyFrom(const CandidateWindow& cw) { | |
50 SetProperty(cw.GetProperty()); | |
51 candidates_.clear(); | |
52 candidates_ = cw.candidates_; | |
53 } | |
54 | |
55 | |
56 // When the default values are changed, please modify | |
57 // InputMethodEngineInterface::CandidateWindowProperty too. | |
58 CandidateWindow::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 is_auxiliary_text_visible(false) { | |
65 } | |
66 | |
67 CandidateWindow::CandidateWindowProperty::~CandidateWindowProperty() { | |
68 } | |
69 | |
70 CandidateWindow::Entry::Entry() { | |
71 } | |
72 | |
73 CandidateWindow::Entry::~Entry() { | |
74 } | |
75 | |
76 } // namespace ui | |
OLD | NEW |