Index: content/browser/plugin_process_host.cc |
=================================================================== |
--- content/browser/plugin_process_host.cc (revision 87939) |
+++ content/browser/plugin_process_host.cc (working copy) |
@@ -30,6 +30,7 @@ |
#include "content/browser/renderer_host/resource_message_filter.h" |
#include "content/common/plugin_messages.h" |
#include "content/common/resource_messages.h" |
+#include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
#include "ipc/ipc_switches.h" |
#include "ui/base/ui_base_switches.h" |
#include "ui/gfx/native_widget_types.h" |
@@ -62,6 +63,24 @@ |
plugin_parent_windows_set_.insert(window); |
} |
+void PluginProcessHost::OnReparentPluginWindow(HWND window, HWND parent) { |
+ DWORD process_id = 0; |
+ |
+ // Reparent only to our process. |
+ ::GetWindowThreadProcessId(parent, &process_id); |
+ if (process_id != ::GetCurrentProcessId()) |
+ return; |
+ |
+ // Must reparent before changing style. |
+ ::SetParent(window, parent); |
+ |
+ if (webkit::npapi::WebPluginDelegateImpl::IsDummyActivationWindow(window)) { |
+ ::SetWindowLongPtr(window, GWL_STYLE, WS_CHILD); |
+ } else { |
+ ::SetWindowLongPtr(window, GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | |
+ WS_CLIPSIBLINGS); |
+ } |
+} |
#endif // defined(OS_WIN) |
#if defined(TOOLKIT_USES_GTK) |
@@ -245,6 +264,8 @@ |
#if defined(OS_WIN) |
IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, |
OnPluginWindowDestroyed) |
+ IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ReparentPluginWindow, |
+ OnReparentPluginWindow) |
#endif |
#if defined(TOOLKIT_USES_GTK) |
IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, |