diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-13 05:35:44 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-13 05:35:44 +0000 |
commit | 81d0b5072c9506db96e04802b01801e11b9c8285 (patch) | |
tree | 38f7676604734e20cd3ffbe5830045c87b1107b9 | |
parent | ead07da54b6cee91c242abb8a2ff183c82e413fd (diff) | |
download | chromium_src-81d0b5072c9506db96e04802b01801e11b9c8285.zip chromium_src-81d0b5072c9506db96e04802b01801e11b9c8285.tar.gz chromium_src-81d0b5072c9506db96e04802b01801e11b9c8285.tar.bz2 |
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
-rw-r--r-- | chrome/browser/tab_contents/render_view_context_menu_external_win.cc | 15 | ||||
-rw-r--r-- | chrome/browser/tab_contents/render_view_context_menu_external_win.h | 3 |
2 files changed, 18 insertions, 0 deletions
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<ULONG_PTR>(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<int> disabled_menu_ids_; |