summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-13 17:58:22 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-13 17:58:22 +0000
commit7ceb5082cf467e409ca816e97860937a77f854bb (patch)
tree948c83593dc6e05a428d88a845bf00f53cb56bbe
parent37e5a9abecbc1ba2dfe3865f4eaa6c5217a9d25f (diff)
downloadchromium_src-7ceb5082cf467e409ca816e97860937a77f854bb.zip
chromium_src-7ceb5082cf467e409ca816e97860937a77f854bb.tar.gz
chromium_src-7ceb5082cf467e409ca816e97860937a77f854bb.tar.bz2
[Mac] Show the contextual menu for page actions on Ctrl+Click.
BUG=32072 TEST=Ctrl+Click on a page action opens the context menu. A real right-click still does the same. Review URL: http://codereview.chromium.org/894004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41533 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/cocoa/autocomplete_text_field.mm12
1 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/autocomplete_text_field.mm b/chrome/browser/cocoa/autocomplete_text_field.mm
index 5d598a6..d20651b9 100644
--- a/chrome/browser/cocoa/autocomplete_text_field.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field.mm
@@ -119,8 +119,16 @@
// let the icon handle the click.
const BOOL ctrlKey = ([theEvent modifierFlags] & NSControlKeyMask) != 0;
for (AutocompleteTextFieldIcon* icon in [cell layedOutIcons:bounds]) {
- if (NSMouseInRect(location, [icon rect], flipped) && !ctrlKey) {
- [icon view]->OnMousePressed([icon rect]);
+ if (NSMouseInRect(location, [icon rect], flipped)) {
+ if (ctrlKey) {
+ // If the click was a Ctrl+Click, then imitate a right click and open
+ // the contextual menu.
+ NSText* editor = [self currentEditor];
+ NSMenu* menu = [editor menuForEvent:theEvent];
+ [NSMenu popUpContextMenu:menu withEvent:theEvent forView:editor];
+ } else {
+ [icon view]->OnMousePressed([icon rect]);
+ }
return;
}
}