Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3392)

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_win.cc

Issue 7617019: Add scroll and gesture message filters for UIPI Flash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/chrome_content_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_widget_host_view_win.cc
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_win.cc (revision 96873)
+++ chrome/browser/renderer_host/render_widget_host_view_win.cc (working copy)
@@ -2,6 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Need Win 7 headers for WM_GESTURE and ChangeWindowMessageFilterEx
+// TODO(jschuh): See crbug.com/92941 for longterm fix.
+#undef WINVER
+#define WINVER _WIN32_WINNT_WIN7
+#undef _WIN32_WINNT
+#define _WIN32_WINNT _WIN32_WINNT_WIN7
+#include <windows.h>
+
#include "chrome/browser/renderer_host/render_widget_host_view_win.h"
#include <algorithm>
@@ -209,6 +217,14 @@
return ::DefWindowProc(window, message, wparam, lparam);
}
+// Must be dynamically loaded to avoid startup failures on Win XP.
+typedef BOOL (WINAPI *ChangeWindowMessageFilterExFunction)(
+ HWND hwnd,
+ UINT message,
+ DWORD action,
+ PCHANGEFILTERSTRUCT change_filter_struct);
+ChangeWindowMessageFilterExFunction g_ChangeWindowMessageFilterEx;
+
} // namespace
// RenderWidgetHostView --------------------------------------------------------
@@ -446,12 +462,30 @@
}
DCHECK(window_class);
+ HWND orig_parent = ::GetParent(window);
HWND parent = CreateWindowEx(
WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR,
MAKEINTATOM(window_class), 0,
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
- 0, 0, 0, 0, ::GetParent(window), 0, GetModuleHandle(NULL), 0);
+ 0, 0, 0, 0, orig_parent, 0, GetModuleHandle(NULL), 0);
ui::CheckWindowCreated(parent);
+ // If UIPI is enabled we need to add message filters for parents with
+ // children that cross process boundaries.
+ if (::GetPropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp)) {
+ // Process-wide message filters required on Vista must be added to:
+ // chrome_content_client.cc ChromeContentClient::SandboxPlugin
+ if (!g_ChangeWindowMessageFilterEx) {
+ g_ChangeWindowMessageFilterEx =
+ reinterpret_cast<ChangeWindowMessageFilterExFunction>(
+ ::GetProcAddress(::GetModuleHandle(L"user32.dll"),
+ "ChangeWindowMessageFilterEx"));
+ }
+ // Process-wide message filters required on Vista must be added to:
+ // chrome_content_client.cc ChromeContentClient::SandboxPlugin
+ g_ChangeWindowMessageFilterEx(parent, WM_MOUSEWHEEL, MSGFLT_ALLOW, NULL);
+ g_ChangeWindowMessageFilterEx(parent, WM_GESTURE, MSGFLT_ALLOW, NULL);
+ ::SetPropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp, NULL);
jam 2011/08/26 00:29:12 this needs a matching call to RemoveProp(). per th
+ }
::SetParent(window, parent);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
« no previous file with comments | « no previous file | chrome/common/chrome_content_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698