OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "ui/base/ime/candidate_window.h" | 5 #include "ui/base/ime/candidate_window.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 *has_highlighted = false; | 63 *has_highlighted = false; |
64 | 64 |
65 const size_t cursor_index_in_page = cursor_position() % page_size(); | 65 const size_t cursor_index_in_page = cursor_position() % page_size(); |
66 | 66 |
67 for (size_t i = 0; i < candidates().size(); ++i) { | 67 for (size_t i = 0; i < candidates().size(); ++i) { |
68 const CandidateWindow::Entry& candidate_entry = candidates()[i]; | 68 const CandidateWindow::Entry& candidate_entry = candidates()[i]; |
69 if (candidate_entry.description_title.empty() && | 69 if (candidate_entry.description_title.empty() && |
70 candidate_entry.description_body.empty()) | 70 candidate_entry.description_body.empty()) |
71 continue; | 71 continue; |
72 | 72 |
73 InfolistEntry entry(base::UTF8ToUTF16(candidate_entry.description_title), | 73 InfolistEntry entry(candidate_entry.description_title, |
74 base::UTF8ToUTF16(candidate_entry.description_body)); | 74 candidate_entry.description_body); |
75 if (i == cursor_index_in_page) { | 75 if (i == cursor_index_in_page) { |
76 entry.highlighted = true; | 76 entry.highlighted = true; |
77 *has_highlighted = true; | 77 *has_highlighted = true; |
78 } | 78 } |
79 infolist_entries->push_back(entry); | 79 infolist_entries->push_back(entry); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 // When the default values are changed, please modify | 83 // When the default values are changed, please modify |
84 // InputMethodEngineInterface::CandidateWindowProperty too. | 84 // InputMethodEngineInterface::CandidateWindowProperty too. |
85 CandidateWindow::CandidateWindowProperty::CandidateWindowProperty() | 85 CandidateWindow::CandidateWindowProperty::CandidateWindowProperty() |
86 : page_size(kDefaultPageSize), | 86 : page_size(kDefaultPageSize), |
87 cursor_position(0), | 87 cursor_position(0), |
88 is_cursor_visible(true), | 88 is_cursor_visible(true), |
89 is_vertical(false), | 89 is_vertical(false), |
90 show_window_at_composition(false), | 90 show_window_at_composition(false), |
91 is_auxiliary_text_visible(false) { | 91 is_auxiliary_text_visible(false) { |
92 } | 92 } |
93 | 93 |
94 CandidateWindow::CandidateWindowProperty::~CandidateWindowProperty() { | 94 CandidateWindow::CandidateWindowProperty::~CandidateWindowProperty() { |
95 } | 95 } |
96 | 96 |
97 CandidateWindow::Entry::Entry() { | 97 CandidateWindow::Entry::Entry() { |
98 } | 98 } |
99 | 99 |
100 CandidateWindow::Entry::~Entry() { | 100 CandidateWindow::Entry::~Entry() { |
101 } | 101 } |
102 | 102 |
103 } // namespace ui | 103 } // namespace ui |
OLD | NEW |