| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" | 5 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" |
| 6 | 6 |
| 7 #import "base/logging.h" | 7 #import "base/logging.h" |
| 8 #import "third_party/GTM/AppKit/GTMTheme.h" | 8 #import "third_party/GTM/AppKit/GTMTheme.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 - (void)drawKeywordWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { | 238 - (void)drawKeywordWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { |
| 239 DCHECK(keywordString_); | 239 DCHECK(keywordString_); |
| 240 | 240 |
| 241 NSRect textFrame = [self textFrameForFrame:cellFrame]; | 241 NSRect textFrame = [self textFrameForFrame:cellFrame]; |
| 242 const CGFloat x = NSMinX(cellFrame) + kKeywordXOffset; | 242 const CGFloat x = NSMinX(cellFrame) + kKeywordXOffset; |
| 243 NSRect infoFrame(NSMakeRect(x, | 243 NSRect infoFrame(NSMakeRect(x, |
| 244 cellFrame.origin.y + kKeywordYInset, | 244 cellFrame.origin.y + kKeywordYInset, |
| 245 NSMinX(textFrame) - x, | 245 NSMinX(textFrame) - x, |
| 246 cellFrame.size.height - 2 * kKeywordYInset)); | 246 cellFrame.size.height - 2 * kKeywordYInset)); |
| 247 | 247 |
| 248 // Draw a token rectangle with rounded corners. | 248 // Draw the token rectangle with rounded corners. |
| 249 NSRect frame(NSInsetRect(infoFrame, 0.5, 0.5)); | 249 NSRect frame(NSInsetRect(infoFrame, 0.5, 0.5)); |
| 250 NSBezierPath* path = | 250 NSBezierPath* path = |
| 251 [NSBezierPath bezierPathWithRoundedRect:frame xRadius:4.0 yRadius:4.0]; | 251 [NSBezierPath bezierPathWithRoundedRect:frame xRadius:4.0 yRadius:4.0]; |
| 252 | 252 |
| 253 [[NSColor controlColor] set]; | 253 // Matches the color of the highlighted line in the popup. |
| 254 [[NSColor selectedControlColor] set]; |
| 254 [path fill]; | 255 [path fill]; |
| 255 | 256 |
| 256 GTMTheme *theme = [controlView gtm_theme]; | 257 // Border around token rectangle, match focus ring's inner color. |
| 257 NSColor* stroke = [theme strokeColorForStyle:GTMThemeStyleToolBarButton | 258 [[[NSColor keyboardFocusIndicatorColor] colorWithAlphaComponent:0.5] set]; |
| 258 state:YES]; | |
| 259 [stroke setStroke]; | |
| 260 [path setLineWidth:1.0]; | 259 [path setLineWidth:1.0]; |
| 261 [path stroke]; | 260 [path stroke]; |
| 262 | 261 |
| 263 // Draw text w/in the rectangle. | 262 // Draw text w/in the rectangle. |
| 264 infoFrame.origin.x += 4.0; | 263 infoFrame.origin.x += 4.0; |
| 265 infoFrame.origin.y += 1.0; | 264 infoFrame.origin.y += 1.0; |
| 266 [keywordString_.get() drawInRect:infoFrame]; | 265 [keywordString_.get() drawInRect:infoFrame]; |
| 267 } | 266 } |
| 268 | 267 |
| 269 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { | 268 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 start:selStart | 302 start:selStart |
| 304 length:selLength]; | 303 length:selLength]; |
| 305 } | 304 } |
| 306 | 305 |
| 307 - (void)resetCursorRect:(NSRect)cellFrame inView:(NSView *)controlView { | 306 - (void)resetCursorRect:(NSRect)cellFrame inView:(NSView *)controlView { |
| 308 [super resetCursorRect:[self textCursorFrameForFrame:cellFrame] | 307 [super resetCursorRect:[self textCursorFrameForFrame:cellFrame] |
| 309 inView:controlView]; | 308 inView:controlView]; |
| 310 } | 309 } |
| 311 | 310 |
| 312 @end | 311 @end |
| OLD | NEW |