Chromium Code Reviews| Index: webkit/plugins/npapi/webplugin_delegate_impl_win.cc |
| =================================================================== |
| --- webkit/plugins/npapi/webplugin_delegate_impl_win.cc (revision 87939) |
| +++ webkit/plugins/npapi/webplugin_delegate_impl_win.cc (working copy) |
| @@ -271,9 +271,11 @@ |
| last_message_(0), |
| is_calling_wndproc(false), |
| dummy_window_for_activation_(NULL), |
| + parent_proxy_window_(NULL), |
| handle_event_message_filter_hook_(NULL), |
| handle_event_pump_messages_event_(NULL), |
| user_gesture_message_posted_(false), |
| + is_builtin_flash_(false), |
| #pragma warning(suppress: 4355) // can use this |
| user_gesture_msg_factory_(this), |
| handle_event_depth_(0), |
| @@ -289,7 +291,9 @@ |
| std::wstring filename = |
| StringToLowerASCII(plugin_info.path.BaseName().value()); |
| - if (instance_->mime_type() == "application/x-shockwave-flash" || |
| + is_builtin_flash_ = filename == kBuiltinFlashPlugin; |
| + if (is_builtin_flash_ || |
| + instance_->mime_type() == "application/x-shockwave-flash" || |
| filename == kFlashPlugin) { |
| // Flash only requests windowless plugins if we return a Mozilla user |
| // agent. |
| @@ -354,7 +358,11 @@ |
| WebPluginDelegateImpl::~WebPluginDelegateImpl() { |
| if (::IsWindow(dummy_window_for_activation_)) { |
| - ::DestroyWindow(dummy_window_for_activation_); |
| + // Sandboxed Flash stacks two dummy windows to prevent UIPI failures |
| + if (::IsWindow(parent_proxy_window_)) |
| + ::DestroyWindow(parent_proxy_window_); |
| + else |
| + ::DestroyWindow(dummy_window_for_activation_); |
| } |
| DestroyInstance(); |
| @@ -492,14 +500,16 @@ |
| 0, |
| 0, |
| 0, |
|
ananta
2011/06/07 00:40:08
Please add some comments here which explain what w
cpu_(ooo_6.6-7.5)
2011/06/07 01:03:36
what Ananta said.
On 2011/06/07 00:40:08, ananta
|
| - parent_, |
| + is_builtin_flash_ ? NULL : parent_, |
| 0, |
| GetModuleHandle(NULL), |
| 0); |
| if (windowed_handle_ == 0) |
| return false; |
| - if (IsWindow(parent_)) { |
| + if (is_builtin_flash_) { |
| + plugin_->ReparentPluginWindow(windowed_handle_, parent_); |
| + } else if (IsWindow(parent_)) { |
| // This is a tricky workaround for Issue 2673 in chromium "Flash: IME not |
| // available". To use IMEs in this window, we have to make Windows attach |
| // IMEs to this window (i.e. load IME DLLs, attach them to this process, |
| @@ -705,6 +715,30 @@ |
| bool WebPluginDelegateImpl::CreateDummyWindowForActivation() { |
| DCHECK(!dummy_window_for_activation_); |
| + |
| + // Built-in Flash runs with UIPI, but in windowless mode Flash sometimes |
| + // tries to attach windows to the parent (which fails under UIPI). To make |
| + // it work we add an extra dummy parent in the low-integrity process. |
| + if (is_builtin_flash_) { |
| + parent_proxy_window_ = CreateWindowEx( |
| + 0, |
| + L"Static", |
| + kDummyActivationWindowName, |
| + WS_POPUP, |
| + 0, |
| + 0, |
| + 0, |
| + 0, |
| + 0, |
| + 0, |
| + GetModuleHandle(NULL), |
| + 0); |
| + |
| + if (parent_proxy_window_ == 0) |
| + return false; |
| + plugin_->ReparentPluginWindow(parent_proxy_window_, parent_); |
| + } |
| + |
| dummy_window_for_activation_ = CreateWindowEx( |
| 0, |
| L"Static", |
| @@ -714,7 +748,7 @@ |
| 0, |
| 0, |
| 0, |
| - parent_, |
| + parent_proxy_window_ ? parent_proxy_window_ : parent_, |
| 0, |
| GetModuleHandle(NULL), |
| 0); |