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 "ash/ime/candidate_view.h" | 5 #include "ash/ime/candidate_view.h" |
6 | 6 |
7 #include "ash/ime/candidate_window_constants.h" | 7 #include "ash/ime/candidate_window_constants.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "ui/base/ime/candidate_window.h" | 9 #include "ui/base/ime/candidate_window.h" |
10 #include "ui/gfx/color_utils.h" | 10 #include "ui/gfx/color_utils.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 *candidate_width = candidate_label_->GetPreferredSize().width(); | 167 *candidate_width = candidate_label_->GetPreferredSize().width(); |
168 } | 168 } |
169 | 169 |
170 void CandidateView::SetWidths(int shortcut_width, int candidate_width) { | 170 void CandidateView::SetWidths(int shortcut_width, int candidate_width) { |
171 shortcut_width_ = shortcut_width; | 171 shortcut_width_ = shortcut_width; |
172 shortcut_label_->SetVisible(shortcut_width_ != 0); | 172 shortcut_label_->SetVisible(shortcut_width_ != 0); |
173 candidate_width_ = candidate_width; | 173 candidate_width_ = candidate_width; |
174 } | 174 } |
175 | 175 |
176 void CandidateView::SetEntry(const ui::CandidateWindow::Entry& entry) { | 176 void CandidateView::SetEntry(const ui::CandidateWindow::Entry& entry) { |
177 std::string label = entry.label; | 177 base::string16 label = entry.label; |
178 if (!label.empty() && orientation_ != ui::CandidateWindow::VERTICAL) | 178 if (!label.empty() && orientation_ != ui::CandidateWindow::VERTICAL) |
179 label += '.'; | 179 label += base::ASCIIToUTF16("."); |
180 shortcut_label_->SetText(base::UTF8ToUTF16(label)); | 180 shortcut_label_->SetText(label); |
181 candidate_label_->SetText(base::UTF8ToUTF16(entry.value)); | 181 candidate_label_->SetText(entry.value); |
182 annotation_label_->SetText(base::UTF8ToUTF16(entry.annotation)); | 182 annotation_label_->SetText(entry.annotation); |
183 } | 183 } |
184 | 184 |
185 void CandidateView::SetInfolistIcon(bool enable) { | 185 void CandidateView::SetInfolistIcon(bool enable) { |
186 if (infolist_icon_) | 186 if (infolist_icon_) |
187 infolist_icon_->SetVisible(enable); | 187 infolist_icon_->SetVisible(enable); |
188 SchedulePaint(); | 188 SchedulePaint(); |
189 } | 189 } |
190 | 190 |
191 void CandidateView::StateChanged() { | 191 void CandidateView::StateChanged() { |
192 shortcut_label_->SetEnabled(state() != STATE_DISABLED); | 192 shortcut_label_->SetEnabled(state() != STATE_DISABLED); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 277 } |
278 | 278 |
279 // Reserves the margin for infolist_icon even if it's not visible. | 279 // Reserves the margin for infolist_icon even if it's not visible. |
280 size.Enlarge( | 280 size.Enlarge( |
281 kInfolistIndicatorIconWidth + kInfolistIndicatorIconPadding * 2, 0); | 281 kInfolistIndicatorIconWidth + kInfolistIndicatorIconPadding * 2, 0); |
282 return size; | 282 return size; |
283 } | 283 } |
284 | 284 |
285 } // namespace ime | 285 } // namespace ime |
286 } // namespace ash | 286 } // namespace ash |
OLD | NEW |