OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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/fullscreen_exit_bubble_view.h" |
| 6 |
| 7 #include "base/memory/scoped_nsobject.h" |
| 8 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 9 |
| 10 namespace { |
| 11 |
| 12 const CGFloat kShadowTop = 20; |
| 13 const CGFloat kShadowBottom = 50; |
| 14 const CGFloat kShadowLeft = 50; |
| 15 const CGFloat kShadowRight = 50; |
| 16 const CGFloat kShadowBlurRadius = 290; |
| 17 const CGFloat kShadowAlpha = 0.5; |
| 18 const CGFloat kBubbleCornerRadius = 8.0; |
| 19 |
| 20 } |
| 21 |
| 22 @implementation FullscreenExitBubbleView |
| 23 |
| 24 - (void)drawRect:(NSRect)rect { |
| 25 // Make room for the border to be seen. |
| 26 NSRect bounds = [self bounds]; |
| 27 bounds.size.width -= kShadowLeft + kShadowRight; |
| 28 bounds.size.height -= kShadowTop + kShadowBottom; |
| 29 bounds.origin.x += kShadowLeft; |
| 30 bounds.origin.y += kShadowBottom; |
| 31 NSBezierPath* bezier = [NSBezierPath bezierPath]; |
| 32 |
| 33 CGFloat radius = kBubbleCornerRadius; |
| 34 // Start with a rounded rectangle. |
| 35 [bezier appendBezierPathWithRoundedRect:bounds |
| 36 xRadius:radius |
| 37 yRadius:radius]; |
| 38 |
| 39 [bezier closePath]; |
| 40 [[NSColor whiteColor] set]; |
| 41 gfx::ScopedNSGraphicsContextSaveGState scoped_g_state; |
| 42 scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); |
| 43 [shadow setShadowBlurRadius:kShadowBlurRadius]; |
| 44 [shadow setShadowColor:[[NSColor blackColor] |
| 45 colorWithAlphaComponent:kShadowAlpha]]; |
| 46 [shadow set]; |
| 47 |
| 48 [bezier fill]; |
| 49 } |
| 50 |
| 51 @end |
OLD | NEW |