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

Unified Diff: chrome/browser/cocoa/location_bar/autocomplete_text_field.mm

Issue 2868058: [Mac] Re-enable decoration tooltips in omnibox. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Created 10 years, 5 months 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
Index: chrome/browser/cocoa/location_bar/autocomplete_text_field.mm
diff --git a/chrome/browser/cocoa/location_bar/autocomplete_text_field.mm b/chrome/browser/cocoa/location_bar/autocomplete_text_field.mm
index 46b01d8269e550d38f43a98b55a2be916a9227be..071bc637b202d50dba5ec7f5eb85674323b8d7aa 100644
--- a/chrome/browser/cocoa/location_bar/autocomplete_text_field.mm
+++ b/chrome/browser/cocoa/location_bar/autocomplete_text_field.mm
@@ -220,6 +220,11 @@
// stuff? Sigh.
}
+- (void)addToolTip:(NSString*)tooltip forRect:(NSRect)aRect {
+ [currentToolTips_ addObject:tooltip];
+ [self addToolTipRect:aRect owner:tooltip userData:nil];
+}
+
// TODO(shess): -resetFieldEditorFrameIfNeeded is the place where
// changes to the cell layout should be flushed. LocationBarViewMac
// and ToolbarController are calling this routine directly, and I
@@ -234,20 +239,10 @@
// subviews. Unless more tooltips are added to this view, this should suffice
// in place of managing a set of NSToolTipTag objects.
[self removeAllToolTips];
- [currentToolTips_ removeAllObjects];
- AutocompleteTextFieldCell* cell = [self cell];
- for (AutocompleteTextFieldIcon* icon in [cell layedOutIcons:[self bounds]]) {
- NSRect iconRect = [icon rect];
- NSString* tooltip = [icon view]->GetToolTip();
- if (!tooltip)
- continue;
-
- // -[NSView addToolTipRect:owner:userData] does _not_ retain its |owner:|.
- // Put the string in a collection so it can't be dealloced while in use.
- [currentToolTips_ addObject:tooltip];
- [self addToolTipRect:iconRect owner:tooltip userData:nil];
- }
+ // Reload the decoration tooltips.
+ [currentToolTips_ removeAllObjects];
+ [[self cell] updateToolTipsInRect:[self bounds] ofView:self];
}
// NOTE(shess): http://crbug.com/19116 describes a weird bug which

Powered by Google App Engine
This is Rietveld 408576698