| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h" | 5 #include "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h" |
| 6 | 6 |
| 7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #import "chrome/browser/themes/theme_properties.h" | 8 #import "chrome/browser/themes/theme_properties.h" |
| 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 10 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 10 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 - (id)initWithCoder:(NSCoder*)decoder { | 34 - (id)initWithCoder:(NSCoder*)decoder { |
| 35 if ((self = [super initWithCoder:decoder])) { | 35 if ((self = [super initWithCoder:decoder])) { |
| 36 hasTip_ = YES; | 36 hasTip_ = YES; |
| 37 } | 37 } |
| 38 return self; | 38 return self; |
| 39 } | 39 } |
| 40 | 40 |
| 41 - (void)setInfobarType:(infobars::InfoBarDelegate::Type)infobarType { | 41 - (void)setInfobarType:(infobars::InfoBarDelegate::Type)infobarType { |
| 42 SkColor topColor = infobars::InfoBar::GetTopColor(infobarType); | 42 // TODO(ellyjones): no need to use a gradient here. |
| 43 SkColor bottomColor = infobars::InfoBar::GetBottomColor(infobarType); | 43 SkColor topColor = infobars::InfoBar::GetBackgroundColor(infobarType); |
| 44 SkColor bottomColor = topColor; |
| 44 base::scoped_nsobject<NSGradient> gradient([[NSGradient alloc] | 45 base::scoped_nsobject<NSGradient> gradient([[NSGradient alloc] |
| 45 initWithStartingColor:skia::SkColorToCalibratedNSColor(topColor) | 46 initWithStartingColor:skia::SkColorToCalibratedNSColor(topColor) |
| 46 endingColor:skia::SkColorToCalibratedNSColor(bottomColor)]); | 47 endingColor:skia::SkColorToCalibratedNSColor(bottomColor)]); |
| 47 [self setGradient:gradient]; | 48 [self setGradient:gradient]; |
| 48 } | 49 } |
| 49 | 50 |
| 50 - (NSColor*)strokeColor { | 51 - (NSColor*)strokeColor { |
| 51 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; | 52 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; |
| 52 if (!themeProvider) | 53 if (!themeProvider) |
| 53 return [NSColor blackColor]; | 54 return [NSColor blackColor]; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 138 } |
| 138 | 139 |
| 139 - (void)setHasTip:(BOOL)hasTip { | 140 - (void)setHasTip:(BOOL)hasTip { |
| 140 if (hasTip_ == hasTip) | 141 if (hasTip_ == hasTip) |
| 141 return; | 142 return; |
| 142 hasTip_ = hasTip; | 143 hasTip_ = hasTip; |
| 143 [self setNeedsDisplay:YES]; | 144 [self setNeedsDisplay:YES]; |
| 144 } | 145 } |
| 145 | 146 |
| 146 @end | 147 @end |
| OLD | NEW |