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

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

Issue 6377001: [Mac] Organize all infobar files into chrome/browser/ui/cocoa/infobars/.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/cocoa/infobar_gradient_view.h"
6
7 #include "base/scoped_nsobject.h"
8 #import "chrome/browser/themes/browser_theme_provider.h"
9 #import "chrome/browser/ui/cocoa/themed_window.h"
10
11 namespace {
12
13 const double kBackgroundColorTop[3] =
14 {255.0 / 255.0, 242.0 / 255.0, 183.0 / 255.0};
15 const double kBackgroundColorBottom[3] =
16 {250.0 / 255.0, 230.0 / 255.0, 145.0 / 255.0};
17 }
18
19 @implementation InfoBarGradientView
20
21 - (id)initWithFrame:(NSRect)frameRect {
22 if ((self = [super initWithFrame:frameRect])) {
23 NSColor* startingColor =
24 [NSColor colorWithCalibratedRed:kBackgroundColorTop[0]
25 green:kBackgroundColorTop[1]
26 blue:kBackgroundColorTop[2]
27 alpha:1.0];
28 NSColor* endingColor =
29 [NSColor colorWithCalibratedRed:kBackgroundColorBottom[0]
30 green:kBackgroundColorBottom[1]
31 blue:kBackgroundColorBottom[2]
32 alpha:1.0];
33 scoped_nsobject<NSGradient> gradient(
34 [[NSGradient alloc] initWithStartingColor:startingColor
35 endingColor:endingColor]);
36 [self setGradient:gradient];
37 }
38 return self;
39 }
40
41 - (NSColor*)strokeColor {
42 ThemeProvider* themeProvider = [[self window] themeProvider];
43 if (!themeProvider)
44 return [NSColor blackColor];
45
46 BOOL active = [[self window] isMainWindow];
47 return themeProvider->GetNSColor(
48 active ? BrowserThemeProvider::COLOR_TOOLBAR_STROKE :
49 BrowserThemeProvider::COLOR_TOOLBAR_STROKE_INACTIVE,
50 true);
51 }
52
53 - (BOOL)mouseDownCanMoveWindow {
54 return NO;
55 }
56
57 // This view is intentionally not opaque because it overlaps with the findbar.
58
59 - (BOOL)accessibilityIsIgnored {
60 return NO;
61 }
62
63 - (id)accessibilityAttributeValue:(NSString*)attribute {
64 if ([attribute isEqual:NSAccessibilityRoleAttribute])
65 return NSAccessibilityGroupRole;
66
67 return [super accessibilityAttributeValue:attribute];
68 }
69
70 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/infobar_gradient_view.h ('k') | chrome/browser/ui/cocoa/infobar_gradient_view_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698