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

Unified Diff: chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm

Issue 10823008: [mac] In app windows, calculate the window corner radius programmatically. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
index 479114c31a81bbb470f150af05ffa3fdd2f05708..0333247d248f19f1915c356b473f273e4a4dbdc9 100644
--- a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
@@ -56,16 +56,26 @@
@end
+// This is really a method on NSGrayFrame, so it should only be called on the
+// view passed into -[NSWindow drawCustomFrameRect:forView:].
+@interface NSView (PrivateMethods)
+- (CGFloat)roundedCornerRadius;
+@end
+
@implementation ShellNSWindow
- (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view {
[[NSBezierPath bezierPathWithRect:rect] addClip];
[[NSColor clearColor] set];
NSRectFill(rect);
- const CGFloat kWindowBorderRadius = 3.0;
+
+ // Set up our clip.
+ CGFloat cornerRadius = 4.0;
+ if ([view respondsToSelector:@selector(roundedCornerRadius)])
+ cornerRadius = [view roundedCornerRadius];
[[NSBezierPath bezierPathWithRoundedRect:[view bounds]
- xRadius:kWindowBorderRadius
- yRadius:kWindowBorderRadius] addClip];
+ xRadius:cornerRadius
+ yRadius:cornerRadius] addClip];
[[NSColor whiteColor] set];
NSRectFill(rect);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698