diff options
author | Andras Becsi <andras.becsi@digia.com> | 2014-03-18 13:16:26 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-03-20 15:55:39 +0100 |
commit | 3f0f86b0caed75241fa71c95a5d73bc0164348c5 (patch) | |
tree | 92b9fb00f2e9e90b0be2262093876d4f43b6cd13 /chromium/content/child/npapi/webplugin_delegate_impl_win.cc | |
parent | e90d7c4b152c56919d963987e2503f9909a666d2 (diff) |
Update to new stable branch 1750
This also includes an updated ninja and chromium dependencies
needed on Windows.
Change-Id: Icd597d80ed3fa4425933c9f1334c3c2e31291c42
Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu>
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'chromium/content/child/npapi/webplugin_delegate_impl_win.cc')
-rw-r--r-- | chromium/content/child/npapi/webplugin_delegate_impl_win.cc | 57 |
1 files changed, 52 insertions, 5 deletions
diff --git a/chromium/content/child/npapi/webplugin_delegate_impl_win.cc b/chromium/content/child/npapi/webplugin_delegate_impl_win.cc index f6d054082ae..73bb4422808 100644 --- a/chromium/content/child/npapi/webplugin_delegate_impl_win.cc +++ b/chromium/content/child/npapi/webplugin_delegate_impl_win.cc @@ -35,9 +35,9 @@ #include "ui/gfx/win/hwnd_util.h" #include "webkit/common/cursors/webcursor.h" -using WebKit::WebKeyboardEvent; -using WebKit::WebInputEvent; -using WebKit::WebMouseEvent; +using blink::WebKeyboardEvent; +using blink::WebInputEvent; +using blink::WebMouseEvent; namespace content { @@ -88,6 +88,11 @@ base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_reg_enum_key_ex_w = base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_proc_address = LAZY_INSTANCE_INITIALIZER; +#if defined(USE_AURA) +base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_window_from_point = + LAZY_INSTANCE_INITIALIZER; +#endif + // http://crbug.com/16114 // Enforces providing a valid device context in NPWindow, so that NPP_SetWindow // is never called with NPNWindoTypeDrawable and NPWindow set to NULL. @@ -261,6 +266,9 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( quirks_ |= PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS; quirks_ |= PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE; quirks_ |= PLUGIN_QUIRK_EMULATE_IME; +#if defined(USE_AURA) + quirks_ |= PLUGIN_QUIRK_FAKE_WINDOW_FROM_POINT; +#endif } else if (filename == kAcrobatReaderPlugin) { // Check for the version number above or equal 9. int major_version = GetPluginMajorVersion(plugin_info); @@ -414,6 +422,14 @@ bool WebPluginDelegateImpl::PlatformInitialize() { GetProcAddressPatch); } +#if defined(USE_AURA) + if (windowless_ && !g_iat_patch_window_from_point.Pointer()->is_patched() && + (quirks_ & PLUGIN_QUIRK_FAKE_WINDOW_FROM_POINT)) { + g_iat_patch_window_from_point.Pointer()->Patch( + GetPluginPath().value().c_str(), "user32.dll", "WindowFromPoint", + WebPluginDelegateImpl::WindowFromPointPatch); + } +#endif return true; } @@ -434,6 +450,11 @@ void WebPluginDelegateImpl::PlatformDestroyInstance() { if (g_iat_patch_reg_enum_key_ex_w.Pointer()->is_patched()) g_iat_patch_reg_enum_key_ex_w.Pointer()->Unpatch(); +#if defined(USE_AURA) + if (g_iat_patch_window_from_point.Pointer()->is_patched()) + g_iat_patch_window_from_point.Pointer()->Unpatch(); +#endif + if (mouse_hook_) { UnhookWindowsHookEx(mouse_hook_); mouse_hook_ = NULL; @@ -1001,7 +1022,13 @@ LRESULT CALLBACK WebPluginDelegateImpl::NativeWndProc( result = CallWindowProc( delegate->plugin_wnd_proc_, hwnd, message, wparam, lparam); - delegate->is_calling_wndproc = false; + // The plugin instance may have been destroyed in the CallWindowProc call + // above. This will also destroy the plugin window. Before attempting to + // access the WebPluginDelegateImpl instance we validate if the window is + // still valid. + if (::IsWindow(hwnd)) + delegate->is_calling_wndproc = false; + g_current_plugin_instance = last_plugin_instance; if (message == WM_NCDESTROY) { @@ -1017,7 +1044,8 @@ LRESULT CALLBACK WebPluginDelegateImpl::NativeWndProc( ClearThrottleQueueForWindow(hwnd); } } - delegate->last_message_ = old_message; + if (::IsWindow(hwnd)) + delegate->last_message_ = old_message; return result; } @@ -1311,6 +1339,12 @@ bool WebPluginDelegateImpl::PlatformHandleInputEvent( ResetEvent(handle_event_pump_messages_event_); } + // If we didn't enter a modal loop, need to unhook the filter. + if (handle_event_message_filter_hook_) { + UnhookWindowsHookEx(handle_event_message_filter_hook_); + handle_event_message_filter_hook_ = NULL; + } + if (::IsWindow(last_focus_window)) { // Restore the nestable tasks allowed state in the message loop and reset // the os modal loop state as the plugin returned from the TrackPopupMenu @@ -1460,6 +1494,19 @@ FARPROC WINAPI WebPluginDelegateImpl::GetProcAddressPatch(HMODULE module, return ::GetProcAddress(module, name); } +#if defined(USE_AURA) +HWND WINAPI WebPluginDelegateImpl::WindowFromPointPatch(POINT point) { + HWND window = WindowFromPoint(point); + if (::ScreenToClient(window, &point)) { + HWND child = ChildWindowFromPoint(window, point); + if (::IsWindow(child) && + ::GetProp(child, content::kPluginDummyParentProperty)) + return child; + } + return window; +} +#endif + void WebPluginDelegateImpl::HandleCaptureForMessage(HWND window, UINT message) { if (gfx::GetClassName(window) != base::string16(kNativeWindowClassName)) |