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

Unified Diff: chrome/browser/cocoa/tab_view.mm

Issue 333021: Mac: Make middle-click tab closure cancellable. (Closed)
Patch Set: Created 11 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/tab_view.mm
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm
index 626e841088e4d7e3426a0ed7e7b47a5d80ab90f4..fd8c737fe5bd5637bdce5a68b82fb76737567836 100644
--- a/chrome/browser/cocoa/tab_view.mm
+++ b/chrome/browser/cocoa/tab_view.mm
@@ -552,7 +552,14 @@ static const CGFloat kRapidCloseDist = 2.5;
- (void)otherMouseUp:(NSEvent*)theEvent {
// Support middle-click-to-close.
if ([theEvent buttonNumber] == 2) {
- [controller_ closeTab:self];
+ // |-hitTest:| takes a location in the superview's coordinates.
+ NSPoint upLocation =
+ [[self superview] convertPoint:[theEvent locationInWindow]
+ fromView:nil];
+ // If the mouse up occurred in our view or over the close button, then
+ // close.
+ if ([self hitTest:upLocation])
+ [controller_ closeTab:self];
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698