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 #include "chrome/browser/infobars/infobar_service.h" |
8 #import "chrome/browser/themes/theme_properties.h" | 9 #import "chrome/browser/themes/theme_properties.h" |
9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
10 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 11 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
11 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 12 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
12 #import "chrome/browser/ui/cocoa/themed_window.h" | 13 #import "chrome/browser/ui/cocoa/themed_window.h" |
13 #include "components/infobars/core/infobar.h" | 14 #include "components/infobars/core/infobar.h" |
14 #include "skia/ext/skia_utils_mac.h" | 15 #include "skia/ext/skia_utils_mac.h" |
15 #import "ui/base/cocoa/nsview_additions.h" | 16 #import "ui/base/cocoa/nsview_additions.h" |
16 #include "ui/base/theme_provider.h" | 17 #include "ui/base/theme_provider.h" |
17 | 18 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 return [NSColor blackColor]; | 52 return [NSColor blackColor]; |
52 | 53 |
53 BOOL active = [[self window] isMainWindow]; | 54 BOOL active = [[self window] isMainWindow]; |
54 return themeProvider->GetNSColor( | 55 return themeProvider->GetNSColor( |
55 active ? ThemeProperties::COLOR_TOOLBAR_STROKE : | 56 active ? ThemeProperties::COLOR_TOOLBAR_STROKE : |
56 ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE); | 57 ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE); |
57 } | 58 } |
58 | 59 |
59 - (void)drawRect:(NSRect)rect { | 60 - (void)drawRect:(NSRect)rect { |
60 NSRect bounds = [self bounds]; | 61 NSRect bounds = [self bounds]; |
61 bounds.size.height = infobars::InfoBar::kDefaultBarTargetHeight; | 62 bounds.size.height = kChromeInfoBarConstants.default_bar_target_height; |
62 | 63 |
63 CGFloat tipXOffset = arrowX_ - arrowHalfWidth_; | 64 CGFloat tipXOffset = arrowX_ - arrowHalfWidth_; |
64 | 65 |
65 // Around the bounds of the infobar, continue drawing the path into which the | 66 // Around the bounds of the infobar, continue drawing the path into which the |
66 // gradient will be drawn. | 67 // gradient will be drawn. |
67 NSBezierPath* infoBarPath = [NSBezierPath bezierPath]; | 68 NSBezierPath* infoBarPath = [NSBezierPath bezierPath]; |
68 [infoBarPath moveToPoint:NSMakePoint(NSMinX(bounds), NSMaxY(bounds))]; | 69 [infoBarPath moveToPoint:NSMakePoint(NSMinX(bounds), NSMaxY(bounds))]; |
69 | 70 |
70 // Draw the tip. | 71 // Draw the tip. |
71 if (hasTip_) { | 72 if (hasTip_) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 137 } |
137 | 138 |
138 - (void)setHasTip:(BOOL)hasTip { | 139 - (void)setHasTip:(BOOL)hasTip { |
139 if (hasTip_ == hasTip) | 140 if (hasTip_ == hasTip) |
140 return; | 141 return; |
141 hasTip_ = hasTip; | 142 hasTip_ = hasTip; |
142 [self setNeedsDisplay:YES]; | 143 [self setNeedsDisplay:YES]; |
143 } | 144 } |
144 | 145 |
145 @end | 146 @end |
OLD | NEW |