Index: chrome/browser/ui/cocoa/autofill/autofill_section_container.mm |
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm |
index d61330fc1269c7ad6b5a328b6594c06e22ddf562..e791fb6fc733928c161692fc1697fca4ceaca244 100644 |
--- a/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm |
+++ b/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm |
@@ -296,19 +296,29 @@ bool ShouldOverwriteComboboxes(autofill::DialogSection section, |
- (void)updateSuggestionState { |
const autofill::SuggestionState& suggestionState = |
delegate_->SuggestionStateForSection(section_); |
- // TODO(estade): use |vertically_compact_text| when it fits. |
- const base::string16& text = suggestionState.horizontally_compact_text; |
showSuggestions_ = suggestionState.visible; |
- [suggestContainer_ setSuggestionText:base::SysUTF16ToNSString(text) |
- icon:suggestionState.icon.AsNSImage()]; |
- |
if (!suggestionState.extra_text.empty()) { |
NSString* extraText = |
base::SysUTF16ToNSString(suggestionState.extra_text); |
NSImage* extraIcon = suggestionState.extra_icon.AsNSImage(); |
[suggestContainer_ showInputField:extraText withIcon:extraIcon]; |
} |
+ |
+ // NOTE: It's important to set the input field, if there is one, _before_ |
+ // setting the suggestion text, since the suggestion container needs to |
+ // account for the input field's width when deciding which of the two string |
+ // representations to use. |
+ NSString* verticallyCompactText = |
+ base::SysUTF16ToNSString(suggestionState.vertically_compact_text); |
+ NSString* horizontallyCompactText = |
+ base::SysUTF16ToNSString(suggestionState.horizontally_compact_text); |
+ [suggestContainer_ |
+ setSuggestionWithVerticallyCompactText:verticallyCompactText |
+ horizontallyCompactText:horizontallyCompactText |
+ icon:suggestionState.icon.AsNSImage() |
+ maxWidth:kDetailsWidth]; |
+ |
[view_ setShouldHighlightOnHover:showSuggestions_]; |
if (showSuggestions_) |
[view_ setClickTarget:suggestButton_]; |