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

Side by Side Diff: webkit/glue/plugins/webplugin_delegate_impl_win.cc

Issue 2332004: Fix a regression which caused flash plugin installation to not work via the C... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/glue/plugins/webplugin_delegate_impl.h" 5 #include "webkit/glue/plugins/webplugin_delegate_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 handle_event_message_filter_hook_(NULL), 257 handle_event_message_filter_hook_(NULL),
258 handle_event_pump_messages_event_(NULL), 258 handle_event_pump_messages_event_(NULL),
259 user_gesture_message_posted_(false), 259 user_gesture_message_posted_(false),
260 #pragma warning(suppress: 4355) // can use this 260 #pragma warning(suppress: 4355) // can use this
261 user_gesture_msg_factory_(this), 261 user_gesture_msg_factory_(this),
262 handle_event_depth_(0), 262 handle_event_depth_(0),
263 mouse_hook_(NULL) { 263 mouse_hook_(NULL) {
264 memset(&window_, 0, sizeof(window_)); 264 memset(&window_, 0, sizeof(window_));
265 265
266 const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info(); 266 const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info();
267 std::wstring filename = StringToLowerASCII(plugin_info.path.BaseName().value() ); 267 std::wstring filename =
268 StringToLowerASCII(plugin_info.path.BaseName().value());
268 269
269 if (instance_->mime_type() == "application/x-shockwave-flash" || 270 if (instance_->mime_type() == "application/x-shockwave-flash" ||
270 filename == kFlashPlugin) { 271 filename == kFlashPlugin) {
271 // Flash only requests windowless plugins if we return a Mozilla user 272 // Flash only requests windowless plugins if we return a Mozilla user
272 // agent. 273 // agent.
273 instance_->set_use_mozilla_user_agent(); 274 instance_->set_use_mozilla_user_agent();
274 quirks_ |= PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE; 275 quirks_ |= PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE;
275 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; 276 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR;
276 quirks_ |= PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS; 277 quirks_ |= PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS;
277 quirks_ |= PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE; 278 quirks_ |= PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // plugins and remember the cursor being set. This is shipped over to the 365 // plugins and remember the cursor being set. This is shipped over to the
365 // browser in the HandleEvent call, which ensures that the cursor does not 366 // browser in the HandleEvent call, which ensures that the cursor does not
366 // change when a windowless plugin instance changes the cursor 367 // change when a windowless plugin instance changes the cursor
367 // in a background tab. 368 // in a background tab.
368 if (windowless_ && !g_iat_patch_set_cursor.Pointer()->is_patched() && 369 if (windowless_ && !g_iat_patch_set_cursor.Pointer()->is_patched() &&
369 (quirks_ & PLUGIN_QUIRK_PATCH_SETCURSOR)) { 370 (quirks_ & PLUGIN_QUIRK_PATCH_SETCURSOR)) {
370 g_iat_patch_set_cursor.Pointer()->Patch( 371 g_iat_patch_set_cursor.Pointer()->Patch(
371 GetPluginPath().value().c_str(), "user32.dll", "SetCursor", 372 GetPluginPath().value().c_str(), "user32.dll", "SetCursor",
372 WebPluginDelegateImpl::SetCursorPatch); 373 WebPluginDelegateImpl::SetCursorPatch);
373 } 374 }
375
376 // The windowed flash plugin has a bug which occurs when the plugin enters
377 // fullscreen mode. It basically captures the mouse on WM_LBUTTONDOWN and
378 // does not release capture correctly causing it to stop receiving
379 // subsequent mouse events. This problem is also seen in Safari where there
380 // is code to handle this in the wndproc. However the plugin subclasses the
381 // window again in WM_LBUTTONDOWN before entering full screen. As a result
382 // Safari does not receive the WM_LBUTTONUP message. To workaround this
383 // issue we use a per thread mouse hook. This bug does not occur in Firefox
384 // and opera. Firefox has code similar to Safari. It could well be a bug in
385 // the flash plugin, which only occurs in webkit based browsers.
386 if (quirks_ & PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE) {
387 mouse_hook_ = SetWindowsHookEx(WH_MOUSE, MouseHookProc, NULL,
388 GetCurrentThreadId());
389 }
374 } 390 }
375 391
376 // On XP, WMP will use its old UI unless a registry key under HKLM has the 392 // On XP, WMP will use its old UI unless a registry key under HKLM has the
377 // name of the current process. We do it in the installer for admin users, 393 // name of the current process. We do it in the installer for admin users,
378 // for the rest patch this function. 394 // for the rest patch this function.
379 if ((quirks_ & PLUGIN_QUIRK_PATCH_REGENUMKEYEXW) && 395 if ((quirks_ & PLUGIN_QUIRK_PATCH_REGENUMKEYEXW) &&
380 win_util::GetWinVersion() == win_util::WINVERSION_XP && 396 win_util::GetWinVersion() == win_util::WINVERSION_XP &&
381 !RegKey().Open(HKEY_LOCAL_MACHINE, 397 !RegKey().Open(HKEY_LOCAL_MACHINE,
382 L"SOFTWARE\\Microsoft\\MediaPlayer\\ShimInclusionList\\chrome.exe") && 398 L"SOFTWARE\\Microsoft\\MediaPlayer\\ShimInclusionList\\chrome.exe") &&
383 !g_iat_patch_reg_enum_key_ex_w.Pointer()->is_patched()) { 399 !g_iat_patch_reg_enum_key_ex_w.Pointer()->is_patched()) {
384 g_iat_patch_reg_enum_key_ex_w.Pointer()->Patch( 400 g_iat_patch_reg_enum_key_ex_w.Pointer()->Patch(
385 L"wmpdxm.dll", "advapi32.dll", "RegEnumKeyExW", 401 L"wmpdxm.dll", "advapi32.dll", "RegEnumKeyExW",
386 WebPluginDelegateImpl::RegEnumKeyExWPatch); 402 WebPluginDelegateImpl::RegEnumKeyExWPatch);
387 } 403 }
388 404
389 // The windowed flash plugin has a bug which occurs when the plugin enters
390 // fullscreen mode. It basically captures the mouse on WM_LBUTTONDOWN and
391 // does not release capture correctly causing it to stop receiving subsequent
392 // mouse events. This problem is also seen in Safari where there is code to
393 // handle this in the wndproc. However the plugin subclasses the window again
394 // in WM_LBUTTONDOWN before entering full screen. As a result Safari does not
395 // receive the WM_LBUTTONUP message. To workaround this issue we use a per
396 // thread mouse hook. This bug does not occur in Firefox and opera. Firefox
397 // has code similar to Safari. It could well be a bug in the flash plugin,
398 // which only occurs in webkit based browsers.
399 if (quirks_ & PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE) {
400 mouse_hook_ = SetWindowsHookEx(WH_MOUSE, MouseHookProc, NULL,
401 GetCurrentThreadId());
402 }
403 return true; 405 return true;
404 } 406 }
405 407
406 void WebPluginDelegateImpl::PlatformDestroyInstance() { 408 void WebPluginDelegateImpl::PlatformDestroyInstance() {
407 if (!instance_->plugin_lib()) 409 if (!instance_->plugin_lib())
408 return; 410 return;
409 411
410 // Unpatch if this is the last plugin instance. 412 // Unpatch if this is the last plugin instance.
411 if (instance_->plugin_lib()->instance_count() != 1) 413 if (instance_->plugin_lib()->instance_count() != 1)
412 return; 414 return;
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 wcsncpy_s(name, orig_size, kChromeExeName, arraysize(kChromeExeName)); 1355 wcsncpy_s(name, orig_size, kChromeExeName, arraysize(kChromeExeName));
1354 *name_size = 1356 *name_size =
1355 std::min(orig_size, static_cast<DWORD>(arraysize(kChromeExeName))); 1357 std::min(orig_size, static_cast<DWORD>(arraysize(kChromeExeName)));
1356 } 1358 }
1357 1359
1358 return rv; 1360 return rv;
1359 } 1361 }
1360 1362
1361 void WebPluginDelegateImpl::HandleCaptureForMessage(HWND window, 1363 void WebPluginDelegateImpl::HandleCaptureForMessage(HWND window,
1362 UINT message) { 1364 UINT message) {
1365 if (!WebPluginDelegateImpl::IsPluginDelegateWindow(window))
1366 return;
1367
1363 switch (message) { 1368 switch (message) {
1364 case WM_LBUTTONDOWN: 1369 case WM_LBUTTONDOWN:
1365 case WM_MBUTTONDOWN: 1370 case WM_MBUTTONDOWN:
1366 case WM_RBUTTONDOWN: 1371 case WM_RBUTTONDOWN:
1367 ::SetCapture(window); 1372 ::SetCapture(window);
1368 break; 1373 break;
1369 1374
1370 case WM_LBUTTONUP: 1375 case WM_LBUTTONUP:
1371 case WM_MBUTTONUP: 1376 case WM_MBUTTONUP:
1372 case WM_RBUTTONUP: 1377 case WM_RBUTTONUP:
1373 ::ReleaseCapture(); 1378 ::ReleaseCapture();
1374 break; 1379 break;
1375 1380
1376 default: 1381 default:
1377 break; 1382 break;
1378 } 1383 }
1379 } 1384 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698