summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/autocomplete_text_field_cell.mm
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 20:28:10 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 20:28:10 +0000
commit998cd412ba2635c1d4b14c4eb56d83168a709e1c (patch)
tree586c427c0b4e08ea1535382cd6b67b6bee634ec2 /chrome/browser/cocoa/autocomplete_text_field_cell.mm
parentd51eb48985356adc40a55d678b14f0c0a5870ffb (diff)
downloadchromium_src-998cd412ba2635c1d4b14c4eb56d83168a709e1c.zip
chromium_src-998cd412ba2635c1d4b14c4eb56d83168a709e1c.tar.gz
chromium_src-998cd412ba2635c1d4b14c4eb56d83168a709e1c.tar.bz2
[Mac] Refactor page-action context menus.
Push the code to handle finding menus into the cell, which knows most about page actions. Also more thoroughly work around issues with Control-click context menus. BUG=none TEST=Right-click and Control-click work the same in the Omnibox proper. TEST=Right-click and control-click bring up appropriate menu on page actions. Review URL: http://codereview.chromium.org/1431001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42814 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/autocomplete_text_field_cell.mm')
-rw-r--r--chrome/browser/cocoa/autocomplete_text_field_cell.mm14
1 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/autocomplete_text_field_cell.mm b/chrome/browser/cocoa/autocomplete_text_field_cell.mm
index 751d62c..5bae9867 100644
--- a/chrome/browser/cocoa/autocomplete_text_field_cell.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field_cell.mm
@@ -455,4 +455,18 @@ CGFloat WidthForKeyword(NSAttributedString* keywordString) {
return result;
}
+- (NSMenu*)actionMenuForEvent:(NSEvent*)event
+ inRect:(NSRect)cellFrame
+ ofView:(NSView*)aView {
+ NSPoint location = [aView convertPoint:[event locationInWindow] fromView:nil];
+
+ const BOOL flipped = [aView isFlipped];
+ for (AutocompleteTextFieldIcon* icon in [self layedOutIcons:cellFrame]) {
+ if (NSMouseInRect(location, [icon rect], flipped)) {
+ return [icon view]->GetMenu();
+ }
+ }
+ return nil;
+}
+
@end