#include "content/public/browser/web_contents_view.h"
#include "content/public/browser/render_view_host.h"
-@interface NSWindow (NSPrivateApis)
-- (void)setBottomCornerRounded:(BOOL)rounded;
-@end
+static const CGFloat kAtomWindowCornerRadius = 4.0;
@interface NSView (PrivateMethods)
- (CGFloat)roundedCornerRadius;
@end
-static CGFloat const AtomWindowCornerRadius = 4.0;
-
@interface AtomNSWindow : AtomEventProcessingWindow {
@protected
atom::NativeWindowMac* shell_;
NSRectFill(rect);
}
-- (BOOL)canBecomeKeyWindow {
- return YES;
-}
-
-- (BOOL)canBecomeMainWindow {
- return YES;
-}
-
-- (BOOL)hasShadow {
- return YES;
-}
-
-- (void)keyDown:(NSEvent*)event {
- [self redispatchKeyEvent:event];
-}
-
-- (void)keyUp:(NSEvent *)event {
- [self redispatchKeyEvent:event];
-}
-
@end
@interface ControlRegionView : NSView {
} else {
atomWindow = [[AtomFramelessNSWindow alloc]
initWithContentRect:cocoa_bounds
- styleMask:NSTitledWindowMask | NSClosableWindowMask |
- NSMiniaturizableWindowMask | NSResizableWindowMask
+ styleMask:style_mask
backing:NSBackingStoreBuffered
defer:YES];
[atomWindow setOpaque:NO];
[[window() contentView] addSubview:view];
} else {
NSView* frameView = [[window() contentView] superview];
-
[view setFrame:[frameView bounds]];
[frameView addSubview:view];
-
ClipWebView();
[[window() standardWindowButton:NSWindowZoomButton] setHidden:YES];
void NativeWindowMac::ClipWebView() {
NSView* view = GetWebContents()->GetView()->GetNativeView();
- // if ([view respondsToSelector:@selector(roundedCornerRadius)])
- // cornerRadius = [view roundedCornerRadius];
-
view.wantsLayer = YES;
view.layer.masksToBounds = YES;
- view.layer.cornerRadius = AtomWindowCornerRadius;
+ view.layer.cornerRadius = kAtomWindowCornerRadius;
}
void NativeWindowMac::InstallDraggableRegionViews() {