10
10
#include " chrome/browser/ui/autofill/popup_constants.h"
11
11
#include " chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h"
12
12
#include " components/autofill/core/browser/popup_item_ids.h"
13
+ #include " components/autofill/core/browser/suggestion.h"
13
14
#include " ui/base/cocoa/window_size_constants.h"
14
15
#include " ui/base/resource/resource_bundle.h"
15
16
#include " ui/gfx/font_list.h"
16
17
#include " ui/gfx/image/image.h"
17
- #include " ui/gfx/point.h"
18
- #include " ui/gfx/rect.h"
19
18
20
19
using autofill::AutofillPopupView;
21
20
@@ -97,31 +96,31 @@ - (void)drawRect:(NSRect)dirtyRect {
97
96
98
97
[self drawBackgroundAndBorder ];
99
98
100
- for (size_t i = 0 ; i < controller_->names (). size (); ++i) {
99
+ for (size_t i = 0 ; i < controller_->GetLineCount (); ++i) {
101
100
// Skip rows outside of the dirty rect.
102
101
NSRect rowBounds =
103
102
NSRectFromCGRect (controller_->GetRowBounds (i).ToCGRect());
104
103
if (!NSIntersectsRect (rowBounds, dirtyRect))
105
104
continue;
106
105
107
- if (controller_->identifiers ()[i] == autofill::POPUP_ITEM_ID_SEPARATOR) {
106
+ if (controller_->GetSuggestionAt (i). frontend_id == autofill::POPUP_ITEM_ID_SEPARATOR) {
108
107
[self drawSeparatorWithBounds: rowBounds];
109
108
continue ;
110
109
}
111
110
112
111
// Additional offset applied to the text in the vertical direction.
113
112
CGFloat textYOffset = 0 ;
114
113
BOOL imageFirst = NO ;
115
- if (controller_->identifiers ()[i] ==
114
+ if (controller_->GetSuggestionAt (i). frontend_id ==
116
115
autofill::POPUP_ITEM_ID_MAC_ACCESS_CONTACTS) {
117
116
// Due to the weighting of the asset used for this autofill entry, the
118
117
// text needs to be bumped up by 1 pt to make it look vertically aligned.
119
118
textYOffset = -1 ;
120
119
imageFirst = YES ;
121
120
}
122
121
123
- NSString * name = SysUTF16ToNSString (controller_->names ()[i] );
124
- NSString * subtext = SysUTF16ToNSString (controller_->subtexts ()[i] );
122
+ NSString * name = SysUTF16ToNSString (controller_->GetElidedValueAt (i) );
123
+ NSString * subtext = SysUTF16ToNSString (controller_->GetElidedLabelAt (i) );
125
124
BOOL isSelected = static_cast <int >(i) == controller_->selected_line ();
126
125
[self drawSuggestionWithName: name
127
126
subtext: subtext
@@ -203,7 +202,7 @@ - (CGFloat)drawName:(NSString*)name
203
202
controller_->IsWarning (index) ? [self warningColor ] : [self nameColor ];
204
203
NSDictionary * nameAttributes =
205
204
[NSDictionary dictionaryWithObjectsAndKeys:
206
- controller_->GetNameFontListForRow (index).GetPrimaryFont ().
205
+ controller_->GetValueFontListForRow (index).GetPrimaryFont ().
207
206
GetNativeFont (),
208
207
NSFontAttributeName , nameColor, NSForegroundColorAttributeName ,
209
208
nil ];
@@ -247,7 +246,7 @@ - (CGFloat)drawSubtext:(NSString*)subtext
247
246
textYOffset:(CGFloat)textYOffset {
248
247
NSDictionary * subtextAttributes =
249
248
[NSDictionary dictionaryWithObjectsAndKeys:
250
- controller_->subtext_font_list ().GetPrimaryFont ().GetNativeFont (),
249
+ controller_->GetLabelFontList ().GetPrimaryFont ().GetNativeFont (),
251
250
NSFontAttributeName ,
252
251
[self subtextColor ],
253
252
NSForegroundColorAttributeName ,
@@ -263,10 +262,10 @@ - (CGFloat)drawSubtext:(NSString*)subtext
263
262
}
264
263
265
264
- (NSImage *)iconAtIndex:(size_t )index {
266
- if (controller_->icons ()[ index] .empty ())
265
+ if (controller_->GetSuggestionAt ( index). icon .empty ())
267
266
return nil ;
268
267
269
- int iconId = controller_->GetIconResourceID (controller_->icons ()[ index] );
268
+ int iconId = controller_->GetIconResourceID (controller_->GetSuggestionAt ( index). icon );
270
269
DCHECK_NE (-1 , iconId);
271
270
272
271
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance ();
0 commit comments