Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Side by Side Diff: chrome/browser/ui/cocoa/infobars/infobar_gradient_view.mm

Issue 7130001: Make infobar background gray (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/scoped_nsobject.h" 7 #include "base/memory/scoped_nsobject.h"
8 #include "chrome/browser/tab_contents/infobar.h"
8 #import "chrome/browser/themes/theme_service.h" 9 #import "chrome/browser/themes/theme_service.h"
9 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" 10 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h"
10 #import "chrome/browser/ui/cocoa/themed_window.h" 11 #import "chrome/browser/ui/cocoa/themed_window.h"
11 12 #include "skia/ext/skia_utils_mac.h"
12 namespace {
13
14 const double kBackgroundColorTop[3] =
15 {255.0 / 255.0, 242.0 / 255.0, 183.0 / 255.0};
16 const double kBackgroundColorBottom[3] =
17 {250.0 / 255.0, 230.0 / 255.0, 145.0 / 255.0};
18 }
19 13
20 @implementation InfoBarGradientView 14 @implementation InfoBarGradientView
21 15
22 - (id)initWithFrame:(NSRect)frameRect { 16 - (void)setInfobarType:(InfoBarDelegate::Type)infobarType {
23 if ((self = [super initWithFrame:frameRect])) { 17 SkColor topColor = GetInfoBarTopColor(infobarType);
24 NSColor* startingColor = 18 SkColor bottomColor = GetInfoBarBottomColor(infobarType);
25 [NSColor colorWithCalibratedRed:kBackgroundColorTop[0] 19 scoped_nsobject<NSGradient> gradient([[NSGradient alloc]
26 green:kBackgroundColorTop[1] 20 initWithStartingColor:gfx::SkColorToCalibratedNSColor(topColor)
27 blue:kBackgroundColorTop[2] 21 endingColor:gfx::SkColorToCalibratedNSColor(bottomColor)]);
28 alpha:1.0]; 22 [self setGradient:gradient];
29 NSColor* endingColor =
30 [NSColor colorWithCalibratedRed:kBackgroundColorBottom[0]
31 green:kBackgroundColorBottom[1]
32 blue:kBackgroundColorBottom[2]
33 alpha:1.0];
34 scoped_nsobject<NSGradient> gradient(
35 [[NSGradient alloc] initWithStartingColor:startingColor
36 endingColor:endingColor]);
37 [self setGradient:gradient];
38 }
39 return self;
40 } 23 }
41 24
42 - (NSColor*)strokeColor { 25 - (NSColor*)strokeColor {
43 ui::ThemeProvider* themeProvider = [[self window] themeProvider]; 26 ui::ThemeProvider* themeProvider = [[self window] themeProvider];
44 if (!themeProvider) 27 if (!themeProvider)
45 return [NSColor blackColor]; 28 return [NSColor blackColor];
46 29
47 BOOL active = [[self window] isMainWindow]; 30 BOOL active = [[self window] isMainWindow];
48 return themeProvider->GetNSColor( 31 return themeProvider->GetNSColor(
49 active ? ThemeService::COLOR_TOOLBAR_STROKE : 32 active ? ThemeService::COLOR_TOOLBAR_STROKE :
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 80 }
98 81
99 - (id)accessibilityAttributeValue:(NSString*)attribute { 82 - (id)accessibilityAttributeValue:(NSString*)attribute {
100 if ([attribute isEqual:NSAccessibilityRoleAttribute]) 83 if ([attribute isEqual:NSAccessibilityRoleAttribute])
101 return NSAccessibilityGroupRole; 84 return NSAccessibilityGroupRole;
102 85
103 return [super accessibilityAttributeValue:attribute]; 86 return [super accessibilityAttributeValue:attribute];
104 } 87 }
105 88
106 @end 89 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h ('k') | chrome/browser/ui/cocoa/translate/translate_infobar_base.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698