| 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_section_view.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_section_view.h" |
| 6 | 6 |
| 7 #import "chrome/browser/ui/chrome_style.h" | 7 #import "chrome/browser/ui/chrome_style.h" |
| 8 #include "skia/ext/skia_utils_mac.h" | 8 #include "skia/ext/skia_utils_mac.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 - (void)drawRect:(NSRect)dirtyRect { | 38 - (void)drawRect:(NSRect)dirtyRect { |
| 39 if (shouldHighlightOnHover_ && isHighlighted_) { | 39 if (shouldHighlightOnHover_ && isHighlighted_) { |
| 40 [[self hoverColor] set]; | 40 [[self hoverColor] set]; |
| 41 NSRectFill([self bounds]); | 41 NSRectFill([self bounds]); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 - (NSColor*)hoverColor { | 45 - (NSColor*)hoverColor { |
| 46 // Shading color is specified as a alpha component color, so premultiply. | 46 // Shading color is specified as a alpha component color, so premultiply. |
| 47 NSColor* shadingColor = gfx::SkColorToCalibratedNSColor(kShadingColor); | 47 NSColor* shadingColor = skia::SkColorToCalibratedNSColor(kShadingColor); |
| 48 NSColor* blendedColor = [[[self window] backgroundColor] | 48 NSColor* blendedColor = [[[self window] backgroundColor] |
| 49 blendedColorWithFraction:[shadingColor alphaComponent] | 49 blendedColorWithFraction:[shadingColor alphaComponent] |
| 50 ofColor:shadingColor]; | 50 ofColor:shadingColor]; |
| 51 return [blendedColor colorWithAlphaComponent:1.0]; | 51 return [blendedColor colorWithAlphaComponent:1.0]; |
| 52 } | 52 } |
| 53 | 53 |
| 54 - (void)setShouldHighlightOnHover:(BOOL)shouldHighlight { | 54 - (void)setShouldHighlightOnHover:(BOOL)shouldHighlight { |
| 55 if (shouldHighlight == shouldHighlightOnHover_) | 55 if (shouldHighlight == shouldHighlightOnHover_) |
| 56 return; | 56 return; |
| 57 shouldHighlightOnHover_ = shouldHighlight; | 57 shouldHighlightOnHover_ = shouldHighlight; |
| 58 [self setNeedsDisplay:YES]; | 58 [self setNeedsDisplay:YES]; |
| 59 } | 59 } |
| 60 | 60 |
| 61 - (void)setIsHighlighted:(BOOL)isHighlighted { | 61 - (void)setIsHighlighted:(BOOL)isHighlighted { |
| 62 isHighlighted_ = isHighlighted; | 62 isHighlighted_ = isHighlighted; |
| 63 if (shouldHighlightOnHover_) | 63 if (shouldHighlightOnHover_) |
| 64 [self setNeedsDisplay:YES]; | 64 [self setNeedsDisplay:YES]; |
| 65 } | 65 } |
| 66 | 66 |
| 67 @end | 67 @end |
| OLD | NEW |