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

Unified Diff: ui/views/controls/menu/menu_runner_impl_cocoa.mm

Issue 2072653002: Experiments for using textfieldy context menus Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « ui/views/cocoa/bridged_content_view.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_runner_impl_cocoa.mm
diff --git a/ui/views/controls/menu/menu_runner_impl_cocoa.mm b/ui/views/controls/menu/menu_runner_impl_cocoa.mm
index d2219f34c9e4d6d0e0b0538238c0f11cd09877f7..b2d2dd55ce35a84bfd5c001ee4bda73d7bd43223 100644
--- a/ui/views/controls/menu/menu_runner_impl_cocoa.mm
+++ b/ui/views/controls/menu/menu_runner_impl_cocoa.mm
@@ -10,6 +10,7 @@
#include "ui/events/event_utils.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/mac/coordinate_conversion.h"
+#include "ui/views/cocoa/bridged_content_view.h"
#include "ui/views/controls/menu/menu_runner_impl_adapter.h"
#include "ui/views/widget/widget.h"
@@ -128,9 +129,12 @@ MenuRunner::RunResult MenuRunnerImplCocoa::RunMenuAt(Widget* parent,
running_ = true;
if (run_types & MenuRunner::CONTEXT_MENU) {
- [NSMenu popUpContextMenu:[menu_controller_ menu]
+ id view = parent->GetNativeView();
+ if ([view respondsToSelector:@selector(contextMenuView)])
+ view = [view contextMenuView];
+ [NSMenu popUpContextMenu:[NSTextView defaultMenu] //[menu_controller_ menu]
withEvent:[NSApp currentEvent]
- forView:parent->GetNativeView()];
+ forView:view];
} else if (run_types & MenuRunner::COMBOBOX) {
NSMenuItem* checked_item = FirstCheckedItem(menu_controller_);
base::scoped_nsobject<NSView> anchor_view(
« no previous file with comments | « ui/views/cocoa/bridged_content_view.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698