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/toolbar/toolbar_button.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.h" |
6 | 6 |
7 @implementation ToolbarButton | 7 @implementation ToolbarButton |
8 | 8 |
9 @synthesize handleMiddleClick = handleMiddleClick_; | 9 @synthesize handleMiddleClick = handleMiddleClick_; |
10 | 10 |
11 - (void)otherMouseDown:(NSEvent*)theEvent { | 11 - (void)otherMouseDown:(NSEvent*)theEvent { |
12 if (![self shouldHandleEvent:theEvent]) { | 12 if (![self shouldHandleEvent:theEvent]) { |
13 [super otherMouseDown:theEvent]; | 13 [super otherMouseDown:theEvent]; |
14 return; | 14 return; |
15 } | 15 } |
(...skipping 26 matching lines...) Expand all Loading... |
42 [self sendAction:[self action] to:[self target]]; | 42 [self sendAction:[self action] to:[self target]]; |
43 } | 43 } |
44 | 44 |
45 - (BOOL)shouldHandleEvent:(NSEvent*)theEvent { | 45 - (BOOL)shouldHandleEvent:(NSEvent*)theEvent { |
46 // |buttonNumber| is the mouse button whose action triggered theEvent. | 46 // |buttonNumber| is the mouse button whose action triggered theEvent. |
47 // 2 corresponds to the middle mouse button. | 47 // 2 corresponds to the middle mouse button. |
48 return handleMiddleClick_ && [theEvent buttonNumber] == 2; | 48 return handleMiddleClick_ && [theEvent buttonNumber] == 2; |
49 } | 49 } |
50 | 50 |
51 @end | 51 @end |
OLD | NEW |