Index: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc |
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc |
index 71fb41a030bcafecda1a87ebd1929ee325ef9b13..0b37edd28caeba1a7107346085737f36557bc883 100644 |
--- a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc |
+++ b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc |
@@ -6,6 +6,7 @@ |
#include "chrome/browser/ui/autofill/autofill_popup_controller.h" |
#include "components/autofill/core/browser/popup_item_ids.h" |
+#include "components/autofill/core/browser/suggestion.h" |
#include "ui/base/resource/resource_bundle.h" |
#include "ui/events/keycodes/keyboard_codes.h" |
#include "ui/gfx/canvas.h" |
@@ -48,10 +49,11 @@ void AutofillPopupViewViews::OnPaint(gfx::Canvas* canvas) { |
canvas->DrawColor(kPopupBackground); |
OnPaintBorder(canvas); |
- for (size_t i = 0; i < controller_->names().size(); ++i) { |
+ for (size_t i = 0; i < controller_->GetLineCount(); ++i) { |
gfx::Rect line_rect = controller_->GetRowBounds(i); |
- if (controller_->identifiers()[i] == POPUP_ITEM_ID_SEPARATOR) { |
+ if (controller_->GetSuggestionAt(i).frontend_id == |
+ POPUP_ITEM_ID_SEPARATOR) { |
canvas->FillRect(line_rect, kItemTextColor); |
} else { |
DrawAutofillEntry(canvas, i, line_rect); |
@@ -71,14 +73,14 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas, |
const bool is_rtl = controller_->IsRTL(); |
const int value_text_width = |
- gfx::GetStringWidth(controller_->names()[index], |
- controller_->GetNameFontListForRow(index)); |
+ gfx::GetStringWidth(controller_->GetElidedValueAt(index), |
+ controller_->GetValueFontListForRow(index)); |
const int value_content_x = is_rtl ? |
entry_rect.width() - value_text_width - kEndPadding : kEndPadding; |
canvas->DrawStringRectWithFlags( |
- controller_->names()[index], |
- controller_->GetNameFontListForRow(index), |
+ controller_->GetElidedValueAt(index), |
+ controller_->GetValueFontListForRow(index), |
controller_->IsWarning(index) ? kWarningTextColor : kValueTextColor, |
gfx::Rect(value_content_x, |
entry_rect.y(), |
@@ -92,8 +94,9 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas, |
// Draw the Autofill icon, if one exists |
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
int row_height = controller_->GetRowBounds(index).height(); |
- if (!controller_->icons()[index].empty()) { |
- int icon = controller_->GetIconResourceID(controller_->icons()[index]); |
+ if (!controller_->GetSuggestionAt(index).icon.empty()) { |
+ int icon = controller_->GetIconResourceID( |
+ controller_->GetSuggestionAt(index).icon); |
DCHECK_NE(-1, icon); |
const gfx::ImageSkia* image = rb.GetImageSkiaNamed(icon); |
int icon_y = entry_rect.y() + (row_height - image->height()) / 2; |
@@ -105,20 +108,20 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas, |
x_align_left += is_rtl ? image->width() + kIconPadding : -kIconPadding; |
} |
- // Draw the name text. |
- const int subtext_width = |
- gfx::GetStringWidth(controller_->subtexts()[index], |
- controller_->subtext_font_list()); |
+ // Draw the label text. |
+ const int label_width = |
+ gfx::GetStringWidth(controller_->GetElidedLabelAt(index), |
+ controller_->GetLabelFontList()); |
if (!is_rtl) |
- x_align_left -= subtext_width; |
+ x_align_left -= label_width; |
canvas->DrawStringRectWithFlags( |
- controller_->subtexts()[index], |
- controller_->subtext_font_list(), |
+ controller_->GetElidedLabelAt(index), |
+ controller_->GetLabelFontList(), |
kItemTextColor, |
gfx::Rect(x_align_left, |
entry_rect.y(), |
- subtext_width, |
+ label_width, |
entry_rect.height()), |
gfx::Canvas::TEXT_ALIGN_CENTER); |
} |