From 81d0b5072c9506db96e04802b01801e11b9c8285 Mon Sep 17 00:00:00 2001 From: "ananta@chromium.org" Date: Sat, 13 Jun 2009 05:35:44 +0000 Subject: The context menu in external hosts would not work as expected as the command ids received from the TrackPopupMenuEx call were the indices of the commands. This was because of the MNS_NOTIFYBYPOS menu style on the context menu coming in from chrome. Fix is to turn off this style for external hosts. R=ben Review URL: http://codereview.chromium.org/126091 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18349 0039d316-1c4b-4281-b951-d872f2087c98 --- .../tab_contents/render_view_context_menu_external_win.cc | 15 +++++++++++++++ .../tab_contents/render_view_context_menu_external_win.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/chrome/browser/tab_contents/render_view_context_menu_external_win.cc b/chrome/browser/tab_contents/render_view_context_menu_external_win.cc index a9667c9..83b88031 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_external_win.cc +++ b/chrome/browser/tab_contents/render_view_context_menu_external_win.cc @@ -22,3 +22,18 @@ void RenderViewContextMenuExternalWin::AppendMenuItem(int id) { RenderViewContextMenuWin::AppendMenuItem(id); } } + +void RenderViewContextMenuExternalWin::DoInit() { + RenderViewContextMenuWin::DoInit(); + // The external tab container needs to be notified by command + // and not by index. So we are turning off the MNS_NOTIFYBYPOS + // style. + HMENU menu = GetMenuHandle(); + DCHECK(menu != NULL); + + MENUINFO mi = {0}; + mi.cbSize = sizeof(mi); + mi.fMask = MIM_STYLE | MIM_MENUDATA; + mi.dwMenuData = reinterpret_cast(this); + SetMenuInfo(menu, &mi); +} diff --git a/chrome/browser/tab_contents/render_view_context_menu_external_win.h b/chrome/browser/tab_contents/render_view_context_menu_external_win.h index 0bd6f24..cee9418 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_external_win.h +++ b/chrome/browser/tab_contents/render_view_context_menu_external_win.h @@ -23,6 +23,9 @@ class RenderViewContextMenuExternalWin : public RenderViewContextMenuWin { // RenderViewContextMenuWin overrides -------------------------------------- virtual void AppendMenuItem(int id); + // RenderViewContextMenu override + virtual void DoInit(); + private: // Contains the list of context menu ids to be disabled. std::vector disabled_menu_ids_; -- cgit v1.1