OLD | NEW |
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" |
11 #include "base/iat_patch.h" | 11 #include "base/iat_patch.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/stats_counters.h" | 14 #include "base/stats_counters.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/win_util.h" |
16 #include "webkit/default_plugin/plugin_impl.h" | 17 #include "webkit/default_plugin/plugin_impl.h" |
17 #include "webkit/glue/glue_util.h" | 18 #include "webkit/glue/glue_util.h" |
18 #include "webkit/glue/webplugin.h" | 19 #include "webkit/glue/webplugin.h" |
19 #include "webkit/glue/plugins/plugin_constants_win.h" | 20 #include "webkit/glue/plugins/plugin_constants_win.h" |
20 #include "webkit/glue/plugins/plugin_instance.h" | 21 #include "webkit/glue/plugins/plugin_instance.h" |
21 #include "webkit/glue/plugins/plugin_lib.h" | 22 #include "webkit/glue/plugins/plugin_lib.h" |
22 #include "webkit/glue/plugins/plugin_list.h" | 23 #include "webkit/glue/plugins/plugin_list.h" |
23 #include "webkit/glue/plugins/plugin_stream_url.h" | 24 #include "webkit/glue/plugins/plugin_stream_url.h" |
24 #include "webkit/glue/webkit_glue.h" | 25 #include "webkit/glue/webkit_glue.h" |
25 | 26 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 quirks_ |= PLUGIN_QUIRK_PATCH_TRACKPOPUP_MENU; | 195 quirks_ |= PLUGIN_QUIRK_PATCH_TRACKPOPUP_MENU; |
195 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; | 196 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; |
196 } | 197 } |
197 | 198 |
198 plugin_module_handle_ = ::GetModuleHandle(plugin_info.path.value().c_str()); | 199 plugin_module_handle_ = ::GetModuleHandle(plugin_info.path.value().c_str()); |
199 } | 200 } |
200 | 201 |
201 WebPluginDelegateImpl::~WebPluginDelegateImpl() { | 202 WebPluginDelegateImpl::~WebPluginDelegateImpl() { |
202 if (::IsWindow(dummy_window_for_activation_)) { | 203 if (::IsWindow(dummy_window_for_activation_)) { |
203 ::DestroyWindow(dummy_window_for_activation_); | 204 ::DestroyWindow(dummy_window_for_activation_); |
| 205 TRACK_HWND_DESTRUCTION(dummy_window_for_activation_); |
204 } | 206 } |
205 | 207 |
206 DestroyInstance(); | 208 DestroyInstance(); |
207 | 209 |
208 if (!windowless_) | 210 if (!windowless_) |
209 WindowedDestroyWindow(); | 211 WindowedDestroyWindow(); |
210 | 212 |
211 if (handle_event_pump_messages_event_) { | 213 if (handle_event_pump_messages_event_) { |
212 CloseHandle(handle_event_pump_messages_event_); | 214 CloseHandle(handle_event_pump_messages_event_); |
213 } | 215 } |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 0, | 442 0, |
441 WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, | 443 WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, |
442 0, | 444 0, |
443 0, | 445 0, |
444 0, | 446 0, |
445 0, | 447 0, |
446 parent_, | 448 parent_, |
447 0, | 449 0, |
448 GetModuleHandle(NULL), | 450 GetModuleHandle(NULL), |
449 0); | 451 0); |
| 452 TRACK_HWND_CREATION(windowed_handle_); |
450 if (windowed_handle_ == 0) | 453 if (windowed_handle_ == 0) |
451 return false; | 454 return false; |
452 | 455 |
453 if (IsWindow(parent_)) { | 456 if (IsWindow(parent_)) { |
454 // This is a tricky workaround for Issue 2673 in chromium "Flash: IME not | 457 // This is a tricky workaround for Issue 2673 in chromium "Flash: IME not |
455 // available". To use IMEs in this window, we have to make Windows attach | 458 // available". To use IMEs in this window, we have to make Windows attach |
456 // IMEs to this window (i.e. load IME DLLs, attach them to this process, | 459 // IMEs to this window (i.e. load IME DLLs, attach them to this process, |
457 // and add their message hooks to this window). Windows attaches IMEs while | 460 // and add their message hooks to this window). Windows attaches IMEs while |
458 // this process creates a top-level window. On the other hand, to layout | 461 // this process creates a top-level window. On the other hand, to layout |
459 // this window correctly in the given parent window (RenderWidgetHostHWND), | 462 // this window correctly in the given parent window (RenderWidgetHostHWND), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 // Unsubclass the window. | 502 // Unsubclass the window. |
500 WNDPROC current_wnd_proc = reinterpret_cast<WNDPROC>( | 503 WNDPROC current_wnd_proc = reinterpret_cast<WNDPROC>( |
501 GetWindowLongPtr(windowed_handle_, GWLP_WNDPROC)); | 504 GetWindowLongPtr(windowed_handle_, GWLP_WNDPROC)); |
502 if (current_wnd_proc == NativeWndProc) { | 505 if (current_wnd_proc == NativeWndProc) { |
503 SetWindowLongPtr(windowed_handle_, | 506 SetWindowLongPtr(windowed_handle_, |
504 GWLP_WNDPROC, | 507 GWLP_WNDPROC, |
505 reinterpret_cast<LONG>(plugin_wnd_proc_)); | 508 reinterpret_cast<LONG>(plugin_wnd_proc_)); |
506 } | 509 } |
507 | 510 |
508 DestroyWindow(windowed_handle_); | 511 DestroyWindow(windowed_handle_); |
| 512 TRACK_HWND_DESTRUCTION(windowed_handle_); |
509 windowed_handle_ = 0; | 513 windowed_handle_ = 0; |
510 } | 514 } |
511 } | 515 } |
512 | 516 |
513 // Erase all messages in the queue destined for a particular window. | 517 // Erase all messages in the queue destined for a particular window. |
514 // When windows are closing, callers should use this function to clear | 518 // When windows are closing, callers should use this function to clear |
515 // the queue. | 519 // the queue. |
516 // static | 520 // static |
517 void WebPluginDelegateImpl::ClearThrottleQueueForWindow(HWND window) { | 521 void WebPluginDelegateImpl::ClearThrottleQueueForWindow(HWND window) { |
518 std::list<MSG>* throttle_queue = g_throttle_queue.Pointer(); | 522 std::list<MSG>* throttle_queue = g_throttle_queue.Pointer(); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 kDummyActivationWindowName, | 655 kDummyActivationWindowName, |
652 WS_CHILD, | 656 WS_CHILD, |
653 0, | 657 0, |
654 0, | 658 0, |
655 0, | 659 0, |
656 0, | 660 0, |
657 parent_, | 661 parent_, |
658 0, | 662 0, |
659 GetModuleHandle(NULL), | 663 GetModuleHandle(NULL), |
660 0); | 664 0); |
| 665 TRACK_HWND_CREATION(dummy_window_for_activation_); |
661 | 666 |
662 if (dummy_window_for_activation_ == 0) | 667 if (dummy_window_for_activation_ == 0) |
663 return false; | 668 return false; |
664 | 669 |
665 // Flash creates background windows which use excessive CPU in our | 670 // Flash creates background windows which use excessive CPU in our |
666 // environment; we wrap these windows and throttle them so that they don't | 671 // environment; we wrap these windows and throttle them so that they don't |
667 // get out of hand. | 672 // get out of hand. |
668 if (!EnumThreadWindows(::GetCurrentThreadId(), EnumFlashWindows, | 673 if (!EnumThreadWindows(::GetCurrentThreadId(), EnumFlashWindows, |
669 reinterpret_cast<LPARAM>( | 674 reinterpret_cast<LPARAM>( |
670 &WebPluginDelegateImpl::FlashWindowlessWndProc))) { | 675 &WebPluginDelegateImpl::FlashWindowlessWndProc))) { |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 | 1180 |
1176 // It is ok to pass NULL here to GetCursor as we are not looking for cursor | 1181 // It is ok to pass NULL here to GetCursor as we are not looking for cursor |
1177 // types defined by Webkit. | 1182 // types defined by Webkit. |
1178 HCURSOR previous_cursor = | 1183 HCURSOR previous_cursor = |
1179 g_current_plugin_instance->current_windowless_cursor_.GetCursor(NULL); | 1184 g_current_plugin_instance->current_windowless_cursor_.GetCursor(NULL); |
1180 | 1185 |
1181 g_current_plugin_instance->current_windowless_cursor_.InitFromExternalCursor( | 1186 g_current_plugin_instance->current_windowless_cursor_.InitFromExternalCursor( |
1182 cursor); | 1187 cursor); |
1183 return previous_cursor; | 1188 return previous_cursor; |
1184 } | 1189 } |
OLD | NEW |