Index: chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm |
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm b/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm |
index a319fae7c7271d90ce3e2e546c3f9eb807eb4f48..656bba2bd7c75f9b726c32234701799514223a48 100644 |
--- a/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm |
+++ b/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm |
@@ -10,6 +10,7 @@ |
#include "chrome/browser/ui/autofill/popup_constants.h" |
#include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h" |
#include "components/autofill/core/browser/popup_item_ids.h" |
+#include "components/autofill/core/browser/suggestion.h" |
#include "ui/base/cocoa/window_size_constants.h" |
#include "ui/base/resource/resource_bundle.h" |
#include "ui/gfx/font_list.h" |
@@ -97,14 +98,15 @@ using autofill::AutofillPopupView; |
[self drawBackgroundAndBorder]; |
- for (size_t i = 0; i < controller_->names().size(); ++i) { |
+ for (size_t i = 0; i < controller_->GetLineCount(); ++i) { |
// Skip rows outside of the dirty rect. |
NSRect rowBounds = |
NSRectFromCGRect(controller_->GetRowBounds(i).ToCGRect()); |
if (!NSIntersectsRect(rowBounds, dirtyRect)) |
continue; |
+ const autofill::Suggestion& suggestion = controller_->GetSuggestionAt(i); |
- if (controller_->identifiers()[i] == autofill::POPUP_ITEM_ID_SEPARATOR) { |
+ if (suggestion.frontend_id == autofill::POPUP_ITEM_ID_SEPARATOR) { |
[self drawSeparatorWithBounds:rowBounds]; |
continue; |
} |
@@ -112,19 +114,18 @@ using autofill::AutofillPopupView; |
// Additional offset applied to the text in the vertical direction. |
CGFloat textYOffset = 0; |
BOOL imageFirst = NO; |
- if (controller_->identifiers()[i] == |
- autofill::POPUP_ITEM_ID_MAC_ACCESS_CONTACTS) { |
+ if (suggestion.frontend_id == autofill::POPUP_ITEM_ID_MAC_ACCESS_CONTACTS) { |
// Due to the weighting of the asset used for this autofill entry, the |
// text needs to be bumped up by 1 pt to make it look vertically aligned. |
textYOffset = -1; |
imageFirst = YES; |
} |
- NSString* name = SysUTF16ToNSString(controller_->names()[i]); |
- NSString* subtext = SysUTF16ToNSString(controller_->subtexts()[i]); |
+ NSString* value = SysUTF16ToNSString(controller_->GetElidedValueAt(i)); |
+ NSString* label = SysUTF16ToNSString(controller_->GetElidedLabelAt(i)); |
BOOL isSelected = static_cast<int>(i) == controller_->selected_line(); |
- [self drawSuggestionWithName:name |
- subtext:subtext |
+ [self drawSuggestionWithName:value |
+ subtext:label |
index:i |
bounds:rowBounds |
selected:isSelected |
@@ -203,7 +204,7 @@ using autofill::AutofillPopupView; |
controller_->IsWarning(index) ? [self warningColor] : [self nameColor]; |
NSDictionary* nameAttributes = |
[NSDictionary dictionaryWithObjectsAndKeys: |
- controller_->GetNameFontListForRow(index).GetPrimaryFont(). |
+ controller_->GetValueFontListForRow(index).GetPrimaryFont(). |
GetNativeFont(), |
NSFontAttributeName, nameColor, NSForegroundColorAttributeName, |
nil]; |
@@ -247,7 +248,7 @@ using autofill::AutofillPopupView; |
textYOffset:(CGFloat)textYOffset { |
NSDictionary* subtextAttributes = |
[NSDictionary dictionaryWithObjectsAndKeys: |
- controller_->subtext_font_list().GetPrimaryFont().GetNativeFont(), |
+ controller_->GetLabelFontList().GetPrimaryFont().GetNativeFont(), |
NSFontAttributeName, |
[self subtextColor], |
NSForegroundColorAttributeName, |
@@ -263,10 +264,11 @@ using autofill::AutofillPopupView; |
} |
- (NSImage*)iconAtIndex:(size_t)index { |
- if (controller_->icons()[index].empty()) |
+ const base::string16& icon = controller_->GetSuggestionAt(index).icon; |
+ if (icon.empty()) |
return nil; |
- int iconId = controller_->GetIconResourceID(controller_->icons()[index]); |
+ int iconId = controller_->GetIconResourceID(icon); |
DCHECK_NE(-1, iconId); |
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |