summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/browser_frame_view.mm
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 20:13:11 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 20:13:11 +0000
commitf4032c709d33424c8e30e38bbaf8024eb4d293b1 (patch)
tree653953d12468e0372a0e81af5afecdcf1fab1356 /chrome/browser/cocoa/browser_frame_view.mm
parentbd3250f67de106a318d7c77564750e9ce58f17f4 (diff)
downloadchromium_src-f4032c709d33424c8e30e38bbaf8024eb4d293b1.zip
chromium_src-f4032c709d33424c8e30e38bbaf8024eb4d293b1.tar.gz
chromium_src-f4032c709d33424c8e30e38bbaf8024eb4d293b1.tar.bz2
Use more theming methods on gray frame.
BUG=none TEST=no appearance change Review URL: http://codereview.chromium.org/823001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41197 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/browser_frame_view.mm')
-rw-r--r--chrome/browser/cocoa/browser_frame_view.mm16
1 files changed, 12 insertions, 4 deletions
diff --git a/chrome/browser/cocoa/browser_frame_view.mm b/chrome/browser/cocoa/browser_frame_view.mm
index 01d2528..582d91b 100644
--- a/chrome/browser/cocoa/browser_frame_view.mm
+++ b/chrome/browser/cocoa/browser_frame_view.mm
@@ -18,6 +18,7 @@ static const CGFloat kBrowserFrameViewPaintHeight = 60.0;
static const NSPoint kBrowserFrameViewPatternPhaseOffset = { -5, 3 };
static BOOL gCanDrawTitle = NO;
+static BOOL gCanGetCornerRadius = NO;
@interface NSView (Swizzles)
- (void)drawRectOriginal:(NSRect)rect;
@@ -29,6 +30,7 @@ static BOOL gCanDrawTitle = NO;
// BrowserFrameView, but we call them from methods swizzled onto NSGrayFrame.
@interface BrowserFrameView (UndocumentedAPI)
+- (float)roundedCornerRadius;
- (CGRect)_titlebarTitleRect;
- (void)_drawTitleStringIn:(struct CGRect)arg1 withColor:(id)color;
@@ -93,6 +95,9 @@ static BOOL gCanDrawTitle = NO;
instancesRespondToSelector:@selector(_titlebarTitleRect)] &&
[grayFrameClass
instancesRespondToSelector:@selector(_drawTitleStringIn:withColor:)];
+ gCanGetCornerRadius =
+ [grayFrameClass
+ instancesRespondToSelector:@selector(roundedCornerRadius)];
}
- (id)initWithFrame:(NSRect)frame {
@@ -135,9 +140,12 @@ static BOOL gCanDrawTitle = NO;
[self drawRectOriginal:rect];
// Set up our clip.
+ float cornerRadius = 4.0;
+ if (gCanGetCornerRadius)
+ cornerRadius = [self roundedCornerRadius];
[[NSBezierPath bezierPathWithRoundedRect:windowRect
- xRadius:4
- yRadius:4] addClip];
+ xRadius:cornerRadius
+ yRadius:cornerRadius] addClip];
[[NSBezierPath bezierPathWithRect:rect] addClip];
// Do the theming.
@@ -161,8 +169,8 @@ static BOOL gCanDrawTitle = NO;
windowRect.size.width += 1.0;
[[NSColor colorWithCalibratedWhite:1.0 alpha:0.5] set];
NSBezierPath* path = [NSBezierPath bezierPathWithRoundedRect:windowRect
- xRadius:4
- yRadius:4];
+ xRadius:cornerRadius
+ yRadius:cornerRadius];
[path setLineWidth:1.0];
[path stroke];
}