summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc43
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.h4
-rw-r--r--content/browser/renderer_host/render_widget_host.cc5
-rw-r--r--content/browser/renderer_host/render_widget_host.h4
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl_win.cc12
5 files changed, 66 insertions, 2 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index 308d441..2a81d33 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -268,6 +268,27 @@ void DrawDeemphasized(const SkColor& color,
paint_rect.y(), NULL);
}
+// The plugin wrapper window which lives in the browser process has this proc
+// as its window procedure. We only handle the WM_PARENTNOTIFY message sent by
+// windowed plugins for mouse input. This is forwarded off to the wrappers
+// parent which is typically the RVH window which turns on user gesture.
+LRESULT CALLBACK PluginWrapperWindowProc(HWND window, unsigned int message,
+ WPARAM wparam, LPARAM lparam) {
+ if (message == WM_PARENTNOTIFY) {
+ switch (LOWORD(wparam)) {
+ case WM_LBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ case WM_MBUTTONDOWN: {
+ ::SendMessage(GetParent(window), message, wparam, lparam);
+ return 0;
+ }
+ default:
+ break;
+ }
+ }
+ return ::DefWindowProc(window, message, wparam, lparam);
+}
+
} // namespace
// RenderWidgetHostView --------------------------------------------------------
@@ -482,7 +503,7 @@ HWND RenderWidgetHostViewWin::ReparentWindow(HWND window) {
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_DBLCLKS;
- wcex.lpfnWndProc = ::DefWindowProc;
+ wcex.lpfnWndProc = PluginWrapperWindowProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = GetModuleHandle(NULL);
@@ -1704,6 +1725,26 @@ LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam,
return static_cast<LRESULT>(0L);
}
+LRESULT RenderWidgetHostViewWin::OnParentNotify(UINT message, WPARAM wparam,
+ LPARAM lparam, BOOL& handled) {
+ handled = FALSE;
+
+ if (!render_widget_host_)
+ return 0;
+
+ switch (LOWORD(wparam)) {
+ case WM_LBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ case WM_MBUTTONDOWN: {
+ render_widget_host_->StartUserGesture();
+ break;
+ }
+ default:
+ break;
+ }
+ return 0;
+}
+
void RenderWidgetHostViewWin::OnFinalMessage(HWND window) {
// When the render widget host is being destroyed, it ends up calling
// WillDestroyRenderWidget (through the RENDER_WIDGET_HOST_DESTROYED
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.h b/chrome/browser/renderer_host/render_widget_host_view_win.h
index 9ceb6ec..6934c14 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.h
@@ -120,6 +120,7 @@ class RenderWidgetHostViewWin
MESSAGE_HANDLER(WM_IME_CHAR, OnKeyEvent)
MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate)
MESSAGE_HANDLER(WM_GETOBJECT, OnGetObject)
+ MESSAGE_HANDLER(WM_PARENTNOTIFY, OnParentNotify)
END_MSG_MAP()
// Implementation of RenderWidgetHostView:
@@ -217,6 +218,9 @@ class RenderWidgetHostViewWin
// Handle horizontal scrolling
LRESULT OnHScroll(int code, short position, HWND scrollbar_control);
+ LRESULT OnParentNotify(UINT message, WPARAM wparam, LPARAM lparam,
+ BOOL& handled);
+
void OnFinalMessage(HWND window);
private:
diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc
index 2d081d5..f6daf41 100644
--- a/content/browser/renderer_host/render_widget_host.cc
+++ b/content/browser/renderer_host/render_widget_host.cc
@@ -1285,3 +1285,8 @@ void RenderWidgetHost::ActivateDeferredPluginHandles() {
deferred_plugin_handles_.clear();
}
+
+void RenderWidgetHost::StartUserGesture() {
+ OnUserGesture();
+}
+
diff --git a/content/browser/renderer_host/render_widget_host.h b/content/browser/renderer_host/render_widget_host.h
index d3598dd..149f5f9 100644
--- a/content/browser/renderer_host/render_widget_host.h
+++ b/content/browser/renderer_host/render_widget_host.h
@@ -395,6 +395,10 @@ class RenderWidgetHost : public IPC::Channel::Listener,
const gfx::Point& last_scroll_offset() const { return last_scroll_offset_; }
+ // Notification that the user has made some kind of input that could
+ // perform an action. See OnUserGesture for more details.
+ void StartUserGesture();
+
protected:
// Internal implementation of the public Forward*Event() methods.
void ForwardInputEvent(const WebKit::WebInputEvent& input_event,
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc
index 149b1e8..1e82cad 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc
+++ b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc
@@ -1404,9 +1404,19 @@ void WebPluginDelegateImpl::HandleCaptureForMessage(HWND window,
switch (message) {
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
- case WM_RBUTTONDOWN:
+ case WM_RBUTTONDOWN: {
::SetCapture(window);
+ // As per documentation the WM_PARENTNOTIFY message is sent to the parent
+ // window chain if mouse input is received by the child window. However
+ // the parent receives the WM_PARENTNOTIFY message only if we doubleclick
+ // on the window. We send the WM_PARENTNOTIFY message for mouse input
+ // messages to the parent to indicate that user action is expected.
+ HWND parent = GetParent(window);
+ if (IsWindow(parent)) {
+ ::SendMessage(parent, WM_PARENTNOTIFY, message, 0);
+ }
break;
+ }
case WM_LBUTTONUP:
case WM_MBUTTONUP: