OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #import "chrome/browser/ui/cocoa/constrained_window/cw_window.h" | |
6 | |
7 #import "base/memory/scoped_nsobject.h" | |
8 #import "chrome/browser/ui/constrained_window.h" | |
9 #include "skia/ext/skia_utils_mac.h" | |
10 | |
11 @interface CustomAlertView : NSView | |
12 @end | |
13 | |
14 @implementation CWWindow | |
15 | |
16 - (id)initWithContentRect:(NSRect)contentRect { | |
17 self = [super initWithContentRect:contentRect | |
18 styleMask:NSBorderlessWindowMask | |
19 backing:NSBackingStoreBuffered | |
20 defer:NO]; | |
21 if (!self) | |
22 return nil; | |
23 | |
24 [self setHasShadow:YES]; | |
25 [self setBackgroundColor:[NSColor clearColor]]; | |
26 [self setOpaque:NO]; | |
27 scoped_nsobject<NSView> content_view( | |
28 [[CustomAlertView alloc] initWithFrame:NSZeroRect]); | |
29 [self setContentView:content_view]; | |
30 return self; | |
31 } | |
32 | |
33 - (BOOL)canBecomeKeyWindow { | |
34 return YES; | |
35 } | |
36 | |
37 @end | |
38 | |
39 @implementation CustomAlertView | |
40 | |
41 - (void)drawRect:(NSRect)rect { | |
42 NSBezierPath* path = [NSBezierPath | |
43 bezierPathWithRoundedRect:[self bounds] | |
44 xRadius:ConstrainedWindow::kBorderRadius | |
45 yRadius:ConstrainedWindow::kBorderRadius]; | |
46 [gfx::SkColorToCalibratedNSColor(ConstrainedWindow::kBackgroundColor) set]; | |
47 [path fill]; | |
48 } | |
49 | |
50 @end | |
OLD | NEW |