| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 : parent_(containing_view), | 263 : parent_(containing_view), |
| 264 instance_(instance), | 264 instance_(instance), |
| 265 quirks_(0), | 265 quirks_(0), |
| 266 plugin_(NULL), | 266 plugin_(NULL), |
| 267 windowless_(false), | 267 windowless_(false), |
| 268 windowed_handle_(NULL), | 268 windowed_handle_(NULL), |
| 269 windowed_did_set_window_(false), | 269 windowed_did_set_window_(false), |
| 270 plugin_wnd_proc_(NULL), | 270 plugin_wnd_proc_(NULL), |
| 271 last_message_(0), | 271 last_message_(0), |
| 272 is_calling_wndproc(false), | 272 is_calling_wndproc(false), |
| 273 keyboard_layout_(NULL), | |
| 274 parent_thread_id_(0), | |
| 275 dummy_window_for_activation_(NULL), | 273 dummy_window_for_activation_(NULL), |
| 276 handle_event_message_filter_hook_(NULL), | 274 handle_event_message_filter_hook_(NULL), |
| 277 handle_event_pump_messages_event_(NULL), | 275 handle_event_pump_messages_event_(NULL), |
| 278 user_gesture_message_posted_(false), | 276 user_gesture_message_posted_(false), |
| 279 #pragma warning(suppress: 4355) // can use this | 277 #pragma warning(suppress: 4355) // can use this |
| 280 user_gesture_msg_factory_(this), | 278 user_gesture_msg_factory_(this), |
| 281 handle_event_depth_(0), | 279 handle_event_depth_(0), |
| 282 mouse_hook_(NULL), | 280 mouse_hook_(NULL), |
| 283 first_set_window_call_(true), | 281 first_set_window_call_(true), |
| 284 plugin_has_focus_(false), | 282 plugin_has_focus_(false), |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 | 1178 |
| 1181 bool WebPluginDelegateImpl::PlatformHandleInputEvent( | 1179 bool WebPluginDelegateImpl::PlatformHandleInputEvent( |
| 1182 const WebInputEvent& event, WebCursorInfo* cursor_info) { | 1180 const WebInputEvent& event, WebCursorInfo* cursor_info) { |
| 1183 DCHECK(cursor_info != NULL); | 1181 DCHECK(cursor_info != NULL); |
| 1184 | 1182 |
| 1185 NPEvent np_event; | 1183 NPEvent np_event; |
| 1186 if (!NPEventFromWebInputEvent(event, &np_event)) { | 1184 if (!NPEventFromWebInputEvent(event, &np_event)) { |
| 1187 return false; | 1185 return false; |
| 1188 } | 1186 } |
| 1189 | 1187 |
| 1190 // Synchronize the keyboard layout with the one of the browser process. Flash | |
| 1191 // uses the keyboard layout of this window to verify a WM_CHAR message is | |
| 1192 // valid. That is, Flash discards a WM_CHAR message unless its character is | |
| 1193 // the one translated with ToUnicode(). (Since a plug-in is running on a | |
| 1194 // separate process from the browser process, we need to syncronize it | |
| 1195 // manually.) | |
| 1196 if (np_event.event == WM_CHAR) { | |
| 1197 if (!keyboard_layout_) | |
| 1198 keyboard_layout_ = GetKeyboardLayout(GetCurrentThreadId()); | |
| 1199 if (!parent_thread_id_) | |
| 1200 parent_thread_id_ = GetWindowThreadProcessId(parent_, NULL); | |
| 1201 HKL parent_layout = GetKeyboardLayout(parent_thread_id_); | |
| 1202 if (keyboard_layout_ != parent_layout) { | |
| 1203 std::wstring layout_name(base::StringPrintf(L"%08x", parent_layout)); | |
| 1204 LoadKeyboardLayout(layout_name.c_str(), KLF_ACTIVATE); | |
| 1205 keyboard_layout_ = parent_layout; | |
| 1206 } | |
| 1207 } | |
| 1208 | |
| 1209 HWND last_focus_window = NULL; | 1188 HWND last_focus_window = NULL; |
| 1210 | 1189 |
| 1211 if (ShouldTrackEventForModalLoops(&np_event)) { | 1190 if (ShouldTrackEventForModalLoops(&np_event)) { |
| 1212 // A windowless plugin can enter a modal loop in a NPP_HandleEvent call. | 1191 // A windowless plugin can enter a modal loop in a NPP_HandleEvent call. |
| 1213 // For e.g. Flash puts up a context menu when we right click on the | 1192 // For e.g. Flash puts up a context menu when we right click on the |
| 1214 // windowless plugin area. We detect this by setting up a message filter | 1193 // windowless plugin area. We detect this by setting up a message filter |
| 1215 // hook pror to calling NPP_HandleEvent on the plugin and unhook on | 1194 // hook pror to calling NPP_HandleEvent on the plugin and unhook on |
| 1216 // return from NPP_HandleEvent. If the plugin does enter a modal loop | 1195 // return from NPP_HandleEvent. If the plugin does enter a modal loop |
| 1217 // in that context we unhook on receiving the first notification in | 1196 // in that context we unhook on receiving the first notification in |
| 1218 // the message filter hook. | 1197 // the message filter hook. |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 ::ReleaseCapture(); | 1396 ::ReleaseCapture(); |
| 1418 break; | 1397 break; |
| 1419 | 1398 |
| 1420 default: | 1399 default: |
| 1421 break; | 1400 break; |
| 1422 } | 1401 } |
| 1423 } | 1402 } |
| 1424 | 1403 |
| 1425 } // namespace npapi | 1404 } // namespace npapi |
| 1426 } // namespace webkit | 1405 } // namespace webkit |
| OLD | NEW |