Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3315)

Unified Diff: chrome/browser/ui/cocoa/autofill/autofill_section_container.mm

Issue 115753002: [rAc] [OSX] Use vertically compact text to show suggestions, when it fits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix wording a bit Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_];
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698