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 |