| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/plugins/npapi/webplugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "app/win/iat_patch_function.h" | 11 #include "app/win/iat_patch_function.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/metrics/stats_counters.h" | 15 #include "base/metrics/stats_counters.h" |
| 16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
| 18 #include "base/string_split.h" | 18 #include "base/string_split.h" |
| 19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "base/stringprintf.h" | 20 #include "base/stringprintf.h" |
| 21 #include "base/win/registry.h" | 21 #include "base/win/registry.h" |
| 22 #include "base/win/windows_version.h" | 22 #include "base/win/windows_version.h" |
| 23 #include "skia/ext/platform_canvas.h" | 23 #include "skia/ext/platform_canvas.h" |
| 24 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" | 24 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" |
| 25 #include "webkit/glue/plugins/default_plugin_shared.h" | |
| 26 #include "webkit/glue/plugins/plugin_constants_win.h" | |
| 27 #include "webkit/glue/plugins/plugin_instance.h" | |
| 28 #include "webkit/glue/plugins/plugin_lib.h" | |
| 29 #include "webkit/glue/plugins/plugin_list.h" | |
| 30 #include "webkit/glue/plugins/plugin_stream_url.h" | |
| 31 #include "webkit/glue/plugins/webplugin.h" | |
| 32 #include "webkit/glue/webkit_glue.h" | 25 #include "webkit/glue/webkit_glue.h" |
| 26 #include "webkit/plugins/npapi/default_plugin_shared.h" |
| 27 #include "webkit/plugins/npapi/plugin_constants_win.h" |
| 28 #include "webkit/plugins/npapi/plugin_instance.h" |
| 29 #include "webkit/plugins/npapi/plugin_lib.h" |
| 30 #include "webkit/plugins/npapi/plugin_list.h" |
| 31 #include "webkit/plugins/npapi/plugin_stream_url.h" |
| 32 #include "webkit/plugins/npapi/webplugin.h" |
| 33 | 33 |
| 34 using WebKit::WebCursorInfo; | 34 using WebKit::WebCursorInfo; |
| 35 using WebKit::WebKeyboardEvent; | 35 using WebKit::WebKeyboardEvent; |
| 36 using WebKit::WebInputEvent; | 36 using WebKit::WebInputEvent; |
| 37 using WebKit::WebMouseEvent; | 37 using WebKit::WebMouseEvent; |
| 38 | 38 |
| 39 namespace webkit { |
| 40 namespace npapi { |
| 41 |
| 39 namespace { | 42 namespace { |
| 40 | 43 |
| 41 const wchar_t kWebPluginDelegateProperty[] = L"WebPluginDelegateProperty"; | 44 const wchar_t kWebPluginDelegateProperty[] = L"WebPluginDelegateProperty"; |
| 42 const wchar_t kPluginNameAtomProperty[] = L"PluginNameAtom"; | 45 const wchar_t kPluginNameAtomProperty[] = L"PluginNameAtom"; |
| 43 const wchar_t kDummyActivationWindowName[] = L"DummyWindowForActivation"; | 46 const wchar_t kDummyActivationWindowName[] = L"DummyWindowForActivation"; |
| 44 const wchar_t kPluginFlashThrottle[] = L"FlashThrottle"; | 47 const wchar_t kPluginFlashThrottle[] = L"FlashThrottle"; |
| 45 | 48 |
| 46 // The fastest we are willing to process WM_USER+1 events for Flash. | 49 // The fastest we are willing to process WM_USER+1 events for Flash. |
| 47 // Flash can easily exceed the limits of our CPU if we don't throttle it. | 50 // Flash can easily exceed the limits of our CPU if we don't throttle it. |
| 48 // The throttle has been chosen by testing various delays and compromising | 51 // The throttle has been chosen by testing various delays and compromising |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 MOUSEHOOKSTRUCT* hook_struct = reinterpret_cast<MOUSEHOOKSTRUCT*>(lParam); | 242 MOUSEHOOKSTRUCT* hook_struct = reinterpret_cast<MOUSEHOOKSTRUCT*>(lParam); |
| 240 if (hook_struct) | 243 if (hook_struct) |
| 241 HandleCaptureForMessage(hook_struct->hwnd, wParam); | 244 HandleCaptureForMessage(hook_struct->hwnd, wParam); |
| 242 } | 245 } |
| 243 | 246 |
| 244 return CallNextHookEx(NULL, code, wParam, lParam); | 247 return CallNextHookEx(NULL, code, wParam, lParam); |
| 245 } | 248 } |
| 246 | 249 |
| 247 WebPluginDelegateImpl::WebPluginDelegateImpl( | 250 WebPluginDelegateImpl::WebPluginDelegateImpl( |
| 248 gfx::PluginWindowHandle containing_view, | 251 gfx::PluginWindowHandle containing_view, |
| 249 NPAPI::PluginInstance *instance) | 252 PluginInstance *instance) |
| 250 : parent_(containing_view), | 253 : parent_(containing_view), |
| 251 instance_(instance), | 254 instance_(instance), |
| 252 quirks_(0), | 255 quirks_(0), |
| 253 plugin_(NULL), | 256 plugin_(NULL), |
| 254 windowless_(false), | 257 windowless_(false), |
| 255 windowed_handle_(NULL), | 258 windowed_handle_(NULL), |
| 256 windowed_did_set_window_(false), | 259 windowed_did_set_window_(false), |
| 257 plugin_wnd_proc_(NULL), | 260 plugin_wnd_proc_(NULL), |
| 258 last_message_(0), | 261 last_message_(0), |
| 259 is_calling_wndproc(false), | 262 is_calling_wndproc(false), |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); | 523 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); |
| 521 SetParent(windowed_handle_, parent_); | 524 SetParent(windowed_handle_, parent_); |
| 522 } | 525 } |
| 523 | 526 |
| 524 BOOL result = SetProp(windowed_handle_, kWebPluginDelegateProperty, this); | 527 BOOL result = SetProp(windowed_handle_, kWebPluginDelegateProperty, this); |
| 525 DCHECK(result == TRUE) << "SetProp failed, last error = " << GetLastError(); | 528 DCHECK(result == TRUE) << "SetProp failed, last error = " << GetLastError(); |
| 526 // Get the name of the plugin, create an atom and set that in a window | 529 // Get the name of the plugin, create an atom and set that in a window |
| 527 // property. Use an atom so that other processes can access the name of | 530 // property. Use an atom so that other processes can access the name of |
| 528 // the plugin that this window is hosting | 531 // the plugin that this window is hosting |
| 529 if (instance_ != NULL) { | 532 if (instance_ != NULL) { |
| 530 NPAPI::PluginLib* plugin_lib = instance()->plugin_lib(); | 533 PluginLib* plugin_lib = instance()->plugin_lib(); |
| 531 if (plugin_lib != NULL) { | 534 if (plugin_lib != NULL) { |
| 532 std::wstring plugin_name = plugin_lib->plugin_info().name; | 535 std::wstring plugin_name = plugin_lib->plugin_info().name; |
| 533 if (!plugin_name.empty()) { | 536 if (!plugin_name.empty()) { |
| 534 ATOM plugin_name_atom = GlobalAddAtomW(plugin_name.c_str()); | 537 ATOM plugin_name_atom = GlobalAddAtomW(plugin_name.c_str()); |
| 535 DCHECK(0 != plugin_name_atom); | 538 DCHECK(0 != plugin_name_atom); |
| 536 result = SetProp(windowed_handle_, | 539 result = SetProp(windowed_handle_, |
| 537 kPluginNameAtomProperty, | 540 kPluginNameAtomProperty, |
| 538 reinterpret_cast<HANDLE>(plugin_name_atom)); | 541 reinterpret_cast<HANDLE>(plugin_name_atom)); |
| 539 DCHECK(result == TRUE) << "SetProp failed, last error = " << | 542 DCHECK(result == TRUE) << "SetProp failed, last error = " << |
| 540 GetLastError(); | 543 GetLastError(); |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 case WM_LBUTTONUP: | 1404 case WM_LBUTTONUP: |
| 1402 case WM_MBUTTONUP: | 1405 case WM_MBUTTONUP: |
| 1403 case WM_RBUTTONUP: | 1406 case WM_RBUTTONUP: |
| 1404 ::ReleaseCapture(); | 1407 ::ReleaseCapture(); |
| 1405 break; | 1408 break; |
| 1406 | 1409 |
| 1407 default: | 1410 default: |
| 1408 break; | 1411 break; |
| 1409 } | 1412 } |
| 1410 } | 1413 } |
| 1414 |
| 1415 } // namespace npapi |
| 1416 } // namespace webkit |
| OLD | NEW |