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 #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ | 5 #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ |
6 #define WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ | 6 #define WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 bool CreateDummyWindowForActivation(); | 263 bool CreateDummyWindowForActivation(); |
264 | 264 |
265 // Returns true if the event passed in needs to be tracked for a potential | 265 // Returns true if the event passed in needs to be tracked for a potential |
266 // modal loop. | 266 // modal loop. |
267 static bool ShouldTrackEventForModalLoops(NPEvent* event); | 267 static bool ShouldTrackEventForModalLoops(NPEvent* event); |
268 | 268 |
269 // The message filter hook procedure, which tracks modal loops entered by | 269 // The message filter hook procedure, which tracks modal loops entered by |
270 // a plugin in the course of a NPP_HandleEvent call. | 270 // a plugin in the course of a NPP_HandleEvent call. |
271 static LRESULT CALLBACK HandleEventMessageFilterHook(int code, WPARAM wParam, | 271 static LRESULT CALLBACK HandleEventMessageFilterHook(int code, WPARAM wParam, |
272 LPARAM lParam); | 272 LPARAM lParam); |
| 273 |
| 274 // TrackPopupMenu interceptor. Parameters are the same as the Win32 function |
| 275 // TrackPopupMenu. |
| 276 static BOOL WINAPI TrackPopupMenuPatch(HMENU menu, unsigned int flags, int x, |
| 277 int y, int reserved, HWND window, |
| 278 const RECT* rect); |
| 279 |
| 280 // SetCursor interceptor for windowless plugins. |
| 281 static HCURSOR WINAPI SetCursorPatch(HCURSOR cursor); |
| 282 |
| 283 // RegEnumKeyExW interceptor. |
| 284 static LONG WINAPI RegEnumKeyExWPatch( |
| 285 HKEY key, DWORD index, LPWSTR name, LPDWORD name_size, LPDWORD reserved, |
| 286 LPWSTR class_name, LPDWORD class_size, PFILETIME last_write_time); |
| 287 |
| 288 #elif defined(OS_MACOSX) |
| 289 |
| 290 // Indicates that it's time to send the plugin a null event. |
| 291 void OnNullEvent(); |
| 292 |
| 293 // Runnable Method Factory used to drip null events into the plugin. |
| 294 ScopedRunnableMethodFactory<WebPluginDelegateImpl> null_event_factory_; |
| 295 |
| 296 // Last mouse position within the plugin's rect (used for null events). |
| 297 int last_mouse_x_; |
| 298 int last_mouse_y_; |
273 #endif | 299 #endif |
| 300 |
274 // Called by the message filter hook when the plugin enters a modal loop. | 301 // Called by the message filter hook when the plugin enters a modal loop. |
275 void OnModalLoopEntered(); | 302 void OnModalLoopEntered(); |
276 | 303 |
277 // Returns true if the message passed in corresponds to a user gesture. | 304 // Returns true if the message passed in corresponds to a user gesture. |
278 static bool IsUserGestureMessage(unsigned int message); | 305 static bool IsUserGestureMessage(unsigned int message); |
279 | 306 |
280 // Indicates the end of a user gesture period. | 307 // Indicates the end of a user gesture period. |
281 void OnUserGestureEnd(); | 308 void OnUserGestureEnd(); |
282 | 309 |
283 // The url with which the plugin was instantiated. | 310 // The url with which the plugin was instantiated. |
284 std::string plugin_url_; | 311 std::string plugin_url_; |
285 | 312 |
286 #if defined(OS_WIN) | 313 #if defined(OS_WIN) |
287 // Handle to the message filter hook | 314 // Handle to the message filter hook |
288 HHOOK handle_event_message_filter_hook_; | 315 HHOOK handle_event_message_filter_hook_; |
289 #endif | |
290 | 316 |
291 // Event which is set when the plugin enters a modal loop in the course | 317 // Event which is set when the plugin enters a modal loop in the course |
292 // of a NPP_HandleEvent call. | 318 // of a NPP_HandleEvent call. |
293 #if defined(OS_WIN) | |
294 HANDLE handle_event_pump_messages_event_; | 319 HANDLE handle_event_pump_messages_event_; |
295 #endif | 320 #endif |
296 | 321 |
297 // Holds the depth of the HandleEvent callstack. | 322 // Holds the depth of the HandleEvent callstack. |
298 int handle_event_depth_; | 323 int handle_event_depth_; |
299 | 324 |
300 // This flag indicates whether we started tracking a user gesture message. | 325 // This flag indicates whether we started tracking a user gesture message. |
301 bool user_gesture_message_posted_; | 326 bool user_gesture_message_posted_; |
302 | 327 |
303 // Runnable Method Factory used to invoke the OnUserGestureEnd method | 328 // Runnable Method Factory used to invoke the OnUserGestureEnd method |
304 // asynchronously. | 329 // asynchronously. |
305 #if !defined(USE_X11) | 330 #if !defined(USE_X11) |
306 ScopedRunnableMethodFactory<WebPluginDelegateImpl> user_gesture_msg_factory_; | 331 ScopedRunnableMethodFactory<WebPluginDelegateImpl> user_gesture_msg_factory_; |
307 #endif | 332 #endif |
308 | 333 |
309 #if defined(OS_WIN) | |
310 // TrackPopupMenu interceptor. Parameters are the same as the Win32 function | |
311 // TrackPopupMenu. | |
312 static BOOL WINAPI TrackPopupMenuPatch(HMENU menu, unsigned int flags, int x, | |
313 int y, int reserved, HWND window, | |
314 const RECT* rect); | |
315 | |
316 // SetCursor interceptor for windowless plugins. | |
317 static HCURSOR WINAPI SetCursorPatch(HCURSOR cursor); | |
318 | |
319 // RegEnumKeyExW interceptor. | |
320 static LONG WINAPI RegEnumKeyExWPatch( | |
321 HKEY key, DWORD index, LPWSTR name, LPDWORD name_size, LPDWORD reserved, | |
322 LPWSTR class_name, LPDWORD class_size, PFILETIME last_write_time); | |
323 #endif | |
324 | |
325 #if defined(OS_MACOSX) | |
326 // Runnable Method Factory used to drip null events into the plugin | |
327 ScopedRunnableMethodFactory<WebPluginDelegateImpl> null_event_factory_; | |
328 | |
329 // indicates that it's time to send the plugin a null event | |
330 void OnNullEvent(); | |
331 | |
332 // last mouse position within the plugin's rect (used for null events) | |
333 int last_mouse_x_; | |
334 int last_mouse_y_; | |
335 #endif | |
336 | |
337 // Holds the current cursor set by the windowless plugin. | 334 // Holds the current cursor set by the windowless plugin. |
338 WebCursor current_windowless_cursor_; | 335 WebCursor current_windowless_cursor_; |
339 | 336 |
340 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); | 337 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); |
341 }; | 338 }; |
342 | 339 |
343 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ | 340 #endif // WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ |
OLD | NEW |