| 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 #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 <list> | 9 #include <list> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 class PluginInstance; | 48 class PluginInstance; |
| 49 | 49 |
| 50 #if defined(OS_MACOSX) | 50 #if defined(OS_MACOSX) |
| 51 class WebPluginAcceleratedSurface; | 51 class WebPluginAcceleratedSurface; |
| 52 class ExternalDragTracker; | 52 class ExternalDragTracker; |
| 53 #ifndef NP_NO_QUICKDRAW | 53 #ifndef NP_NO_QUICKDRAW |
| 54 class QuickDrawDrawingManager; | 54 class QuickDrawDrawingManager; |
| 55 #endif // NP_NO_QUICKDRAW | 55 #endif // NP_NO_QUICKDRAW |
| 56 #endif // OS_MACOSX | 56 #endif // OS_MACOSX |
| 57 | 57 |
| 58 #if defined(OS_WIN) |
| 59 class WebPluginIMEWin; |
| 60 #endif // OS_WIN |
| 61 |
| 58 // An implementation of WebPluginDelegate that runs in the plugin process, | 62 // An implementation of WebPluginDelegate that runs in the plugin process, |
| 59 // proxied from the renderer by WebPluginDelegateProxy. | 63 // proxied from the renderer by WebPluginDelegateProxy. |
| 60 class WebPluginDelegateImpl : public WebPluginDelegate { | 64 class WebPluginDelegateImpl : public WebPluginDelegate { |
| 61 public: | 65 public: |
| 62 enum PluginQuirks { | 66 enum PluginQuirks { |
| 63 PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32 | 67 PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32 |
| 64 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32 | 68 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32 |
| 65 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32 | 69 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32 |
| 66 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32 | 70 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32 |
| 67 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32 | 71 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32 |
| 68 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32 | 72 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32 |
| 69 PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32 | 73 PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32 |
| 70 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32 | 74 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32 |
| 71 PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux | 75 PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux |
| 72 PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux | 76 PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux |
| 73 PLUGIN_QUIRK_NO_WINDOWLESS = 1024, // Windows | 77 PLUGIN_QUIRK_NO_WINDOWLESS = 1024, // Windows |
| 74 PLUGIN_QUIRK_PATCH_REGENUMKEYEXW = 2048, // Windows | 78 PLUGIN_QUIRK_PATCH_REGENUMKEYEXW = 2048, // Windows |
| 75 PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS = 4096, // Windows | 79 PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS = 4096, // Windows |
| 76 PLUGIN_QUIRK_ALLOW_FASTER_QUICKDRAW_PATH = 8192, // Mac | 80 PLUGIN_QUIRK_ALLOW_FASTER_QUICKDRAW_PATH = 8192, // Mac |
| 77 PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE = 16384, // Windows | 81 PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE = 16384, // Windows |
| 78 PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK = 32768, // Linux | 82 PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK = 32768, // Linux |
| 79 PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL = 65536, // Windows. | 83 PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL = 65536, // Windows. |
| 80 PLUGIN_QUIRK_REPARENT_IN_BROWSER = 131072, // Windows | 84 PLUGIN_QUIRK_REPARENT_IN_BROWSER = 131072, // Windows |
| 81 PLUGIN_QUIRK_PATCH_GETKEYSTATE = 262144, // Windows | 85 PLUGIN_QUIRK_PATCH_GETKEYSTATE = 262144, // Windows |
| 86 PLUGIN_QUIRK_EMULATE_IME = 524288, // Windows. |
| 82 }; | 87 }; |
| 83 | 88 |
| 84 static WebPluginDelegateImpl* Create(const FilePath& filename, | 89 static WebPluginDelegateImpl* Create(const FilePath& filename, |
| 85 const std::string& mime_type, | 90 const std::string& mime_type, |
| 86 gfx::PluginWindowHandle containing_view); | 91 gfx::PluginWindowHandle containing_view); |
| 87 | 92 |
| 88 static bool IsPluginDelegateWindow(gfx::NativeWindow window); | 93 static bool IsPluginDelegateWindow(gfx::NativeWindow window); |
| 89 static bool GetPluginNameFromWindow(gfx::NativeWindow window, | 94 static bool GetPluginNameFromWindow(gfx::NativeWindow window, |
| 90 string16* plugin_name); | 95 string16* plugin_name); |
| 91 | 96 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 140 |
| 136 // Returns the path for the library implementing this plugin. | 141 // Returns the path for the library implementing this plugin. |
| 137 FilePath GetPluginPath(); | 142 FilePath GetPluginPath(); |
| 138 | 143 |
| 139 // Returns a combination of PluginQuirks. | 144 // Returns a combination of PluginQuirks. |
| 140 int GetQuirks() const { return quirks_; } | 145 int GetQuirks() const { return quirks_; } |
| 141 | 146 |
| 142 // Informs the plugin that the view it is in has gained or lost focus. | 147 // Informs the plugin that the view it is in has gained or lost focus. |
| 143 void SetContentAreaHasFocus(bool has_focus); | 148 void SetContentAreaHasFocus(bool has_focus); |
| 144 | 149 |
| 150 #if defined(OS_WIN) |
| 151 // Informs the plug-in that an IME has changed its status. |
| 152 void ImeCompositionUpdated(const string16& text, |
| 153 const std::vector<int>& clauses, |
| 154 const std::vector<int>& target, |
| 155 int cursor_position); |
| 156 |
| 157 // Informs the plugin that IME composition has completed./ If |text| is empty, |
| 158 // IME was cancelled. |
| 159 void ImeCompositionCompleted(const string16& text); |
| 160 |
| 161 // Returns the IME status retrieved from a plug-in. |
| 162 bool GetIMEStatus(int* input_type, gfx::Rect* caret_rect); |
| 163 #endif |
| 164 |
| 145 #if defined(OS_MACOSX) | 165 #if defined(OS_MACOSX) |
| 146 // Informs the plugin that the geometry has changed, as with UpdateGeometry, | 166 // Informs the plugin that the geometry has changed, as with UpdateGeometry, |
| 147 // but also includes the new buffer context for that new geometry. | 167 // but also includes the new buffer context for that new geometry. |
| 148 void UpdateGeometryAndContext(const gfx::Rect& window_rect, | 168 void UpdateGeometryAndContext(const gfx::Rect& window_rect, |
| 149 const gfx::Rect& clip_rect, | 169 const gfx::Rect& clip_rect, |
| 150 gfx::NativeDrawingContext context); | 170 gfx::NativeDrawingContext context); |
| 151 // Informs the delegate that the plugin called NPN_Invalidate*. Used as a | 171 // Informs the delegate that the plugin called NPN_Invalidate*. Used as a |
| 152 // trigger for Core Animation drawing. | 172 // trigger for Core Animation drawing. |
| 153 void PluginDidInvalidate(); | 173 void PluginDidInvalidate(); |
| 154 // Returns the delegate currently processing events. | 174 // Returns the delegate currently processing events. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 WebPlugin* plugin_; | 331 WebPlugin* plugin_; |
| 312 scoped_refptr<PluginInstance> instance_; | 332 scoped_refptr<PluginInstance> instance_; |
| 313 | 333 |
| 314 #if defined(OS_WIN) | 334 #if defined(OS_WIN) |
| 315 // Original wndproc before we subclassed. | 335 // Original wndproc before we subclassed. |
| 316 WNDPROC plugin_wnd_proc_; | 336 WNDPROC plugin_wnd_proc_; |
| 317 | 337 |
| 318 // Used to throttle WM_USER+1 messages in Flash. | 338 // Used to throttle WM_USER+1 messages in Flash. |
| 319 uint32 last_message_; | 339 uint32 last_message_; |
| 320 bool is_calling_wndproc; | 340 bool is_calling_wndproc; |
| 341 |
| 342 // An IME emulator used by a windowless plug-in to retrieve IME data through |
| 343 // IMM32 functions. |
| 344 scoped_ptr<WebPluginIMEWin> plugin_ime_; |
| 321 #endif // defined(OS_WIN) | 345 #endif // defined(OS_WIN) |
| 322 | 346 |
| 323 #if defined(USE_X11) | 347 #if defined(USE_X11) |
| 324 // The SHM pixmap for a windowless plugin. | 348 // The SHM pixmap for a windowless plugin. |
| 325 XID windowless_shm_pixmap_; | 349 XID windowless_shm_pixmap_; |
| 326 #endif | 350 #endif |
| 327 | 351 |
| 328 #if defined(TOOLKIT_USES_GTK) | 352 #if defined(TOOLKIT_USES_GTK) |
| 329 // The pixmap we're drawing into, for a windowless plugin. | 353 // The pixmap we're drawing into, for a windowless plugin. |
| 330 GdkPixmap* pixmap_; | 354 GdkPixmap* pixmap_; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 static HCURSOR WINAPI SetCursorPatch(HCURSOR cursor); | 406 static HCURSOR WINAPI SetCursorPatch(HCURSOR cursor); |
| 383 | 407 |
| 384 // GetKeyStatePatch interceptor for UIPI Flash plugin. | 408 // GetKeyStatePatch interceptor for UIPI Flash plugin. |
| 385 static SHORT WINAPI GetKeyStatePatch(int vkey); | 409 static SHORT WINAPI GetKeyStatePatch(int vkey); |
| 386 | 410 |
| 387 // RegEnumKeyExW interceptor. | 411 // RegEnumKeyExW interceptor. |
| 388 static LONG WINAPI RegEnumKeyExWPatch( | 412 static LONG WINAPI RegEnumKeyExWPatch( |
| 389 HKEY key, DWORD index, LPWSTR name, LPDWORD name_size, LPDWORD reserved, | 413 HKEY key, DWORD index, LPWSTR name, LPDWORD name_size, LPDWORD reserved, |
| 390 LPWSTR class_name, LPDWORD class_size, PFILETIME last_write_time); | 414 LPWSTR class_name, LPDWORD class_size, PFILETIME last_write_time); |
| 391 | 415 |
| 416 // GetProcAddress intercepter for windowless plugins. |
| 417 static FARPROC WINAPI GetProcAddressPatch(HMODULE module, LPCSTR name); |
| 418 |
| 392 // The mouse hook proc which handles mouse capture in windowed plugins. | 419 // The mouse hook proc which handles mouse capture in windowed plugins. |
| 393 static LRESULT CALLBACK MouseHookProc(int code, WPARAM wParam, | 420 static LRESULT CALLBACK MouseHookProc(int code, WPARAM wParam, |
| 394 LPARAM lParam); | 421 LPARAM lParam); |
| 395 | 422 |
| 396 // Calls SetCapture/ReleaseCapture based on the message type. | 423 // Calls SetCapture/ReleaseCapture based on the message type. |
| 397 static void HandleCaptureForMessage(HWND window, UINT message); | 424 static void HandleCaptureForMessage(HWND window, UINT message); |
| 398 | 425 |
| 399 #elif defined(OS_MACOSX) | 426 #elif defined(OS_MACOSX) |
| 400 // Sets window_rect_ to |rect| | 427 // Sets window_rect_ to |rect| |
| 401 void SetPluginRect(const gfx::Rect& rect); | 428 void SetPluginRect(const gfx::Rect& rect); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 // True if NPP_New did not return an error. | 550 // True if NPP_New did not return an error. |
| 524 bool creation_succeeded_; | 551 bool creation_succeeded_; |
| 525 | 552 |
| 526 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); | 553 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); |
| 527 }; | 554 }; |
| 528 | 555 |
| 529 } // namespace npapi | 556 } // namespace npapi |
| 530 } // namespace webkit | 557 } // namespace webkit |
| 531 | 558 |
| 532 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ | 559 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ |
| OLD | NEW |