| 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" | |
| 17 #include "webkit/default_plugin/plugin_impl.h" | 16 #include "webkit/default_plugin/plugin_impl.h" |
| 18 #include "webkit/glue/glue_util.h" | 17 #include "webkit/glue/glue_util.h" |
| 19 #include "webkit/glue/webplugin.h" | 18 #include "webkit/glue/webplugin.h" |
| 20 #include "webkit/glue/plugins/plugin_constants_win.h" | 19 #include "webkit/glue/plugins/plugin_constants_win.h" |
| 21 #include "webkit/glue/plugins/plugin_instance.h" | 20 #include "webkit/glue/plugins/plugin_instance.h" |
| 22 #include "webkit/glue/plugins/plugin_lib.h" | 21 #include "webkit/glue/plugins/plugin_lib.h" |
| 23 #include "webkit/glue/plugins/plugin_list.h" | 22 #include "webkit/glue/plugins/plugin_list.h" |
| 24 #include "webkit/glue/plugins/plugin_stream_url.h" | 23 #include "webkit/glue/plugins/plugin_stream_url.h" |
| 25 #include "webkit/glue/webkit_glue.h" | 24 #include "webkit/glue/webkit_glue.h" |
| 26 | 25 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // Explanation for this quirk can be found in | 197 // Explanation for this quirk can be found in |
| 199 // WebPluginDelegateImpl::Initialize. | 198 // WebPluginDelegateImpl::Initialize. |
| 200 quirks_ |= PLUGIN_QUIRK_PATCH_TRACKPOPUP_MENU; | 199 quirks_ |= PLUGIN_QUIRK_PATCH_TRACKPOPUP_MENU; |
| 201 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; | 200 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; |
| 202 } | 201 } |
| 203 } | 202 } |
| 204 | 203 |
| 205 WebPluginDelegateImpl::~WebPluginDelegateImpl() { | 204 WebPluginDelegateImpl::~WebPluginDelegateImpl() { |
| 206 if (::IsWindow(dummy_window_for_activation_)) { | 205 if (::IsWindow(dummy_window_for_activation_)) { |
| 207 ::DestroyWindow(dummy_window_for_activation_); | 206 ::DestroyWindow(dummy_window_for_activation_); |
| 208 TRACK_HWND_DESTRUCTION(dummy_window_for_activation_); | |
| 209 } | 207 } |
| 210 | 208 |
| 211 DestroyInstance(); | 209 DestroyInstance(); |
| 212 | 210 |
| 213 if (!windowless_) | 211 if (!windowless_) |
| 214 WindowedDestroyWindow(); | 212 WindowedDestroyWindow(); |
| 215 | 213 |
| 216 if (handle_event_pump_messages_event_) { | 214 if (handle_event_pump_messages_event_) { |
| 217 CloseHandle(handle_event_pump_messages_event_); | 215 CloseHandle(handle_event_pump_messages_event_); |
| 218 } | 216 } |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 0, | 451 0, |
| 454 WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, | 452 WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, |
| 455 0, | 453 0, |
| 456 0, | 454 0, |
| 457 0, | 455 0, |
| 458 0, | 456 0, |
| 459 parent_, | 457 parent_, |
| 460 0, | 458 0, |
| 461 GetModuleHandle(NULL), | 459 GetModuleHandle(NULL), |
| 462 0); | 460 0); |
| 463 TRACK_HWND_CREATION(windowed_handle_); | |
| 464 if (windowed_handle_ == 0) | 461 if (windowed_handle_ == 0) |
| 465 return false; | 462 return false; |
| 466 | 463 |
| 467 if (IsWindow(parent_)) { | 464 if (IsWindow(parent_)) { |
| 468 // This is a tricky workaround for Issue 2673 in chromium "Flash: IME not | 465 // This is a tricky workaround for Issue 2673 in chromium "Flash: IME not |
| 469 // available". To use IMEs in this window, we have to make Windows attach | 466 // available". To use IMEs in this window, we have to make Windows attach |
| 470 // IMEs to this window (i.e. load IME DLLs, attach them to this process, | 467 // IMEs to this window (i.e. load IME DLLs, attach them to this process, |
| 471 // and add their message hooks to this window). Windows attaches IMEs while | 468 // and add their message hooks to this window). Windows attaches IMEs while |
| 472 // this process creates a top-level window. On the other hand, to layout | 469 // this process creates a top-level window. On the other hand, to layout |
| 473 // this window correctly in the given parent window (RenderWidgetHostHWND), | 470 // this window correctly in the given parent window (RenderWidgetHostHWND), |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 GetWindowLongPtr(windowed_handle_, GWLP_WNDPROC)); | 512 GetWindowLongPtr(windowed_handle_, GWLP_WNDPROC)); |
| 516 if (current_wnd_proc == NativeWndProc) { | 513 if (current_wnd_proc == NativeWndProc) { |
| 517 SetWindowLongPtr(windowed_handle_, | 514 SetWindowLongPtr(windowed_handle_, |
| 518 GWLP_WNDPROC, | 515 GWLP_WNDPROC, |
| 519 reinterpret_cast<LONG>(plugin_wnd_proc_)); | 516 reinterpret_cast<LONG>(plugin_wnd_proc_)); |
| 520 } | 517 } |
| 521 | 518 |
| 522 plugin_->WillDestroyWindow(windowed_handle_); | 519 plugin_->WillDestroyWindow(windowed_handle_); |
| 523 | 520 |
| 524 DestroyWindow(windowed_handle_); | 521 DestroyWindow(windowed_handle_); |
| 525 TRACK_HWND_DESTRUCTION(windowed_handle_); | |
| 526 windowed_handle_ = 0; | 522 windowed_handle_ = 0; |
| 527 } | 523 } |
| 528 } | 524 } |
| 529 | 525 |
| 530 // Erase all messages in the queue destined for a particular window. | 526 // Erase all messages in the queue destined for a particular window. |
| 531 // When windows are closing, callers should use this function to clear | 527 // When windows are closing, callers should use this function to clear |
| 532 // the queue. | 528 // the queue. |
| 533 // static | 529 // static |
| 534 void WebPluginDelegateImpl::ClearThrottleQueueForWindow(HWND window) { | 530 void WebPluginDelegateImpl::ClearThrottleQueueForWindow(HWND window) { |
| 535 std::list<MSG>* throttle_queue = g_throttle_queue.Pointer(); | 531 std::list<MSG>* throttle_queue = g_throttle_queue.Pointer(); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 kDummyActivationWindowName, | 664 kDummyActivationWindowName, |
| 669 WS_CHILD, | 665 WS_CHILD, |
| 670 0, | 666 0, |
| 671 0, | 667 0, |
| 672 0, | 668 0, |
| 673 0, | 669 0, |
| 674 parent_, | 670 parent_, |
| 675 0, | 671 0, |
| 676 GetModuleHandle(NULL), | 672 GetModuleHandle(NULL), |
| 677 0); | 673 0); |
| 678 TRACK_HWND_CREATION(dummy_window_for_activation_); | |
| 679 | 674 |
| 680 if (dummy_window_for_activation_ == 0) | 675 if (dummy_window_for_activation_ == 0) |
| 681 return false; | 676 return false; |
| 682 | 677 |
| 683 // Flash creates background windows which use excessive CPU in our | 678 // Flash creates background windows which use excessive CPU in our |
| 684 // environment; we wrap these windows and throttle them so that they don't | 679 // environment; we wrap these windows and throttle them so that they don't |
| 685 // get out of hand. | 680 // get out of hand. |
| 686 if (!EnumThreadWindows(::GetCurrentThreadId(), EnumFlashWindows, | 681 if (!EnumThreadWindows(::GetCurrentThreadId(), EnumFlashWindows, |
| 687 reinterpret_cast<LPARAM>( | 682 reinterpret_cast<LPARAM>( |
| 688 &WebPluginDelegateImpl::FlashWindowlessWndProc))) { | 683 &WebPluginDelegateImpl::FlashWindowlessWndProc))) { |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 | 1183 |
| 1189 // It is ok to pass NULL here to GetCursor as we are not looking for cursor | 1184 // It is ok to pass NULL here to GetCursor as we are not looking for cursor |
| 1190 // types defined by Webkit. | 1185 // types defined by Webkit. |
| 1191 HCURSOR previous_cursor = | 1186 HCURSOR previous_cursor = |
| 1192 g_current_plugin_instance->current_windowless_cursor_.GetCursor(NULL); | 1187 g_current_plugin_instance->current_windowless_cursor_.GetCursor(NULL); |
| 1193 | 1188 |
| 1194 g_current_plugin_instance->current_windowless_cursor_.InitFromExternalCursor( | 1189 g_current_plugin_instance->current_windowless_cursor_.InitFromExternalCursor( |
| 1195 cursor); | 1190 cursor); |
| 1196 return previous_cursor; | 1191 return previous_cursor; |
| 1197 } | 1192 } |
| OLD | NEW |