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

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: Clean up more 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..793198a1ec2299099cafc0eb49038136c0f7d4e4 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm
@@ -296,19 +296,30 @@ 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];
}
+
+ // Prefer the vertically compact text when it fits. If it doesn't fit, fall
+ // back to the horizontally compact text.
+ NSString* vertically_compact_text =
+ base::SysUTF16ToNSString(suggestionState.vertically_compact_text);
+ [suggestContainer_ setSuggestionText:vertically_compact_text
+ icon:suggestionState.icon.AsNSImage()
+ wrapText:NO];
+ if ([suggestContainer_ preferredSize].width > kDetailsWidth) {
groby-ooo-7-16 2013/12/14 04:39:19 Shouldn't that logic just happen in the suggestCon
Ilya Sherman 2013/12/14 05:02:27 Done.
+ NSString* horizontally_compact_text =
+ base::SysUTF16ToNSString(suggestionState.horizontally_compact_text);
+ [suggestContainer_ setSuggestionText:horizontally_compact_text
+ icon:suggestionState.icon.AsNSImage()
+ wrapText:YES];
+ }
+
[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