summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/tab_view.mm
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-08 16:47:36 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-08 16:47:36 +0000
commit21fe774256c1c87512a44458efdcf13b5a34abd9 (patch)
treed3e3a634c8072cee20182e89397513e26d86ee2e /chrome/browser/cocoa/tab_view.mm
parent13367f790fdd104e97c91aae5d1cedc331350f73 (diff)
downloadchromium_src-21fe774256c1c87512a44458efdcf13b5a34abd9.zip
chromium_src-21fe774256c1c87512a44458efdcf13b5a34abd9.tar.gz
chromium_src-21fe774256c1c87512a44458efdcf13b5a34abd9.tar.bz2
Add context menus to tabs.
BUG=14920 TEST=context menus on tabs. Review URL: http://codereview.chromium.org/155173 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20155 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/tab_view.mm')
-rw-r--r--chrome/browser/cocoa/tab_view.mm12
1 files changed, 9 insertions, 3 deletions
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm
index ee655f2..5b215fe 100644
--- a/chrome/browser/cocoa/tab_view.mm
+++ b/chrome/browser/cocoa/tab_view.mm
@@ -254,7 +254,7 @@ static const double kDragStartDistance = 3.0;
NSPoint origin = sourceWindowFrame_.origin;
origin.x += (thisPoint.x - dragOrigin_.x);
origin.y += (thisPoint.y - dragOrigin_.y);
-
+
if (tearProgress < 1) {
// If the tear animation is not complete, call back to ourself with the
// same event to animate even if the mouse isn't moving.
@@ -262,7 +262,7 @@ static const double kDragStartDistance = 3.0;
[self performSelector:@selector(mouseDragged:)
withObject:theEvent
afterDelay:1.0f/30.0f];
-
+
origin.x = (1 - tearProgress) * tearOrigin_.x + tearProgress * origin.x;
origin.y = (1 - tearProgress) * tearOrigin_.y + tearProgress * origin.y;
}
@@ -355,11 +355,17 @@ static const double kDragStartDistance = 3.0;
[sourceController_ removePlaceholder];
}
-- (void)otherMouseUp:(NSEvent*) theEvent {
+- (void)otherMouseUp:(NSEvent*)theEvent {
// Support middle-click-to-close.
if ([theEvent buttonNumber] == 2) {
[controller_ closeTab:self];
}
}
+// Called when the user hits the right mouse button (or control-clicks) to
+// show a context menu.
+- (void)rightMouseDown:(NSEvent*)theEvent {
+ [NSMenu popUpContextMenu:[self menu] withEvent:theEvent forView:self];
+}
+
@end