OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "chrome/browser/ui/cocoa/tab_contents/overlay_drop_shadow_view.h" | 5 #import "chrome/browser/ui/cocoa/tab_contents/overlay_separator_view.h" |
6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
7 #include "grit/theme_resources.h" | 8 #include "grit/theme_resources.h" |
8 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
9 | 10 |
10 @implementation OverlayDropShadowView | 11 @implementation OverlayTopSeparatorView |
| 12 |
| 13 + (CGFloat)preferredHeight { |
| 14 return 1; |
| 15 } |
| 16 |
| 17 - (void)drawRect:(NSRect)rect { |
| 18 NSRect separatorRect = [self bounds]; |
| 19 separatorRect.size.height = [self cr_lineWidth]; |
| 20 [[self strokeColor] set]; |
| 21 NSRectFillUsingOperation(separatorRect, NSCompositeSourceOver); |
| 22 } |
| 23 |
| 24 @end |
| 25 |
| 26 @implementation OverlayBottomSeparatorView |
11 | 27 |
12 + (CGFloat)preferredHeight { | 28 + (CGFloat)preferredHeight { |
13 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 29 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
14 NSImage* shadowImage = | 30 NSImage* shadowImage = |
15 rb.GetNativeImageNamed(IDR_OVERLAY_DROP_SHADOW).ToNSImage(); | 31 rb.GetNativeImageNamed(IDR_OVERLAY_DROP_SHADOW).ToNSImage(); |
16 return [shadowImage size].height; | 32 return [shadowImage size].height; |
17 } | 33 } |
18 | 34 |
19 - (void)drawRect:(NSRect)rect { | 35 - (void)drawRect:(NSRect)rect { |
20 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 36 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
21 NSRect bounds = [self bounds]; | 37 NSRect bounds = [self bounds]; |
22 | 38 |
23 // Draw the shadow. | 39 // Draw the shadow. |
24 NSImage* shadowImage = | 40 NSImage* shadowImage = |
25 rb.GetNativeImageNamed(IDR_OVERLAY_DROP_SHADOW).ToNSImage(); | 41 rb.GetNativeImageNamed(IDR_OVERLAY_DROP_SHADOW).ToNSImage(); |
26 [shadowImage drawInRect:bounds | 42 [shadowImage drawInRect:bounds |
27 fromRect:NSZeroRect | 43 fromRect:NSZeroRect |
28 operation:NSCompositeSourceOver | 44 operation:NSCompositeSourceOver |
29 fraction:1.0]; | 45 fraction:1.0]; |
30 } | 46 } |
31 | 47 |
32 @end | 48 @end |
OLD | NEW |