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

Side by Side Diff: content/child/npapi/webplugin_delegate_impl_win.cc

Issue 19761007: Move NPAPI implementation out of webkit/plugins/npapi and into content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 7 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/plugins/npapi/webplugin_delegate_impl.h" 5 #include "content/child/npapi/webplugin_delegate_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/metrics/stats_counters.h" 17 #include "base/metrics/stats_counters.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
20 #include "base/synchronization/lock.h" 20 #include "base/synchronization/lock.h"
21 #include "base/version.h" 21 #include "base/version.h"
22 #include "base/win/iat_patch_function.h" 22 #include "base/win/iat_patch_function.h"
23 #include "base/win/registry.h" 23 #include "base/win/registry.h"
24 #include "base/win/windows_version.h" 24 #include "base/win/windows_version.h"
25 #include "content/child/npapi/plugin_instance.h"
26 #include "content/child/npapi/plugin_lib.h"
27 #include "content/child/npapi/plugin_stream_url.h"
28 #include "content/child/npapi/webplugin.h"
29 #include "content/child/npapi/webplugin_ime_win.h"
30 #include "content/common/plugin_constants_win.h"
25 #include "skia/ext/platform_canvas.h" 31 #include "skia/ext/platform_canvas.h"
26 #include "third_party/WebKit/public/web/WebInputEvent.h" 32 #include "third_party/WebKit/public/web/WebInputEvent.h"
27 #include "ui/base/win/dpi.h" 33 #include "ui/base/win/dpi.h"
28 #include "ui/base/win/hwnd_util.h" 34 #include "ui/base/win/hwnd_util.h"
29 #include "webkit/common/cursors/webcursor.h" 35 #include "webkit/common/cursors/webcursor.h"
30 #include "webkit/plugins/npapi/plugin_constants_win.h"
31 #include "webkit/plugins/npapi/plugin_instance.h"
32 #include "webkit/plugins/npapi/plugin_lib.h"
33 #include "webkit/plugins/npapi/plugin_stream_url.h"
34 #include "webkit/plugins/npapi/plugin_utils.h" 36 #include "webkit/plugins/npapi/plugin_utils.h"
35 #include "webkit/plugins/npapi/webplugin.h"
36 #include "webkit/plugins/npapi/webplugin_ime_win.h"
37 #include "webkit/plugins/plugin_constants.h" 37 #include "webkit/plugins/plugin_constants.h"
38 38
39 using WebKit::WebKeyboardEvent; 39 using WebKit::WebKeyboardEvent;
40 using WebKit::WebInputEvent; 40 using WebKit::WebInputEvent;
41 using WebKit::WebMouseEvent; 41 using WebKit::WebMouseEvent;
42 using webkit::WebPluginInfo;
42 43
43 namespace webkit { 44 namespace content {
44 namespace npapi {
45 45
46 namespace { 46 namespace {
47 47
48 const wchar_t kWebPluginDelegateProperty[] = L"WebPluginDelegateProperty"; 48 const wchar_t kWebPluginDelegateProperty[] = L"WebPluginDelegateProperty";
49 const wchar_t kPluginNameAtomProperty[] = L"PluginNameAtom";
50 const wchar_t kPluginVersionAtomProperty[] = L"PluginVersionAtom";
51 const wchar_t kDummyActivationWindowName[] = L"DummyWindowForActivation";
52 const wchar_t kPluginFlashThrottle[] = L"FlashThrottle"; 49 const wchar_t kPluginFlashThrottle[] = L"FlashThrottle";
53 50
54 // The fastest we are willing to process WM_USER+1 events for Flash. 51 // The fastest we are willing to process WM_USER+1 events for Flash.
55 // Flash can easily exceed the limits of our CPU if we don't throttle it. 52 // Flash can easily exceed the limits of our CPU if we don't throttle it.
56 // The throttle has been chosen by testing various delays and compromising 53 // The throttle has been chosen by testing various delays and compromising
57 // on acceptable Flash performance and reasonable CPU consumption. 54 // on acceptable Flash performance and reasonable CPU consumption.
58 // 55 //
59 // I'd like to make the throttle delay variable, based on the amount of 56 // I'd like to make the throttle delay variable, based on the amount of
60 // time currently required to paint Flash plugins. There isn't a good 57 // time currently required to paint Flash plugins. There isn't a good
61 // way to count the time spent in aggregate plugin painting, however, so 58 // way to count the time spent in aggregate plugin painting, however, so
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 Version plugin_version; 191 Version plugin_version;
195 webkit::npapi::CreateVersionFromString(plugin_info.version, &plugin_version); 192 webkit::npapi::CreateVersionFromString(plugin_info.version, &plugin_version);
196 193
197 int major_version = 0; 194 int major_version = 0;
198 if (plugin_version.IsValid()) 195 if (plugin_version.IsValid())
199 major_version = plugin_version.components()[0]; 196 major_version = plugin_version.components()[0];
200 197
201 return major_version; 198 return major_version;
202 } 199 }
203 200
204 bool GetPluginPropertyFromWindow(
205 HWND window, const wchar_t* plugin_atom_property,
206 base::string16* plugin_property) {
207 ATOM plugin_atom = reinterpret_cast<ATOM>(
208 GetPropW(window, plugin_atom_property));
209 if (plugin_atom != 0) {
210 WCHAR plugin_property_local[MAX_PATH] = {0};
211 GlobalGetAtomNameW(plugin_atom,
212 plugin_property_local,
213 ARRAYSIZE(plugin_property_local));
214 *plugin_property = plugin_property_local;
215 return true;
216 }
217 return false;
218 }
219
220 } // namespace 201 } // namespace
221 202
222 bool WebPluginDelegateImpl::IsPluginDelegateWindow(HWND window) {
223 return ui::GetClassName(window) == base::string16(kNativeWindowClassName);
224 }
225
226 // static
227 bool WebPluginDelegateImpl::GetPluginNameFromWindow(
228 HWND window, base::string16* plugin_name) {
229 return IsPluginDelegateWindow(window) &&
230 GetPluginPropertyFromWindow(
231 window, kPluginNameAtomProperty, plugin_name);
232 }
233
234 // static
235 bool WebPluginDelegateImpl::GetPluginVersionFromWindow(
236 HWND window, base::string16* plugin_version) {
237 return IsPluginDelegateWindow(window) &&
238 GetPluginPropertyFromWindow(
239 window, kPluginVersionAtomProperty, plugin_version);
240 }
241
242 bool WebPluginDelegateImpl::IsDummyActivationWindow(HWND window) {
243 if (!IsWindow(window))
244 return false;
245
246 wchar_t window_title[MAX_PATH + 1] = {0};
247 if (GetWindowText(window, window_title, arraysize(window_title))) {
248 return (0 == lstrcmpiW(window_title, kDummyActivationWindowName));
249 }
250 return false;
251 }
252
253 HWND WebPluginDelegateImpl::GetDefaultWindowParent() {
254 return GetDesktopWindow();
255 }
256
257 LRESULT CALLBACK WebPluginDelegateImpl::HandleEventMessageFilterHook( 203 LRESULT CALLBACK WebPluginDelegateImpl::HandleEventMessageFilterHook(
258 int code, WPARAM wParam, LPARAM lParam) { 204 int code, WPARAM wParam, LPARAM lParam) {
259 if (g_current_plugin_instance) { 205 if (g_current_plugin_instance) {
260 g_current_plugin_instance->OnModalLoopEntered(); 206 g_current_plugin_instance->OnModalLoopEntered();
261 } else { 207 } else {
262 NOTREACHED(); 208 NOTREACHED();
263 } 209 }
264 return CallNextHookEx(NULL, code, wParam, lParam); 210 return CallNextHookEx(NULL, code, wParam, lParam);
265 } 211 }
266 212
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 } 451 }
506 452
507 bool WebPluginDelegateImpl::WindowedCreatePlugin() { 453 bool WebPluginDelegateImpl::WindowedCreatePlugin() {
508 DCHECK(!windowed_handle_); 454 DCHECK(!windowed_handle_);
509 455
510 RegisterNativeWindowClass(); 456 RegisterNativeWindowClass();
511 457
512 // The window will be sized and shown later. 458 // The window will be sized and shown later.
513 windowed_handle_ = CreateWindowEx( 459 windowed_handle_ = CreateWindowEx(
514 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, 460 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR,
515 kNativeWindowClassName, 461 webkit::npapi::kNativeWindowClassName,
516 0, 462 0,
517 WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 463 WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
518 0, 464 0,
519 0, 465 0,
520 0, 466 0,
521 0, 467 0,
522 GetDefaultWindowParent(), 468 webkit::npapi::GetDefaultWindowParent(),
523 0, 469 0,
524 GetModuleHandle(NULL), 470 GetModuleHandle(NULL),
525 0); 471 0);
526 if (windowed_handle_ == 0) 472 if (windowed_handle_ == 0)
527 return false; 473 return false;
528 474
529 // This is a tricky workaround for Issue 2673 in chromium "Flash: IME not 475 // This is a tricky workaround for Issue 2673 in chromium "Flash: IME not
530 // available". To use IMEs in this window, we have to make Windows attach 476 // available". To use IMEs in this window, we have to make Windows attach
531 // IMEs to this window (i.e. load IME DLLs, attach them to this process, and 477 // IMEs to this window (i.e. load IME DLLs, attach them to this process, and
532 // add their message hooks to this window). Windows attaches IMEs while this 478 // add their message hooks to this window). Windows attaches IMEs while this
(...skipping 12 matching lines...) Expand all
545 // window property. Use atoms so that other processes can access the name and 491 // window property. Use atoms so that other processes can access the name and
546 // version of the plugin that this window is hosting. 492 // version of the plugin that this window is hosting.
547 if (instance_ != NULL) { 493 if (instance_ != NULL) {
548 PluginLib* plugin_lib = instance()->plugin_lib(); 494 PluginLib* plugin_lib = instance()->plugin_lib();
549 if (plugin_lib != NULL) { 495 if (plugin_lib != NULL) {
550 std::wstring plugin_name = plugin_lib->plugin_info().name; 496 std::wstring plugin_name = plugin_lib->plugin_info().name;
551 if (!plugin_name.empty()) { 497 if (!plugin_name.empty()) {
552 ATOM plugin_name_atom = GlobalAddAtomW(plugin_name.c_str()); 498 ATOM plugin_name_atom = GlobalAddAtomW(plugin_name.c_str());
553 DCHECK_NE(0, plugin_name_atom); 499 DCHECK_NE(0, plugin_name_atom);
554 result = SetProp(windowed_handle_, 500 result = SetProp(windowed_handle_,
555 kPluginNameAtomProperty, 501 webkit::npapi::kPluginNameAtomProperty,
556 reinterpret_cast<HANDLE>(plugin_name_atom)); 502 reinterpret_cast<HANDLE>(plugin_name_atom));
557 DCHECK(result == TRUE) << "SetProp failed, last error = " << 503 DCHECK(result == TRUE) << "SetProp failed, last error = " <<
558 GetLastError(); 504 GetLastError();
559 } 505 }
560 base::string16 plugin_version = plugin_lib->plugin_info().version; 506 base::string16 plugin_version = plugin_lib->plugin_info().version;
561 if (!plugin_version.empty()) { 507 if (!plugin_version.empty()) {
562 ATOM plugin_version_atom = GlobalAddAtomW(plugin_version.c_str()); 508 ATOM plugin_version_atom = GlobalAddAtomW(plugin_version.c_str());
563 DCHECK_NE(0, plugin_version_atom); 509 DCHECK_NE(0, plugin_version_atom);
564 result = SetProp(windowed_handle_, 510 result = SetProp(windowed_handle_,
565 kPluginVersionAtomProperty, 511 webkit::npapi::kPluginVersionAtomProperty,
566 reinterpret_cast<HANDLE>(plugin_version_atom)); 512 reinterpret_cast<HANDLE>(plugin_version_atom));
567 DCHECK(result == TRUE) << "SetProp failed, last error = " << 513 DCHECK(result == TRUE) << "SetProp failed, last error = " <<
568 GetLastError(); 514 GetLastError();
569 } 515 }
570 } 516 }
571 } 517 }
572 518
573 // Calling SetWindowLongPtrA here makes the window proc ASCII, which is 519 // Calling SetWindowLongPtrA here makes the window proc ASCII, which is
574 // required by at least the Shockwave Director plug-in. 520 // required by at least the Shockwave Director plug-in.
575 SetWindowLongPtrA( 521 SetWindowLongPtrA(
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 725
780 return TRUE; 726 return TRUE;
781 } 727 }
782 728
783 bool WebPluginDelegateImpl::CreateDummyWindowForActivation() { 729 bool WebPluginDelegateImpl::CreateDummyWindowForActivation() {
784 DCHECK(!dummy_window_for_activation_); 730 DCHECK(!dummy_window_for_activation_);
785 731
786 dummy_window_for_activation_ = CreateWindowEx( 732 dummy_window_for_activation_ = CreateWindowEx(
787 0, 733 0,
788 L"Static", 734 L"Static",
789 kDummyActivationWindowName, 735 webkit::npapi::kDummyActivationWindowName,
790 WS_CHILD, 736 WS_CHILD,
791 0, 737 0,
792 0, 738 0,
793 0, 739 0,
794 0, 740 0,
795 // We don't know the parent of the dummy window yet, so just set it to the 741 // We don't know the parent of the dummy window yet, so just set it to the
796 // desktop and it'll get parented by the browser. 742 // desktop and it'll get parented by the browser.
797 GetDefaultWindowParent(), 743 webkit::npapi::GetDefaultWindowParent(),
798 0, 744 0,
799 GetModuleHandle(NULL), 745 GetModuleHandle(NULL),
800 0); 746 0);
801 747
802 if (dummy_window_for_activation_ == 0) 748 if (dummy_window_for_activation_ == 0)
803 return false; 749 return false;
804 750
805 BOOL result = SetProp(dummy_window_for_activation_, 751 BOOL result = SetProp(dummy_window_for_activation_,
806 kWebPluginDelegateProperty, this); 752 kWebPluginDelegateProperty, this);
807 DCHECK(result == TRUE) << "SetProp failed, last error = " << GetLastError(); 753 DCHECK(result == TRUE) << "SetProp failed, last error = " << GetLastError();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 wcex.hInstance = GetModuleHandle(NULL); 866 wcex.hInstance = GetModuleHandle(NULL);
921 wcex.hIcon = 0; 867 wcex.hIcon = 0;
922 wcex.hCursor = 0; 868 wcex.hCursor = 0;
923 // Some plugins like windows media player 11 create child windows parented 869 // Some plugins like windows media player 11 create child windows parented
924 // by our plugin window, where the media content is rendered. These plugins 870 // by our plugin window, where the media content is rendered. These plugins
925 // dont implement WM_ERASEBKGND, which causes painting issues, when the 871 // dont implement WM_ERASEBKGND, which causes painting issues, when the
926 // window where the media is rendered is moved around. DefWindowProc does 872 // window where the media is rendered is moved around. DefWindowProc does
927 // implement WM_ERASEBKGND correctly if we have a valid background brush. 873 // implement WM_ERASEBKGND correctly if we have a valid background brush.
928 wcex.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW+1); 874 wcex.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW+1);
929 wcex.lpszMenuName = 0; 875 wcex.lpszMenuName = 0;
930 wcex.lpszClassName = kNativeWindowClassName; 876 wcex.lpszClassName = webkit::npapi::kNativeWindowClassName;
931 wcex.hIconSm = 0; 877 wcex.hIconSm = 0;
932 878
933 return RegisterClassEx(&wcex); 879 return RegisterClassEx(&wcex);
934 } 880 }
935 881
936 LRESULT CALLBACK WebPluginDelegateImpl::WrapperWindowProc( 882 LRESULT CALLBACK WebPluginDelegateImpl::WrapperWindowProc(
937 HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { 883 HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
938 // This is another workaround for Issue 2673 in chromium "Flash: IME not 884 // This is another workaround for Issue 2673 in chromium "Flash: IME not
939 // available". Somehow, the CallWindowProc() function does not dispatch 885 // available". Somehow, the CallWindowProc() function does not dispatch
940 // window messages when its first parameter is a handle representing the 886 // window messages when its first parameter is a handle representing the
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 999
1054 result = CallWindowProc( 1000 result = CallWindowProc(
1055 delegate->plugin_wnd_proc_, hwnd, message, wparam, lparam); 1001 delegate->plugin_wnd_proc_, hwnd, message, wparam, lparam);
1056 1002
1057 delegate->is_calling_wndproc = false; 1003 delegate->is_calling_wndproc = false;
1058 g_current_plugin_instance = last_plugin_instance; 1004 g_current_plugin_instance = last_plugin_instance;
1059 1005
1060 if (message == WM_NCDESTROY) { 1006 if (message == WM_NCDESTROY) {
1061 RemoveProp(hwnd, kWebPluginDelegateProperty); 1007 RemoveProp(hwnd, kWebPluginDelegateProperty);
1062 ATOM plugin_name_atom = reinterpret_cast<ATOM>( 1008 ATOM plugin_name_atom = reinterpret_cast<ATOM>(
1063 RemoveProp(hwnd, kPluginNameAtomProperty)); 1009 RemoveProp(hwnd, webkit::npapi::kPluginNameAtomProperty));
1064 if (plugin_name_atom != 0) 1010 if (plugin_name_atom != 0)
1065 GlobalDeleteAtom(plugin_name_atom); 1011 GlobalDeleteAtom(plugin_name_atom);
1066 ATOM plugin_version_atom = reinterpret_cast<ATOM>( 1012 ATOM plugin_version_atom = reinterpret_cast<ATOM>(
1067 RemoveProp(hwnd, kPluginVersionAtomProperty)); 1013 RemoveProp(hwnd, webkit::npapi::kPluginVersionAtomProperty));
1068 if (plugin_version_atom != 0) 1014 if (plugin_version_atom != 0)
1069 GlobalDeleteAtom(plugin_version_atom); 1015 GlobalDeleteAtom(plugin_version_atom);
1070 ClearThrottleQueueForWindow(hwnd); 1016 ClearThrottleQueueForWindow(hwnd);
1071 } 1017 }
1072 } 1018 }
1073 delegate->last_message_ = old_message; 1019 delegate->last_message_ = old_message;
1074 return result; 1020 return result;
1075 } 1021 }
1076 1022
1077 void WebPluginDelegateImpl::WindowlessUpdateGeometry( 1023 void WebPluginDelegateImpl::WindowlessUpdateGeometry(
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 handle_event_message_filter_hook_ = 1247 handle_event_message_filter_hook_ =
1302 SetWindowsHookEx(WH_MSGFILTER, HandleEventMessageFilterHook, NULL, 1248 SetWindowsHookEx(WH_MSGFILTER, HandleEventMessageFilterHook, NULL,
1303 GetCurrentThreadId()); 1249 GetCurrentThreadId());
1304 // To ensure that the plugin receives keyboard events we set focus to the 1250 // To ensure that the plugin receives keyboard events we set focus to the
1305 // dummy window. 1251 // dummy window.
1306 // TODO(iyengar) We need a framework in the renderer to identify which 1252 // TODO(iyengar) We need a framework in the renderer to identify which
1307 // windowless plugin is under the mouse and to handle this. This would 1253 // windowless plugin is under the mouse and to handle this. This would
1308 // also require some changes in RenderWidgetHost to detect this in the 1254 // also require some changes in RenderWidgetHost to detect this in the
1309 // WM_MOUSEACTIVATE handler and inform the renderer accordingly. 1255 // WM_MOUSEACTIVATE handler and inform the renderer accordingly.
1310 bool valid = 1256 bool valid =
1311 GetParent(dummy_window_for_activation_) != GetDefaultWindowParent(); 1257 GetParent(dummy_window_for_activation_) !=
1258 webkit::npapi::GetDefaultWindowParent();
1312 if (valid) { 1259 if (valid) {
1313 last_focus_window = ::SetFocus(dummy_window_for_activation_); 1260 last_focus_window = ::SetFocus(dummy_window_for_activation_);
1314 } else { 1261 } else {
1315 NOTREACHED() << "Dummy window not parented"; 1262 NOTREACHED() << "Dummy window not parented";
1316 } 1263 }
1317 } 1264 }
1318 1265
1319 bool old_task_reentrancy_state = 1266 bool old_task_reentrancy_state =
1320 base::MessageLoop::current()->NestableTasksAllowed(); 1267 base::MessageLoop::current()->NestableTasksAllowed();
1321 1268
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 1372
1426 if (g_current_plugin_instance) { 1373 if (g_current_plugin_instance) {
1427 unsigned long window_process_id = 0; 1374 unsigned long window_process_id = 0;
1428 unsigned long window_thread_id = 1375 unsigned long window_thread_id =
1429 GetWindowThreadProcessId(window, &window_process_id); 1376 GetWindowThreadProcessId(window, &window_process_id);
1430 // TrackPopupMenu fails if the window passed in belongs to a different 1377 // TrackPopupMenu fails if the window passed in belongs to a different
1431 // thread. 1378 // thread.
1432 if (::GetCurrentThreadId() != window_thread_id) { 1379 if (::GetCurrentThreadId() != window_thread_id) {
1433 bool valid = 1380 bool valid =
1434 GetParent(g_current_plugin_instance->dummy_window_for_activation_) != 1381 GetParent(g_current_plugin_instance->dummy_window_for_activation_) !=
1435 GetDefaultWindowParent(); 1382 webkit::npapi::GetDefaultWindowParent();
1436 if (valid) { 1383 if (valid) {
1437 window = g_current_plugin_instance->dummy_window_for_activation_; 1384 window = g_current_plugin_instance->dummy_window_for_activation_;
1438 } else { 1385 } else {
1439 NOTREACHED() << "Dummy window not parented"; 1386 NOTREACHED() << "Dummy window not parented";
1440 } 1387 }
1441 } 1388 }
1442 } 1389 }
1443 1390
1444 BOOL result = TrackPopupMenu(menu, flags, x, y, reserved, window, rect); 1391 BOOL result = TrackPopupMenu(menu, flags, x, y, reserved, window, rect);
1445 return result; 1392 return result;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 FARPROC WINAPI WebPluginDelegateImpl::GetProcAddressPatch(HMODULE module, 1456 FARPROC WINAPI WebPluginDelegateImpl::GetProcAddressPatch(HMODULE module,
1510 LPCSTR name) { 1457 LPCSTR name) {
1511 FARPROC imm_function = WebPluginIMEWin::GetProcAddress(name); 1458 FARPROC imm_function = WebPluginIMEWin::GetProcAddress(name);
1512 if (imm_function) 1459 if (imm_function)
1513 return imm_function; 1460 return imm_function;
1514 return ::GetProcAddress(module, name); 1461 return ::GetProcAddress(module, name);
1515 } 1462 }
1516 1463
1517 void WebPluginDelegateImpl::HandleCaptureForMessage(HWND window, 1464 void WebPluginDelegateImpl::HandleCaptureForMessage(HWND window,
1518 UINT message) { 1465 UINT message) {
1519 if (!WebPluginDelegateImpl::IsPluginDelegateWindow(window)) 1466 if (!webkit::npapi::IsPluginDelegateWindow(window))
1520 return; 1467 return;
1521 1468
1522 switch (message) { 1469 switch (message) {
1523 case WM_LBUTTONDOWN: 1470 case WM_LBUTTONDOWN:
1524 case WM_MBUTTONDOWN: 1471 case WM_MBUTTONDOWN:
1525 case WM_RBUTTONDOWN: 1472 case WM_RBUTTONDOWN:
1526 ::SetCapture(window); 1473 ::SetCapture(window);
1527 // As per documentation the WM_PARENTNOTIFY message is sent to the parent 1474 // As per documentation the WM_PARENTNOTIFY message is sent to the parent
1528 // window chain if mouse input is received by the child window. However 1475 // window chain if mouse input is received by the child window. However
1529 // the parent receives the WM_PARENTNOTIFY message only if we doubleclick 1476 // the parent receives the WM_PARENTNOTIFY message only if we doubleclick
1530 // on the window. We send the WM_PARENTNOTIFY message for mouse input 1477 // on the window. We send the WM_PARENTNOTIFY message for mouse input
1531 // messages to the parent to indicate that user action is expected. 1478 // messages to the parent to indicate that user action is expected.
1532 ::SendMessage(::GetParent(window), WM_PARENTNOTIFY, message, 0); 1479 ::SendMessage(::GetParent(window), WM_PARENTNOTIFY, message, 0);
1533 break; 1480 break;
1534 1481
1535 case WM_LBUTTONUP: 1482 case WM_LBUTTONUP:
1536 case WM_MBUTTONUP: 1483 case WM_MBUTTONUP:
1537 case WM_RBUTTONUP: 1484 case WM_RBUTTONUP:
1538 ::ReleaseCapture(); 1485 ::ReleaseCapture();
1539 break; 1486 break;
1540 1487
1541 default: 1488 default:
1542 break; 1489 break;
1543 } 1490 }
1544 } 1491 }
1545 1492
1546 } // namespace npapi 1493 } // namespace content
1547 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698