Commit 7cd1d802 authored by cevans@chromium.org's avatar cevans@chromium.org

Oops, fix my previous fix to the refactor breakage. Make sure we only apply

the current menu command to whoever opened the custom menu. We have to track
it in a slightly ugly manner thanks to GTK's out-of-order messaging for
"menu item selected" vs. "context menu closed".

BUG=NONE
TEST=manual

Review URL: http://codereview.chromium.org/6278013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72251 0039d316-1c4b-4281-b951-d872f2087c98
parent 7d47247a
...@@ -47,6 +47,8 @@ static const char* const kBlockedPluginDataURL = "chrome://blockedplugindata/"; ...@@ -47,6 +47,8 @@ static const char* const kBlockedPluginDataURL = "chrome://blockedplugindata/";
static const unsigned kMenuActionLoad = 1; static const unsigned kMenuActionLoad = 1;
static const unsigned kMenuActionRemove = 2; static const unsigned kMenuActionRemove = 2;
static const BlockedPlugin* gLastActiveMenu;
BlockedPlugin::BlockedPlugin(RenderView* render_view, BlockedPlugin::BlockedPlugin(RenderView* render_view,
WebFrame* frame, WebFrame* frame,
const webkit::npapi::PluginGroup& info, const webkit::npapi::PluginGroup& info,
...@@ -122,6 +124,7 @@ void BlockedPlugin::ShowContextMenu(const WebKit::WebMouseEvent& event) { ...@@ -122,6 +124,7 @@ void BlockedPlugin::ShowContextMenu(const WebKit::WebMouseEvent& event) {
menu_data.customItems.swap(custom_items); menu_data.customItems.swap(custom_items);
menu_data.mousePosition = WebPoint(event.windowX, event.windowY); menu_data.mousePosition = WebPoint(event.windowX, event.windowY);
render_view()->showContextMenu(NULL, menu_data); render_view()->showContextMenu(NULL, menu_data);
gLastActiveMenu = this;
} }
bool BlockedPlugin::OnMessageReceived(const IPC::Message& message) { bool BlockedPlugin::OnMessageReceived(const IPC::Message& message) {
...@@ -129,7 +132,8 @@ bool BlockedPlugin::OnMessageReceived(const IPC::Message& message) { ...@@ -129,7 +132,8 @@ bool BlockedPlugin::OnMessageReceived(const IPC::Message& message) {
// custom menu IDs, and not just our own. We don't swallow // custom menu IDs, and not just our own. We don't swallow
// ViewMsg_LoadBlockedPlugins because multiple blocked plugins have an // ViewMsg_LoadBlockedPlugins because multiple blocked plugins have an
// interest in it. // interest in it.
if (message.type() == ViewMsg_CustomContextMenuAction::ID) { if (message.type() == ViewMsg_CustomContextMenuAction::ID &&
gLastActiveMenu == this) {
ViewMsg_CustomContextMenuAction::Dispatch( ViewMsg_CustomContextMenuAction::Dispatch(
&message, this, this, &BlockedPlugin::OnMenuItemSelected); &message, this, this, &BlockedPlugin::OnMenuItemSelected);
} else if (message.type() == ViewMsg_LoadBlockedPlugins::ID) { } else if (message.type() == ViewMsg_LoadBlockedPlugins::ID) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment