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 23 matching lines...) Expand all Loading... |
34 if ((self = [super initWithCoder:decoder])) { | 34 if ((self = [super initWithCoder:decoder])) { |
35 hasTip_ = YES; | 35 hasTip_ = YES; |
36 } | 36 } |
37 return self; | 37 return self; |
38 } | 38 } |
39 | 39 |
40 - (void)setInfobarType:(infobars::InfoBarDelegate::Type)infobarType { | 40 - (void)setInfobarType:(infobars::InfoBarDelegate::Type)infobarType { |
41 SkColor topColor = infobars::InfoBar::GetTopColor(infobarType); | 41 SkColor topColor = infobars::InfoBar::GetTopColor(infobarType); |
42 SkColor bottomColor = infobars::InfoBar::GetBottomColor(infobarType); | 42 SkColor bottomColor = infobars::InfoBar::GetBottomColor(infobarType); |
43 base::scoped_nsobject<NSGradient> gradient([[NSGradient alloc] | 43 base::scoped_nsobject<NSGradient> gradient([[NSGradient alloc] |
44 initWithStartingColor:gfx::SkColorToCalibratedNSColor(topColor) | 44 initWithStartingColor:skia::SkColorToCalibratedNSColor(topColor) |
45 endingColor:gfx::SkColorToCalibratedNSColor(bottomColor)]); | 45 endingColor:skia::SkColorToCalibratedNSColor(bottomColor)]); |
46 [self setGradient:gradient]; | 46 [self setGradient:gradient]; |
47 } | 47 } |
48 | 48 |
49 - (NSColor*)strokeColor { | 49 - (NSColor*)strokeColor { |
50 ui::ThemeProvider* themeProvider = [[self window] themeProvider]; | 50 ui::ThemeProvider* themeProvider = [[self window] themeProvider]; |
51 if (!themeProvider) | 51 if (!themeProvider) |
52 return [NSColor blackColor]; | 52 return [NSColor blackColor]; |
53 | 53 |
54 BOOL active = [[self window] isMainWindow]; | 54 BOOL active = [[self window] isMainWindow]; |
55 return themeProvider->GetNSColor( | 55 return themeProvider->GetNSColor( |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 - (void)setHasTip:(BOOL)hasTip { | 139 - (void)setHasTip:(BOOL)hasTip { |
140 if (hasTip_ == hasTip) | 140 if (hasTip_ == hasTip) |
141 return; | 141 return; |
142 hasTip_ = hasTip; | 142 hasTip_ = hasTip; |
143 [self setNeedsDisplay:YES]; | 143 [self setNeedsDisplay:YES]; |
144 } | 144 } |
145 | 145 |
146 @end | 146 @end |
OLD | NEW |