Chromium Code Reviews| 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 #import "chrome/browser/ui/cocoa/nsview_additions.h" | |
| 8 #import "chrome/browser/ui/cocoa/themed_window.h" | |
| 9 #import "chrome/browser/ui/cocoa/url_drop_target.h" | |
| 10 #import "chrome/browser/ui/cocoa/view_id_util.h" | |
| 11 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | |
| 12 | |
| 13 namespace { | |
|
Nico
2011/09/15 04:37:32
not needed
jeremya
2011/09/15 06:33:28
Done.
| |
| 14 CGFloat kCurveSize = 8; | |
| 15 } // end namespace | |
| 16 | |
| 17 @implementation FullscreenExitBubbleView | |
| 18 | |
| 19 - (void)drawRect:(NSRect)rect { | |
| 20 const CGFloat lineWidth = [self cr_lineWidth]; | |
| 21 | |
| 22 rect = NSOffsetRect([self bounds], 0, lineWidth*2); | |
| 23 | |
| 24 NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect)); | |
| 25 NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect)); | |
| 26 NSPoint midLeft = | |
| 27 NSMakePoint(NSMinX(rect), NSMinY(rect) + kCurveSize); | |
| 28 NSPoint midRight = | |
| 29 NSMakePoint(NSMaxX(rect), NSMinY(rect) + kCurveSize); | |
| 30 NSPoint bottomLeft = | |
| 31 NSMakePoint(NSMinX(rect) + kCurveSize, NSMinY(rect)); | |
| 32 NSPoint bottomRight = | |
| 33 NSMakePoint(NSMaxX(rect) - kCurveSize, NSMinY(rect)); | |
| 34 | |
| 35 NSBezierPath* path = [NSBezierPath bezierPath]; | |
| 36 [path moveToPoint:topLeft]; | |
| 37 [path appendBezierPathWithArcWithCenter:NSMakePoint(bottomLeft.x, midLeft.y) | |
| 38 radius:kCurveSize startAngle:180 endAngle:270]; | |
| 39 | |
| 40 [path lineToPoint:bottomRight]; | |
| 41 [path appendBezierPathWithArcWithCenter:NSMakePoint(bottomRight.x, midRight.y) | |
| 42 radius:kCurveSize startAngle:270 endAngle:360]; | |
| 43 [path lineToPoint:topRight]; | |
| 44 | |
| 45 { | |
| 46 gfx::ScopedNSGraphicsContextSaveGState scopedGState; | |
| 47 [path addClip]; | |
| 48 | |
| 49 const NSRect bounds = [self bounds]; | |
| 50 | |
| 51 [[NSColor colorWithDeviceWhite:0 alpha:0.7] set]; | |
| 52 NSRectFillUsingOperation(bounds, NSCompositeSourceOver); | |
| 53 } | |
| 54 | |
| 55 } | |
| 56 | |
| 57 // Eat all mouse events, to prevent clicks from falling through to views below. | |
| 58 - (void)mouseDown:(NSEvent *)theEvent { | |
| 59 } | |
| 60 | |
| 61 - (void)rightMouseDown:(NSEvent *)theEvent { | |
| 62 } | |
| 63 | |
| 64 - (void)otherMouseDown:(NSEvent *)theEvent { | |
| 65 } | |
| 66 | |
| 67 - (void)mouseUp:(NSEvent *)theEvent { | |
| 68 } | |
| 69 | |
| 70 - (void)rightMouseUp:(NSEvent *)theEvent { | |
| 71 } | |
| 72 | |
| 73 - (void)otherMouseUp:(NSEvent *)theEvent { | |
| 74 } | |
| 75 | |
| 76 - (void)mouseMoved:(NSEvent *)theEvent { | |
| 77 } | |
| 78 | |
| 79 - (void)mouseDragged:(NSEvent *)theEvent { | |
| 80 } | |
| 81 | |
| 82 - (void)rightMouseDragged:(NSEvent *)theEvent { | |
| 83 } | |
| 84 | |
| 85 - (void)otherMouseDragged:(NSEvent *)theEvent { | |
| 86 } | |
| 87 | |
| 88 - (ViewID)viewID { | |
| 89 return VIEW_ID_FIND_IN_PAGE; | |
|
Nico
2011/09/15 04:37:32
!!
jeremya
2011/09/15 06:33:28
I can't tell what this was useful for in FindBar.
| |
| 90 } | |
| 91 | |
| 92 // Specifies that mouse events over this view should be ignored by the | |
| 93 // render host. | |
| 94 - (BOOL)nonWebContentView { | |
| 95 return YES; | |
| 96 } | |
| 97 | |
| 98 @end | |
| OLD | NEW |