| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/ui/cocoa/find_bar/find_bar_view.h" | 5 #import "chrome/browser/ui/cocoa/find_bar/find_bar_view.h" |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 7 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
| 8 #import "chrome/browser/ui/cocoa/themed_window.h" | 8 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 9 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 9 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
| 10 #import "chrome/browser/ui/cocoa/view_id_util.h" | 10 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 11 #include "ui/gfx/scoped_ns_graphics_context_state_mac.h" |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 CGFloat kCurveSize = 8; | 14 CGFloat kCurveSize = 8; |
| 14 } // end namespace | 15 } // end namespace |
| 15 | 16 |
| 16 @implementation FindBarView | 17 @implementation FindBarView |
| 17 | 18 |
| 18 - (void)awakeFromNib { | 19 - (void)awakeFromNib { |
| 19 // Register for all the drag types handled by the RWHVCocoa. | 20 // Register for all the drag types handled by the RWHVCocoa. |
| 20 [self registerForDraggedTypes:[URLDropTargetHandler handledDragTypes]]; | 21 [self registerForDraggedTypes:[URLDropTargetHandler handledDragTypes]]; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 controlPoint2:NSMakePoint(midLeft2.x, bottomLeft.y)]; | 55 controlPoint2:NSMakePoint(midLeft2.x, bottomLeft.y)]; |
| 55 | 56 |
| 56 [path lineToPoint:bottomRight]; | 57 [path lineToPoint:bottomRight]; |
| 57 [path curveToPoint:midRight1 | 58 [path curveToPoint:midRight1 |
| 58 controlPoint1:NSMakePoint(midRight1.x, bottomLeft.y) | 59 controlPoint1:NSMakePoint(midRight1.x, bottomLeft.y) |
| 59 controlPoint2:NSMakePoint(midRight1.x, bottomLeft.y)]; | 60 controlPoint2:NSMakePoint(midRight1.x, bottomLeft.y)]; |
| 60 [path lineToPoint:midRight2]; | 61 [path lineToPoint:midRight2]; |
| 61 [path curveToPoint:topRight | 62 [path curveToPoint:topRight |
| 62 controlPoint1:NSMakePoint(midRight2.x, topLeft.y) | 63 controlPoint1:NSMakePoint(midRight2.x, topLeft.y) |
| 63 controlPoint2:NSMakePoint(midRight2.x, topLeft.y)]; | 64 controlPoint2:NSMakePoint(midRight2.x, topLeft.y)]; |
| 64 NSGraphicsContext* context = [NSGraphicsContext currentContext]; | |
| 65 [context saveGraphicsState]; | |
| 66 [path addClip]; | |
| 67 | 65 |
| 68 // Set the pattern phase | 66 { |
| 69 NSPoint phase = [[self window] themePatternPhase]; | 67 NSGraphicsContext* context = [NSGraphicsContext currentContext]; |
| 68 gfx::ScopedNSGraphicsContextState scopedGState(context); |
| 69 [path addClip]; |
| 70 | 70 |
| 71 [context setPatternPhase:phase]; | 71 // Set the pattern phase |
| 72 [super drawBackground]; | 72 NSPoint phase = [[self window] themePatternPhase]; |
| 73 [context restoreGraphicsState]; | 73 |
| 74 [context setPatternPhase:phase]; |
| 75 [super drawBackground]; |
| 76 } |
| 74 | 77 |
| 75 [[self strokeColor] set]; | 78 [[self strokeColor] set]; |
| 76 [path setLineWidth:lineWidth]; | 79 [path setLineWidth:lineWidth]; |
| 77 [path stroke]; | 80 [path stroke]; |
| 78 } | 81 } |
| 79 | 82 |
| 80 // The findbar is mostly opaque, but has an 8px transparent border on the left | 83 // The findbar is mostly opaque, but has an 8px transparent border on the left |
| 81 // and right sides (see |kCurveSize|). This is an artifact of the way it is | 84 // and right sides (see |kCurveSize|). This is an artifact of the way it is |
| 82 // drawn. We override hitTest to return nil for points in this transparent | 85 // drawn. We override hitTest to return nil for points in this transparent |
| 83 // area. | 86 // area. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 return VIEW_ID_FIND_IN_PAGE; | 136 return VIEW_ID_FIND_IN_PAGE; |
| 134 } | 137 } |
| 135 | 138 |
| 136 // Specifies that mouse events over this view should be ignored by the | 139 // Specifies that mouse events over this view should be ignored by the |
| 137 // render host. | 140 // render host. |
| 138 - (BOOL)nonWebContentView { | 141 - (BOOL)nonWebContentView { |
| 139 return YES; | 142 return YES; |
| 140 } | 143 } |
| 141 | 144 |
| 142 @end | 145 @end |
| OLD | NEW |