| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/plugins/npapi/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 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Flash displays popups in response to user clicks by posting a WM_USER | 65 // Flash displays popups in response to user clicks by posting a WM_USER |
| 66 // message to the plugin window. The handler for this message displays | 66 // message to the plugin window. The handler for this message displays |
| 67 // the popup. To ensure that the popups allowed state is sent correctly | 67 // the popup. To ensure that the popups allowed state is sent correctly |
| 68 // to the renderer we reset the popups allowed state in a timer. | 68 // to the renderer we reset the popups allowed state in a timer. |
| 69 const int kWindowedPluginPopupTimerMs = 50; | 69 const int kWindowedPluginPopupTimerMs = 50; |
| 70 | 70 |
| 71 // The current instance of the plugin which entered the modal loop. | 71 // The current instance of the plugin which entered the modal loop. |
| 72 WebPluginDelegateImpl* g_current_plugin_instance = NULL; | 72 WebPluginDelegateImpl* g_current_plugin_instance = NULL; |
| 73 | 73 |
| 74 typedef std::deque<MSG> ThrottleQueue; | 74 typedef std::deque<MSG> ThrottleQueue; |
| 75 base::LazyInstance<ThrottleQueue> g_throttle_queue(base::LINKER_INITIALIZED); | 75 base::LazyInstance<ThrottleQueue> g_throttle_queue = LAZY_INSTANCE_INITIALIZER; |
| 76 base::LazyInstance<std::map<HWND, WNDPROC> > g_window_handle_proc_map( | |
| 77 base::LINKER_INITIALIZED); | |
| 78 | 76 |
| 77 base::LazyInstance<std::map<HWND, WNDPROC> > g_window_handle_proc_map = |
| 78 LAZY_INSTANCE_INITIALIZER; |
| 79 | 79 |
| 80 // Helper object for patching the TrackPopupMenu API. | 80 // Helper object for patching the TrackPopupMenu API. |
| 81 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_track_popup_menu( | 81 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_track_popup_menu = |
| 82 base::LINKER_INITIALIZED); | 82 LAZY_INSTANCE_INITIALIZER; |
| 83 | 83 |
| 84 // Helper object for patching the SetCursor API. | 84 // Helper object for patching the SetCursor API. |
| 85 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_set_cursor( | 85 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_set_cursor = |
| 86 base::LINKER_INITIALIZED); | 86 LAZY_INSTANCE_INITIALIZER; |
| 87 | 87 |
| 88 // Helper object for patching the RegEnumKeyExW API. | 88 // Helper object for patching the RegEnumKeyExW API. |
| 89 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_reg_enum_key_ex_w( | 89 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_reg_enum_key_ex_w = |
| 90 base::LINKER_INITIALIZED); | 90 LAZY_INSTANCE_INITIALIZER; |
| 91 | 91 |
| 92 // Helper object for patching the GetProcAddress API. | 92 // Helper object for patching the GetProcAddress API. |
| 93 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_proc_address( | 93 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_proc_address = |
| 94 base::LINKER_INITIALIZED); | 94 LAZY_INSTANCE_INITIALIZER; |
| 95 | 95 |
| 96 // Helper object for patching the GetKeyState API. | 96 // Helper object for patching the GetKeyState API. |
| 97 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_key_state( | 97 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_key_state = |
| 98 base::LINKER_INITIALIZED); | 98 LAZY_INSTANCE_INITIALIZER; |
| 99 | 99 |
| 100 // Saved key state globals and helper access functions. | 100 // Saved key state globals and helper access functions. |
| 101 SHORT (WINAPI *g_iat_orig_get_key_state)(int vkey); | 101 SHORT (WINAPI *g_iat_orig_get_key_state)(int vkey); |
| 102 typedef size_t SavedStateType; | 102 typedef size_t SavedStateType; |
| 103 const size_t kBitsPerType = sizeof(SavedStateType) * 8; | 103 const size_t kBitsPerType = sizeof(SavedStateType) * 8; |
| 104 // Bit array of key state corresponding to virtual key index (0=up, 1=down). | 104 // Bit array of key state corresponding to virtual key index (0=up, 1=down). |
| 105 SavedStateType g_saved_key_state[256 / kBitsPerType]; | 105 SavedStateType g_saved_key_state[256 / kBitsPerType]; |
| 106 | 106 |
| 107 bool GetSavedKeyState(WPARAM vkey) { | 107 bool GetSavedKeyState(WPARAM vkey) { |
| 108 CHECK_LT(vkey, kBitsPerType * sizeof(g_saved_key_state)); | 108 CHECK_LT(vkey, kBitsPerType * sizeof(g_saved_key_state)); |
| (...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1565 ::ReleaseCapture(); | 1565 ::ReleaseCapture(); |
| 1566 break; | 1566 break; |
| 1567 | 1567 |
| 1568 default: | 1568 default: |
| 1569 break; | 1569 break; |
| 1570 } | 1570 } |
| 1571 } | 1571 } |
| 1572 | 1572 |
| 1573 } // namespace npapi | 1573 } // namespace npapi |
| 1574 } // namespace webkit | 1574 } // namespace webkit |
| OLD | NEW |