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" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Helper object for patching the TrackPopupMenu API. | 51 // Helper object for patching the TrackPopupMenu API. |
52 base::LazyInstance<iat_patch::IATPatchFunction> g_iat_patch_track_popup_menu( | 52 base::LazyInstance<iat_patch::IATPatchFunction> g_iat_patch_track_popup_menu( |
53 base::LINKER_INITIALIZED); | 53 base::LINKER_INITIALIZED); |
54 | 54 |
55 // Helper object for patching the SetCursor API. | 55 // Helper object for patching the SetCursor API. |
56 base::LazyInstance<iat_patch::IATPatchFunction> g_iat_patch_set_cursor( | 56 base::LazyInstance<iat_patch::IATPatchFunction> g_iat_patch_set_cursor( |
57 base::LINKER_INITIALIZED); | 57 base::LINKER_INITIALIZED); |
58 | 58 |
59 } // namespace | 59 } // namespace |
60 | 60 |
61 WebPluginDelegateImpl* WebPluginDelegateImpl::Create( | 61 WebPluginDelegate* WebPluginDelegate::Create( |
62 const FilePath& filename, | 62 const FilePath& filename, |
63 const std::string& mime_type, | 63 const std::string& mime_type, |
64 gfx::NativeView containing_view) { | 64 gfx::NativeView containing_view) { |
65 scoped_refptr<NPAPI::PluginLib> plugin = | 65 scoped_refptr<NPAPI::PluginLib> plugin = |
66 NPAPI::PluginLib::CreatePluginLib(filename); | 66 NPAPI::PluginLib::CreatePluginLib(filename); |
67 if (plugin.get() == NULL) | 67 if (plugin.get() == NULL) |
68 return NULL; | 68 return NULL; |
69 | 69 |
70 NPError err = plugin->NP_Initialize(); | 70 NPError err = plugin->NP_Initialize(); |
71 if (err != NPERR_NO_ERROR) | 71 if (err != NPERR_NO_ERROR) |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 LRESULT CALLBACK WebPluginDelegateImpl::NativeWndProc( | 793 LRESULT CALLBACK WebPluginDelegateImpl::NativeWndProc( |
794 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { | 794 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { |
795 WebPluginDelegateImpl* delegate = reinterpret_cast<WebPluginDelegateImpl*>( | 795 WebPluginDelegateImpl* delegate = reinterpret_cast<WebPluginDelegateImpl*>( |
796 GetProp(hwnd, kWebPluginDelegateProperty)); | 796 GetProp(hwnd, kWebPluginDelegateProperty)); |
797 if (!delegate) { | 797 if (!delegate) { |
798 NOTREACHED(); | 798 NOTREACHED(); |
799 return 0; | 799 return 0; |
800 } | 800 } |
801 | 801 |
802 if (message == delegate->last_message_ && | 802 if (message == delegate->last_message_ && |
803 delegate->quirks() & PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY && | 803 delegate->GetQuirks() & PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY && |
804 delegate->is_calling_wndproc) { | 804 delegate->is_calling_wndproc) { |
805 // Real may go into a state where it recursively dispatches the same event | 805 // Real may go into a state where it recursively dispatches the same event |
806 // when subclassed. See https://bugzilla.mozilla.org/show_bug.cgi?id=192914 | 806 // when subclassed. See https://bugzilla.mozilla.org/show_bug.cgi?id=192914 |
807 // We only do the recursive check for Real because it's possible and valid | 807 // We only do the recursive check for Real because it's possible and valid |
808 // for a plugin to synchronously dispatch a message to itself such that it | 808 // for a plugin to synchronously dispatch a message to itself such that it |
809 // looks like it's in recursion. | 809 // looks like it's in recursion. |
810 return TRUE; | 810 return TRUE; |
811 } | 811 } |
812 | 812 |
813 static UINT custom_msg = RegisterWindowMessage(kPaintMessageName); | 813 static UINT custom_msg = RegisterWindowMessage(kPaintMessageName); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 RemoveProp(hwnd, kPluginNameAtomProperty)); | 845 RemoveProp(hwnd, kPluginNameAtomProperty)); |
846 if (plugin_name_atom != 0) | 846 if (plugin_name_atom != 0) |
847 GlobalDeleteAtom(plugin_name_atom); | 847 GlobalDeleteAtom(plugin_name_atom); |
848 ClearThrottleQueueForWindow(hwnd); | 848 ClearThrottleQueueForWindow(hwnd); |
849 break; | 849 break; |
850 } | 850 } |
851 // Flash may flood the message queue with WM_USER+1 message causing 100% CPU | 851 // Flash may flood the message queue with WM_USER+1 message causing 100% CPU |
852 // usage. See https://bugzilla.mozilla.org/show_bug.cgi?id=132759. We | 852 // usage. See https://bugzilla.mozilla.org/show_bug.cgi?id=132759. We |
853 // prevent this by throttling the messages. | 853 // prevent this by throttling the messages. |
854 case WM_USER + 1: { | 854 case WM_USER + 1: { |
855 if (delegate->quirks() & PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE) { | 855 if (delegate->GetQuirks() & PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE) { |
856 WebPluginDelegateImpl::ThrottleMessage(delegate->plugin_wnd_proc_, hwnd, | 856 WebPluginDelegateImpl::ThrottleMessage(delegate->plugin_wnd_proc_, hwnd, |
857 message, wparam, lparam); | 857 message, wparam, lparam); |
858 g_current_plugin_instance = last_plugin_instance; | 858 g_current_plugin_instance = last_plugin_instance; |
859 return FALSE; | 859 return FALSE; |
860 } | 860 } |
861 break; | 861 break; |
862 } | 862 } |
863 default: { | 863 default: { |
864 break; | 864 break; |
865 } | 865 } |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 } | 1165 } |
1166 | 1166 |
1167 HCURSOR WINAPI WebPluginDelegateImpl::SetCursorPatch(HCURSOR cursor) { | 1167 HCURSOR WINAPI WebPluginDelegateImpl::SetCursorPatch(HCURSOR cursor) { |
1168 // The windowless flash plugin periodically calls SetCursor in a wndproc | 1168 // The windowless flash plugin periodically calls SetCursor in a wndproc |
1169 // instantiated on the plugin thread. This causes annoying cursor flicker | 1169 // instantiated on the plugin thread. This causes annoying cursor flicker |
1170 // when the mouse is moved on a foreground tab, with a windowless plugin | 1170 // when the mouse is moved on a foreground tab, with a windowless plugin |
1171 // instance in a background tab. We just ignore the call here. | 1171 // instance in a background tab. We just ignore the call here. |
1172 if (!g_current_plugin_instance) | 1172 if (!g_current_plugin_instance) |
1173 return GetCursor(); | 1173 return GetCursor(); |
1174 | 1174 |
1175 if (!g_current_plugin_instance->windowless()) { | 1175 if (!g_current_plugin_instance->IsWindowless()) { |
1176 return SetCursor(cursor); | 1176 return SetCursor(cursor); |
1177 } | 1177 } |
1178 | 1178 |
1179 // It is ok to pass NULL here to GetCursor as we are not looking for cursor | 1179 // It is ok to pass NULL here to GetCursor as we are not looking for cursor |
1180 // types defined by Webkit. | 1180 // types defined by Webkit. |
1181 HCURSOR previous_cursor = | 1181 HCURSOR previous_cursor = |
1182 g_current_plugin_instance->current_windowless_cursor_.GetCursor(NULL); | 1182 g_current_plugin_instance->current_windowless_cursor_.GetCursor(NULL); |
1183 | 1183 |
1184 g_current_plugin_instance->current_windowless_cursor_.InitFromExternalCursor( | 1184 g_current_plugin_instance->current_windowless_cursor_.InitFromExternalCursor( |
1185 cursor); | 1185 cursor); |
1186 return previous_cursor; | 1186 return previous_cursor; |
1187 } | 1187 } |
OLD | NEW |