Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/cocoa/autofill/autofill_pop_up_button.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_pop_up_button.h" |
| 6 | 6 |
| 7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
| 8 | 8 |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 10 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 @synthesize defaultValue = defaultValue_; | 84 @synthesize defaultValue = defaultValue_; |
| 85 | 85 |
| 86 // Draw a bezel that's highlighted. | 86 // Draw a bezel that's highlighted. |
| 87 - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView*)controlView { | 87 - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView*)controlView { |
| 88 [super drawBezelWithFrame:frame inView:controlView]; | 88 [super drawBezelWithFrame:frame inView:controlView]; |
| 89 if (invalid_) { | 89 if (invalid_) { |
| 90 // Mimic the rounded rect of default popup bezel in size, outline in red. | 90 // Mimic the rounded rect of default popup bezel in size, outline in red. |
| 91 NSBezierPath* path = [NSBezierPath | 91 NSBezierPath* path = [NSBezierPath |
| 92 bezierPathWithRoundedRect: | 92 bezierPathWithRoundedRect: |
| 93 NSOffsetRect( | 93 NSOffsetRect( |
| 94 NSInsetRect(NSIntegralRect(frame), 3.5, 3.5), -1.0, -1.0) | 94 NSInsetRect(frame, 3.0, 3.5), -.5, -1.0) |
|
Robert Sesek
2014/01/14 22:52:17
nit: join with previous line?
Robert Sesek
2014/01/14 22:52:17
Why remove NSIntegralRect?
groby-ooo-7-16
2014/01/14 23:14:55
Because the two other NSIntegral rects guarantee w
groby-ooo-7-16
2014/01/14 23:14:55
Done. Actually, pulled out the rect computation fo
Robert Sesek
2014/01/14 23:18:37
That's what I thought, just wanted to make sure.
| |
| 95 xRadius:4.0 | 95 xRadius:3.5 |
| 96 yRadius:4.0]; | 96 yRadius:3.5]; |
| 97 [path setLineWidth:0]; | 97 [path setLineWidth:0]; |
| 98 [[NSColor redColor] setStroke]; | 98 [[NSColor redColor] setStroke]; |
| 99 [path stroke]; | 99 [path stroke]; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 - (NSString*)fieldValue { | 103 - (NSString*)fieldValue { |
| 104 if (![self selectedItem]) | 104 if (![self selectedItem]) |
| 105 return defaultValue_; | 105 return defaultValue_; |
| 106 return [self titleOfSelectedItem]; | 106 return [self titleOfSelectedItem]; |
| 107 } | 107 } |
| 108 | 108 |
| 109 - (void)setFieldValue:(NSString*)fieldValue { | 109 - (void)setFieldValue:(NSString*)fieldValue { |
| 110 [self selectItemWithTitle:fieldValue]; | 110 [self selectItemWithTitle:fieldValue]; |
| 111 if (![self selectedItem]) | 111 if (![self selectedItem]) |
| 112 [self selectItemWithTitle:defaultValue_]; | 112 [self selectItemWithTitle:defaultValue_]; |
| 113 if (![self selectedItem]) | 113 if (![self selectedItem]) |
| 114 [self selectItemAtIndex:0]; | 114 [self selectItemAtIndex:0]; |
| 115 } | 115 } |
| 116 | 116 |
| 117 @end | 117 @end |
| OLD | NEW |