Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(565)

Side by Side Diff: chrome/browser/ui/cocoa/new_tab_button.mm

Issue 8566036: Ignore button mouse enter for new tab button (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix another comment to be a sentence Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/nibs/BrowserWindow.xib ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/new_tab_button.h" 5 #import "chrome/browser/ui/cocoa/new_tab_button.h"
6 #import "chrome/browser/ui/cocoa/image_button_cell.h" 6 #import "chrome/browser/ui/cocoa/image_button_cell.h"
7 7
8 // A simple override of the ImageButtonCell to disable handling of
9 // -mouseEntered.
10 @interface NewTabButtonCell : ImageButtonCell
11
12 - (void)mouseEntered:(NSEvent*)theEvent;
13
14 @end
15
16 @implementation NewTabButtonCell
17
18 - (void)mouseEntered:(NSEvent*)theEvent {
19 // Ignore this since the NTB enter is handled by the TabStripController.
20 }
21
22 @end
23
24
8 @implementation NewTabButton 25 @implementation NewTabButton
9 26
10 + (Class)cellClass { 27 + (Class)cellClass {
11 return [ImageButtonCell class]; 28 return [NewTabButtonCell class];
12 } 29 }
13 30
14 // Approximate the shape. It doesn't need to be perfect. This will need to be 31 // Approximate the shape. It doesn't need to be perfect. This will need to be
15 // updated if the size or shape of the icon ever changes. 32 // updated if the size or shape of the icon ever changes.
16 // TODO(pinkerton): use a click mask image instead of hard-coding points. 33 // TODO(pinkerton): use a click mask image instead of hard-coding points.
17 - (NSBezierPath*)pathForButton { 34 - (NSBezierPath*)pathForButton {
18 if (imagePath_.get()) 35 if (imagePath_.get())
19 return imagePath_.get(); 36 return imagePath_.get();
20 37
21 // Cache the path as it doesn't change (the coordinates are local to this 38 // Cache the path as it doesn't change (the coordinates are local to this
(...skipping 16 matching lines...) Expand all
38 55
39 // Override to only accept clicks within the bounds of the defined path, not 56 // Override to only accept clicks within the bounds of the defined path, not
40 // the entire bounding box. |aPoint| is in the superview's coordinate system. 57 // the entire bounding box. |aPoint| is in the superview's coordinate system.
41 - (NSView*)hitTest:(NSPoint)aPoint { 58 - (NSView*)hitTest:(NSPoint)aPoint {
42 if ([self pointIsOverButton:aPoint]) 59 if ([self pointIsOverButton:aPoint])
43 return [super hitTest:aPoint]; 60 return [super hitTest:aPoint];
44 return nil; 61 return nil;
45 } 62 }
46 63
47 @end 64 @end
OLDNEW
« no previous file with comments | « chrome/app/nibs/BrowserWindow.xib ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698