| Index: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
|
| diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
|
| index a2952039b42c22629a30f2bda87fd7fa038feef4..7ff80b10a00d55880e8f95ed861a88da79901032 100644
|
| --- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
|
| +++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
|
| @@ -283,21 +283,6 @@ const CGFloat kAnimationDuration = 0.2;
|
| [self addToolTipRect:aRect owner:tooltip userData:nil];
|
| }
|
|
|
| -- (void)setGrayTextAutocompletion:(NSString*)suggestText
|
| - textColor:(NSColor*)suggestColor {
|
| - [self setNeedsDisplay:YES];
|
| - suggestText_.reset([suggestText retain]);
|
| - suggestColor_.reset([suggestColor retain]);
|
| -}
|
| -
|
| -- (NSString*)suggestText {
|
| - return suggestText_;
|
| -}
|
| -
|
| -- (NSColor*)suggestColor {
|
| - return suggestColor_;
|
| -}
|
| -
|
| - (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration {
|
| const NSRect frame =
|
| [[self cell] frameForDecoration:decoration inFrame:[self bounds]];
|
| @@ -493,16 +478,6 @@ const CGFloat kAnimationDuration = 0.2;
|
| return doResign;
|
| }
|
|
|
| -- (void)drawRect:(NSRect)rect {
|
| - [super drawRect:rect];
|
| - autocomplete_text_field::DrawGrayTextAutocompletion(
|
| - [self attributedStringValue],
|
| - suggestText_,
|
| - suggestColor_,
|
| - self,
|
| - [[self cell] drawingRectForBounds:[self bounds]]);
|
| -}
|
| -
|
| // (URLDropTarget protocol)
|
| - (id<URLDropTargetController>)urlDropController {
|
| BrowserWindowController* windowController =
|
| @@ -563,42 +538,3 @@ const CGFloat kAnimationDuration = 0.2;
|
| }
|
|
|
| @end
|
| -
|
| -namespace autocomplete_text_field {
|
| -
|
| -void DrawGrayTextAutocompletion(NSAttributedString* mainText,
|
| - NSString* suggestText,
|
| - NSColor* suggestColor,
|
| - NSView* controlView,
|
| - NSRect frame) {
|
| - if (![suggestText length])
|
| - return;
|
| -
|
| - base::scoped_nsobject<NSTextFieldCell> cell(
|
| - [[NSTextFieldCell alloc] initTextCell:@""]);
|
| - [cell setBordered:NO];
|
| - [cell setDrawsBackground:NO];
|
| - [cell setEditable:NO];
|
| -
|
| - base::scoped_nsobject<NSMutableAttributedString> combinedText(
|
| - [[NSMutableAttributedString alloc] initWithAttributedString:mainText]);
|
| - NSRange range = NSMakeRange([combinedText length], 0);
|
| - [combinedText replaceCharactersInRange:range withString:suggestText];
|
| - [combinedText addAttribute:NSForegroundColorAttributeName
|
| - value:suggestColor
|
| - range:NSMakeRange(range.location, [suggestText length])];
|
| - [cell setAttributedStringValue:combinedText];
|
| -
|
| - CGFloat mainTextWidth = [mainText size].width;
|
| - CGFloat suggestWidth = NSWidth(frame) - mainTextWidth;
|
| - NSRect suggestRect = NSMakeRect(NSMinX(frame) + mainTextWidth,
|
| - NSMinY(frame),
|
| - suggestWidth,
|
| - NSHeight(frame));
|
| -
|
| - gfx::ScopedNSGraphicsContextSaveGState saveGState;
|
| - NSRectClip(suggestRect);
|
| - [cell drawInteriorWithFrame:frame inView:controlView];
|
| -}
|
| -
|
| -} // namespace autocomplete_text_field
|
|
|