OLD | NEW |
---|---|
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 #ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ |
6 #define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ | 6 #define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32 | 68 PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32 |
69 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32 | 69 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32 |
70 PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux | 70 PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux |
71 PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux | 71 PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux |
72 PLUGIN_QUIRK_NO_WINDOWLESS = 1024, // Windows | 72 PLUGIN_QUIRK_NO_WINDOWLESS = 1024, // Windows |
73 PLUGIN_QUIRK_PATCH_REGENUMKEYEXW = 2048, // Windows | 73 PLUGIN_QUIRK_PATCH_REGENUMKEYEXW = 2048, // Windows |
74 PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS = 4096, // Windows | 74 PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS = 4096, // Windows |
75 PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE = 16384, // Windows | 75 PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE = 16384, // Windows |
76 PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK = 32768, // Linux | 76 PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK = 32768, // Linux |
77 PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL = 65536, // Windows. | 77 PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL = 65536, // Windows. |
78 PLUGIN_QUIRK_REPARENT_IN_BROWSER = 131072, // Windows | 78 PLUGIN_QUIRK_EMULATE_IME = 131072, // Windows. |
ananta
2012/10/04 19:27:17
Fix indent
jschuh
2012/10/04 22:14:53
Done.
| |
79 PLUGIN_QUIRK_PATCH_GETKEYSTATE = 262144, // Windows | |
80 PLUGIN_QUIRK_EMULATE_IME = 524288, // Windows. | |
81 PLUGIN_QUIRK_PATCH_VM_API = 1048576, // Windows. | |
82 }; | 79 }; |
83 | 80 |
84 static WebPluginDelegateImpl* Create(const FilePath& filename, | 81 static WebPluginDelegateImpl* Create(const FilePath& filename, |
85 const std::string& mime_type, | 82 const std::string& mime_type, |
86 gfx::PluginWindowHandle containing_view); | 83 gfx::PluginWindowHandle containing_view); |
87 | 84 |
88 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
89 static bool IsPluginDelegateWindow(HWND window); | 86 static bool IsPluginDelegateWindow(HWND window); |
90 static bool GetPluginNameFromWindow(HWND window, | 87 static bool GetPluginNameFromWindow(HWND window, |
91 string16* plugin_name); | 88 string16* plugin_name); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 // loop like TrackPopupMenuEx or MessageBox, etc. | 365 // loop like TrackPopupMenuEx or MessageBox, etc. |
369 // This is a basic issue with windows activation and focus arising due to | 366 // This is a basic issue with windows activation and focus arising due to |
370 // the fact that these windows are created by different threads. Activation | 367 // the fact that these windows are created by different threads. Activation |
371 // and focus are thread specific states, and if the browser has focus, | 368 // and focus are thread specific states, and if the browser has focus, |
372 // the plugin may not have focus. | 369 // the plugin may not have focus. |
373 // To fix a majority of these activation issues we create a dummy visible | 370 // To fix a majority of these activation issues we create a dummy visible |
374 // child window to which we set focus whenever the windowless plugin | 371 // child window to which we set focus whenever the windowless plugin |
375 // receives a WM_LBUTTONDOWN/WM_RBUTTONDOWN message via NPP_HandleEvent. | 372 // receives a WM_LBUTTONDOWN/WM_RBUTTONDOWN message via NPP_HandleEvent. |
376 | 373 |
377 HWND dummy_window_for_activation_; | 374 HWND dummy_window_for_activation_; |
378 HWND parent_proxy_window_; | |
379 bool CreateDummyWindowForActivation(); | 375 bool CreateDummyWindowForActivation(); |
380 | 376 |
381 // Returns true if the event passed in needs to be tracked for a potential | 377 // Returns true if the event passed in needs to be tracked for a potential |
382 // modal loop. | 378 // modal loop. |
383 static bool ShouldTrackEventForModalLoops(NPEvent* event); | 379 static bool ShouldTrackEventForModalLoops(NPEvent* event); |
384 | 380 |
385 // The message filter hook procedure, which tracks modal loops entered by | 381 // The message filter hook procedure, which tracks modal loops entered by |
386 // a plugin in the course of a NPP_HandleEvent call. | 382 // a plugin in the course of a NPP_HandleEvent call. |
387 static LRESULT CALLBACK HandleEventMessageFilterHook(int code, WPARAM wParam, | 383 static LRESULT CALLBACK HandleEventMessageFilterHook(int code, WPARAM wParam, |
388 LPARAM lParam); | 384 LPARAM lParam); |
389 | 385 |
390 // TrackPopupMenu interceptor. Parameters are the same as the Win32 function | 386 // TrackPopupMenu interceptor. Parameters are the same as the Win32 function |
391 // TrackPopupMenu. | 387 // TrackPopupMenu. |
392 static BOOL WINAPI TrackPopupMenuPatch(HMENU menu, unsigned int flags, int x, | 388 static BOOL WINAPI TrackPopupMenuPatch(HMENU menu, unsigned int flags, int x, |
393 int y, int reserved, HWND window, | 389 int y, int reserved, HWND window, |
394 const RECT* rect); | 390 const RECT* rect); |
395 | 391 |
396 // SetCursor interceptor for windowless plugins. | 392 // SetCursor interceptor for windowless plugins. |
397 static HCURSOR WINAPI SetCursorPatch(HCURSOR cursor); | 393 static HCURSOR WINAPI SetCursorPatch(HCURSOR cursor); |
398 | 394 |
399 // GetKeyStatePatch interceptor for UIPI Flash plugin. | |
400 static SHORT WINAPI GetKeyStatePatch(int vkey); | |
401 | |
402 static BOOL WINAPI VirtualProtectPatch(LPVOID address, | |
403 SIZE_T size, | |
404 DWORD new_protect, | |
405 PDWORD old_protect); | |
406 | |
407 static BOOL WINAPI VirtualFreePatch(LPVOID address, | |
408 SIZE_T size, | |
409 DWORD free_type); | |
410 | |
411 // RegEnumKeyExW interceptor. | 395 // RegEnumKeyExW interceptor. |
412 static LONG WINAPI RegEnumKeyExWPatch( | 396 static LONG WINAPI RegEnumKeyExWPatch( |
413 HKEY key, DWORD index, LPWSTR name, LPDWORD name_size, LPDWORD reserved, | 397 HKEY key, DWORD index, LPWSTR name, LPDWORD name_size, LPDWORD reserved, |
414 LPWSTR class_name, LPDWORD class_size, PFILETIME last_write_time); | 398 LPWSTR class_name, LPDWORD class_size, PFILETIME last_write_time); |
415 | 399 |
416 // GetProcAddress intercepter for windowless plugins. | 400 // GetProcAddress intercepter for windowless plugins. |
417 static FARPROC WINAPI GetProcAddressPatch(HMODULE module, LPCSTR name); | 401 static FARPROC WINAPI GetProcAddressPatch(HMODULE module, LPCSTR name); |
418 | 402 |
419 // The mouse hook proc which handles mouse capture in windowed plugins. | 403 // The mouse hook proc which handles mouse capture in windowed plugins. |
420 static LRESULT CALLBACK MouseHookProc(int code, WPARAM wParam, | 404 static LRESULT CALLBACK MouseHookProc(int code, WPARAM wParam, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
524 // True if NPP_New did not return an error. | 508 // True if NPP_New did not return an error. |
525 bool creation_succeeded_; | 509 bool creation_succeeded_; |
526 | 510 |
527 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); | 511 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); |
528 }; | 512 }; |
529 | 513 |
530 } // namespace npapi | 514 } // namespace npapi |
531 } // namespace webkit | 515 } // namespace webkit |
532 | 516 |
533 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ | 517 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ |
OLD | NEW |