summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.cc21
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.h10
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_gtk.cc46
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_gtk.h8
-rw-r--r--content/common/view_messages.h1
-rw-r--r--content/renderer/pepper_plugin_delegate_impl.cc22
-rw-r--r--content/renderer/pepper_plugin_delegate_impl.h1
-rw-r--r--content/renderer/render_view.cc4
-rw-r--r--content/renderer/render_view.h4
-rw-r--r--content/renderer/render_widget_fullscreen_pepper.cc35
-rw-r--r--ppapi/proxy/ppapi_messages.h6
-rw-r--r--webkit/glue/context_menu.cc7
-rw-r--r--webkit/glue/context_menu.h7
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.cc1
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.h1
-rw-r--r--webkit/plugins/ppapi/plugin_delegate.h3
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h4
-rw-r--r--webkit/plugins/ppapi/ppb_flash_menu_impl.cc3
18 files changed, 148 insertions, 36 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index f3682e7..3ea582d 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -276,6 +276,10 @@ class RenderWidgetHostViewGtkWidget {
host_view->GetRenderWidgetHost()->ForwardWheelEvent(web_event);
}
#endif
+
+ if (event->type != GDK_BUTTON_RELEASE)
+ host_view->set_last_mouse_down(event);
+
if (!(event->button == 1 || event->button == 2 || event->button == 3))
return FALSE; // We do not forward any other buttons to the renderer.
if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS)
@@ -509,11 +513,13 @@ RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost* widget_host)
destroy_handler_id_(0),
dragged_at_horizontal_edge_(0),
dragged_at_vertical_edge_(0),
- accelerated_surface_acquired_(false) {
+ accelerated_surface_acquired_(false),
+ last_mouse_down_(NULL) {
host_->set_view(this);
}
RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() {
+ set_last_mouse_down(NULL);
view_.Destroy();
}
@@ -1174,6 +1180,19 @@ void RenderWidgetHostViewGtk::AnimationCanceled(
gtk_widget_queue_draw(view_.get());
}
+void RenderWidgetHostViewGtk::set_last_mouse_down(GdkEventButton* event) {
+ GdkEventButton* temp = NULL;
+ if (event) {
+ temp = reinterpret_cast<GdkEventButton*>(
+ gdk_event_copy(reinterpret_cast<GdkEvent*>(event)));
+ }
+
+ if (last_mouse_down_)
+ gdk_event_free(reinterpret_cast<GdkEvent*>(last_mouse_down_));
+
+ last_mouse_down_ = temp;
+}
+
// static
RenderWidgetHostView*
RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView(
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.h b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
index 92bb127..a0038fd 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
@@ -118,6 +118,10 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView,
// RenderWidgetHost::ForwardEditCommandsForNextKeyEvent().
void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event);
+ GdkEventButton* last_mouse_down() const {
+ return last_mouse_down_;
+ }
+
#if !defined(TOOLKIT_VIEWS)
// Appends the input methods context menu to the specified |menu| object as a
// submenu.
@@ -154,6 +158,8 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView,
// Update the display cursor for the render view.
void ShowCurrentCursor();
+ void set_last_mouse_down(GdkEventButton* event);
+
// The model object.
RenderWidgetHost* host_;
@@ -244,6 +250,10 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView,
bool accelerated_surface_acquired_;
+ // The event for the last mouse down we handled. We need this for context
+ // menus and drags.
+ GdkEventButton* last_mouse_down_;
+
#if defined(OS_CHROMEOS)
// Custimized tooltip window.
scoped_ptr<views::TooltipWindowGtk> tooltip_window_;
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
index e952e4e..9c1ae80 100644
--- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "chrome/browser/ui/gtk/sad_tab_gtk.h"
#include "chrome/browser/ui/gtk/tab_contents_drag_source.h"
+#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/tab_contents/interstitial_page.h"
@@ -155,8 +156,6 @@ RenderWidgetHostView* TabContentsViewGtk::CreateViewForWidget(
G_CALLBACK(OnMouseScroll), tab_contents());
gtk_widget_add_events(content_view, GDK_LEAVE_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK);
- g_signal_connect(content_view, "button-press-event",
- G_CALLBACK(OnMouseDownThunk), this);
InsertIntoContentArea(content_view);
// Renderer target DnD.
@@ -302,8 +301,31 @@ void TabContentsViewGtk::Observe(NotificationType type,
}
void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) {
- context_menu_.reset(new RenderViewContextMenuGtk(tab_contents(), params,
- last_mouse_down_.time));
+ // Find out the RenderWidgetHostView that corresponds to the render widget on
+ // which this context menu is showed, so that we can retrieve the last mouse
+ // down event on the render widget and use it as the timestamp of the
+ // activation event to show the context menu.
+ RenderWidgetHostView* view = NULL;
+ if (params.custom_context.render_widget_id !=
+ webkit_glue::CustomContextMenuContext::kCurrentRenderWidget) {
+ IPC::Channel::Listener* listener =
+ tab_contents()->render_view_host()->process()->GetListenerByID(
+ params.custom_context.render_widget_id);
+ if (!listener) {
+ NOTREACHED();
+ return;
+ }
+ view = static_cast<RenderWidgetHost*>(listener)->view();
+ } else {
+ view = tab_contents()->GetRenderWidgetHostView();
+ }
+ RenderWidgetHostViewGtk* view_gtk =
+ static_cast<RenderWidgetHostViewGtk*>(view);
+ if (!view_gtk || !view_gtk->last_mouse_down())
+ return;
+
+ context_menu_.reset(new RenderViewContextMenuGtk(
+ tab_contents(), params, view_gtk->last_mouse_down()->time));
context_menu_->Init();
gfx::Rect bounds;
@@ -331,8 +353,14 @@ void TabContentsViewGtk::StartDragging(const WebDropData& drop_data,
const SkBitmap& image,
const gfx::Point& image_offset) {
DCHECK(GetContentNativeView());
- drag_source_->StartDragging(drop_data, ops, &last_mouse_down_, image,
- image_offset);
+
+ RenderWidgetHostViewGtk* view_gtk = static_cast<RenderWidgetHostViewGtk*>(
+ tab_contents()->GetRenderWidgetHostView());
+ if (!view_gtk || !view_gtk->last_mouse_down())
+ return;
+
+ drag_source_->StartDragging(drop_data, ops, view_gtk->last_mouse_down(),
+ image, image_offset);
}
// -----------------------------------------------------------------------------
@@ -373,12 +401,6 @@ gboolean TabContentsViewGtk::OnFocus(GtkWidget* widget,
return TRUE;
}
-gboolean TabContentsViewGtk::OnMouseDown(GtkWidget* widget,
- GdkEventButton* event) {
- last_mouse_down_ = *event;
- return FALSE;
-}
-
void TabContentsViewGtk::OnChildSizeRequest(GtkWidget* widget,
GtkWidget* child,
GtkRequisition* requisition) {
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.h b/chrome/browser/tab_contents/tab_contents_view_gtk.h
index fbe9c6d..dff469b 100644
--- a/chrome/browser/tab_contents/tab_contents_view_gtk.h
+++ b/chrome/browser/tab_contents/tab_contents_view_gtk.h
@@ -96,10 +96,6 @@ class TabContentsViewGtk : public TabContentsView,
// Handle focus traversal on the render widget native view.
CHROMEGTK_CALLBACK_1(TabContentsViewGtk, gboolean, OnFocus, GtkDirectionType);
- // We keep track of the timestamp of the latest mousedown event.
- CHROMEGTK_CALLBACK_1(TabContentsViewGtk, gboolean, OnMouseDown,
- GdkEventButton*);
-
// Used to adjust the size of its children when the size of |expanded_| is
// changed.
CHROMEGTK_CALLBACK_2(TabContentsViewGtk, void, OnChildSizeRequest,
@@ -124,10 +120,6 @@ class TabContentsViewGtk : public TabContentsView,
// between uses so that it won't go out of scope before we're done with it.
scoped_ptr<RenderViewContextMenuGtk> context_menu_;
- // The event for the last mouse down we handled. We need this for context
- // menus and drags.
- GdkEventButton last_mouse_down_;
-
// Used to get notifications about renderers coming and going.
NotificationRegistrar registrar_;
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index c870bd6..3abb27d 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -331,6 +331,7 @@ IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(webkit_glue::CustomContextMenuContext)
IPC_STRUCT_TRAITS_MEMBER(is_pepper_menu)
IPC_STRUCT_TRAITS_MEMBER(request_id)
+ IPC_STRUCT_TRAITS_MEMBER(render_widget_id)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebAccessibility)
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc
index de2afc7..b4b5b3f 100644
--- a/content/renderer/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper_plugin_delegate_impl.cc
@@ -31,6 +31,7 @@
#include "content/renderer/gpu_channel_host.h"
#include "content/renderer/pepper_platform_context_3d_impl.h"
#include "content/renderer/render_view.h"
+#include "content/renderer/render_widget_fullscreen_pepper.h"
#include "content/renderer/webgraphicscontext3d_command_buffer_impl.h"
#include "content/renderer/webplugin_delegate_proxy.h"
#include "ipc/ipc_channel_handle.h"
@@ -798,8 +799,18 @@ void PepperPluginDelegateImpl::OnConnectTcpACK(
}
int32_t PepperPluginDelegateImpl::ShowContextMenu(
+ webkit::ppapi::PluginInstance* instance,
webkit::ppapi::PPB_Flash_Menu_Impl* menu,
const gfx::Point& position) {
+ int32 render_widget_id = render_view_->routing_id();
+ if (instance->IsFullscreen()) {
+ webkit::ppapi::FullscreenContainer* container =
+ instance->fullscreen_container();
+ DCHECK(container);
+ render_widget_id =
+ static_cast<RenderWidgetFullscreenPepper*>(container)->routing_id();
+ }
+
int request_id = pending_context_menus_.Add(
new scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>(menu));
@@ -808,8 +819,19 @@ int32_t PepperPluginDelegateImpl::ShowContextMenu(
params.y = position.y();
params.custom_context.is_pepper_menu = true;
params.custom_context.request_id = request_id;
+ params.custom_context.render_widget_id = render_widget_id;
params.custom_items = menu->menu_data();
+ // Transform the position to be in render view's coordinates.
+ if (instance->IsFullscreen()) {
+ WebKit::WebRect rect = render_view_->windowRect();
+ params.x -= rect.x;
+ params.y -= rect.y;
+ } else {
+ params.x += instance->position().x();
+ params.y += instance->position().y();
+ }
+
IPC::Message* msg = new ViewHostMsg_ContextMenu(render_view_->routing_id(),
params);
if (!render_view_->Send(msg)) {
diff --git a/content/renderer/pepper_plugin_delegate_impl.h b/content/renderer/pepper_plugin_delegate_impl.h
index 8749f3d..afb4804 100644
--- a/content/renderer/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper_plugin_delegate_impl.h
@@ -167,6 +167,7 @@ class PepperPluginDelegateImpl
const PP_Flash_NetAddress& local_addr,
const PP_Flash_NetAddress& remote_addr);
virtual int32_t ShowContextMenu(
+ webkit::ppapi::PluginInstance* instance,
webkit::ppapi::PPB_Flash_Menu_Impl* menu,
const gfx::Point& position);
void OnContextMenuClosed(
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
index f75a1fe..6052063 100644
--- a/content/renderer/render_view.cc
+++ b/content/renderer/render_view.cc
@@ -72,7 +72,6 @@
#include "content/renderer/plugin_channel_host.h"
#include "content/renderer/render_view_observer.h"
#include "content/renderer/render_view_visitor.h"
-#include "content/renderer/render_widget_fullscreen.h"
#include "content/renderer/render_widget_fullscreen_pepper.h"
#include "content/renderer/renderer_webapplicationcachehost_impl.h"
#include "content/renderer/renderer_webstoragenamespace_impl.h"
@@ -1929,8 +1928,7 @@ WebExternalPopupMenu* RenderView::createExternalPopupMenu(
return external_popup_menu_.get();
}
-webkit::ppapi::FullscreenContainer*
-RenderView::CreatePepperFullscreenContainer(
+RenderWidgetFullscreenPepper* RenderView::CreatePepperFullscreenContainer(
webkit::ppapi::PluginInstance* plugin) {
GURL active_url;
if (webview() && webview()->mainFrame())
diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h
index b9d5143..347d761 100644
--- a/content/renderer/render_view.h
+++ b/content/renderer/render_view.h
@@ -69,6 +69,7 @@ class PepperDeviceTest;
class PrintWebViewHelper;
class RenderViewObserver;
class RenderViewVisitor;
+class RenderWidgetFullscreenPepper;
class SkBitmap;
class SpeechInputDispatcher;
class SpellCheckProvider;
@@ -105,7 +106,6 @@ class PluginGroup;
} // namespace npapi
namespace ppapi {
-class FullscreenContainer;
class PluginInstance;
class PluginModule;
} // namespace ppapi
@@ -310,7 +310,7 @@ class RenderView : public RenderWidget,
int status);
// Creates a fullscreen container for a pepper plugin instance.
- webkit::ppapi::FullscreenContainer* CreatePepperFullscreenContainer(
+ RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
webkit::ppapi::PluginInstance* plugin);
// Create a new plugin without checking the content settings.
diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc
index 2e405e2..b4624bd 100644
--- a/content/renderer/render_widget_fullscreen_pepper.cc
+++ b/content/renderer/render_widget_fullscreen_pepper.cc
@@ -21,6 +21,7 @@ using WebKit::WebCanvas;
using WebKit::WebCompositionUnderline;
using WebKit::WebCursorInfo;
using WebKit::WebInputEvent;
+using WebKit::WebMouseEvent;
using WebKit::WebPoint;
using WebKit::WebRect;
using WebKit::WebSize;
@@ -84,7 +85,39 @@ class PepperWidget : public WebWidget {
}
virtual bool handleInputEvent(const WebInputEvent& event) {
- return plugin_->HandleInputEvent(event, &cursor_);
+ bool result = plugin_->HandleInputEvent(event, &cursor_);
+
+ // For normal web pages, WebViewImpl does input event translations and
+ // generates context menu events. Since we don't have a WebView, we need to
+ // do the necessary translation ourselves.
+ if (WebInputEvent::isMouseEventType(event.type)) {
+ const WebMouseEvent& mouse_event =
+ reinterpret_cast<const WebMouseEvent&>(event);
+ bool send_context_menu_event = false;
+ // On Mac/Linux, we handle it on mouse down.
+ // On Windows, we handle it on mouse up.
+#if defined(OS_WIN)
+ send_context_menu_event =
+ mouse_event.type == WebInputEvent::MouseUp &&
+ mouse_event.button == WebMouseEvent::ButtonRight;
+#elif defined(OS_MACOSX)
+ send_context_menu_event =
+ mouse_event.type == WebInputEvent::MouseDown &&
+ (mouse_event.button == WebMouseEvent::ButtonRight ||
+ (mouse_event.button == WebMouseEvent::ButtonLeft &&
+ mouse_event.modifiers & WebMouseEvent::ControlKey));
+#else
+ send_context_menu_event =
+ mouse_event.type == WebInputEvent::MouseDown &&
+ mouse_event.button == WebMouseEvent::ButtonRight;
+#endif
+ if (send_context_menu_event) {
+ WebMouseEvent context_menu_event(mouse_event);
+ context_menu_event.type = WebInputEvent::ContextMenu;
+ plugin_->HandleInputEvent(context_menu_event, &cursor_);
+ }
+ }
+ return result;
}
virtual void mouseCaptureLost() {
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index c18ab50..37baf9b 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -461,9 +461,9 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlashMenu_Create,
PP_Instance /* instance */,
pp::proxy::SerializedFlashMenu /* menu_data */,
pp::proxy::HostResource /* result */)
-IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBFlashMenu_Show,
- pp::proxy::HostResource /* menu */,
- PP_Point /* location */)
+IPC_SYNC_MESSAGE_ROUTED2_0(PpapiHostMsg_PPBFlashMenu_Show,
+ pp::proxy::HostResource /* menu */,
+ PP_Point /* location */)
IPC_MESSAGE_ROUTED3(PpapiMsg_PPBFlashMenu_ShowACK,
pp::proxy::HostResource /* menu */,
int32_t /* selected_id */,
diff --git a/webkit/glue/context_menu.cc b/webkit/glue/context_menu.cc
index b4f479c..317130e 100644
--- a/webkit/glue/context_menu.cc
+++ b/webkit/glue/context_menu.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,9 +7,12 @@
namespace webkit_glue {
+const int32 CustomContextMenuContext::kCurrentRenderWidget = kint32max;
+
CustomContextMenuContext::CustomContextMenuContext()
: is_pepper_menu(false),
- request_id(0) {
+ request_id(0),
+ render_widget_id(kCurrentRenderWidget) {
}
} // namespace webkit_glue
diff --git a/webkit/glue/context_menu.h b/webkit/glue/context_menu.h
index 45a91e8..e8441e56 100644
--- a/webkit/glue/context_menu.h
+++ b/webkit/glue/context_menu.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,6 +19,11 @@ namespace webkit_glue {
struct CustomContextMenuContext {
bool is_pepper_menu;
int request_id;
+ // The routing ID of the render widget on which the context menu is shown.
+ // It could also be |kCurrentRenderWidget|, which means the render widget that
+ // the corresponding ViewHostMsg_ContextMenu is sent to.
+ int32 render_widget_id;
+ static const int32 kCurrentRenderWidget;
CustomContextMenuContext();
};
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc
index 5376483..388b6af 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.cc
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc
@@ -181,6 +181,7 @@ int32_t MockPluginDelegate::ConnectTcpAddress(
}
int32_t MockPluginDelegate::ShowContextMenu(
+ PluginInstance* instance,
webkit::ppapi::PPB_Flash_Menu_Impl* menu,
const gfx::Point& position) {
return PP_ERROR_FAILED;
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h
index 754282f7..ce172a0 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.h
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.h
@@ -83,6 +83,7 @@ class MockPluginDelegate : public PluginDelegate {
webkit::ppapi::PPB_Flash_NetConnector_Impl* connector,
const struct PP_Flash_NetAddress* addr);
virtual int32_t ShowContextMenu(
+ PluginInstance* instance,
webkit::ppapi::PPB_Flash_Menu_Impl* menu,
const gfx::Point& position);
virtual FullscreenContainer* CreateFullscreenContainer(
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index 6349cd9..62ad9c1 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -328,9 +328,10 @@ class PluginDelegate {
webkit::ppapi::PPB_Flash_NetConnector_Impl* connector,
const struct PP_Flash_NetAddress* addr) = 0;
- // Show the given context menu at the given position (in the render view's
+ // Show the given context menu at the given position (in the plugin's
// coordinates).
virtual int32_t ShowContextMenu(
+ PluginInstance* instance,
webkit::ppapi::PPB_Flash_Menu_Impl* menu,
const gfx::Point& position) = 0;
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index 35968bb..f60dc88 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -254,6 +254,10 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
// embedded in a page).
bool IsFullPagePlugin() const;
+ FullscreenContainer* fullscreen_container() const {
+ return fullscreen_container_;
+ }
+
private:
bool LoadFindInterface();
bool LoadMessagingInterface();
diff --git a/webkit/plugins/ppapi/ppb_flash_menu_impl.cc b/webkit/plugins/ppapi/ppb_flash_menu_impl.cc
index 52f81b6..d147996 100644
--- a/webkit/plugins/ppapi/ppb_flash_menu_impl.cc
+++ b/webkit/plugins/ppapi/ppb_flash_menu_impl.cc
@@ -176,8 +176,7 @@ int32_t PPB_Flash_Menu_Impl::Show(const PP_Point* location,
}
int32_t rv = instance()->delegate()->ShowContextMenu(
- this, gfx::Point(instance()->position().x() + location->x,
- instance()->position().y() + location->y));
+ instance(), this, gfx::Point(location->x, location->y));
if (rv == PP_ERROR_WOULDBLOCK) {
// Record callback and output buffers.
callback_ = new TrackedCompletionCallback(