| 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 13 matching lines...) Expand all Loading... |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 namespace NPAPI { | 26 namespace NPAPI { |
| 27 class PluginInstance; | 27 class PluginInstance; |
| 28 } | 28 } |
| 29 | 29 |
| 30 // An implementation of WebPluginDelegate that proxies all calls to | 30 // An implementation of WebPluginDelegate that proxies all calls to |
| 31 // the plugin process. | 31 // the plugin process. |
| 32 class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { | 32 class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { |
| 33 public: | 33 public: |
| 34 enum PluginQuirks { |
| 35 PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32 |
| 36 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32 |
| 37 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32 |
| 38 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32 |
| 39 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32 |
| 40 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32 |
| 41 PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32 |
| 42 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32 |
| 43 PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux |
| 44 PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux |
| 45 PLUGIN_QUIRK_NO_WINDOWLESS = 1024, // Windows |
| 46 }; |
| 47 |
| 48 static WebPluginDelegateImpl* Create(const FilePath& filename, |
| 49 const std::string& mime_type, |
| 50 gfx::PluginWindowHandle containing_view); |
| 51 |
| 34 static bool IsPluginDelegateWindow(gfx::NativeWindow window); | 52 static bool IsPluginDelegateWindow(gfx::NativeWindow window); |
| 35 static bool GetPluginNameFromWindow(gfx::NativeWindow window, | 53 static bool GetPluginNameFromWindow(gfx::NativeWindow window, |
| 36 std::wstring *plugin_name); | 54 std::wstring *plugin_name); |
| 37 | 55 |
| 38 // Returns true if the window handle passed in is that of the dummy | 56 // Returns true if the window handle passed in is that of the dummy |
| 39 // activation window for windowless plugins. | 57 // activation window for windowless plugins. |
| 40 static bool IsDummyActivationWindow(gfx::NativeWindow window); | 58 static bool IsDummyActivationWindow(gfx::NativeWindow window); |
| 41 | 59 |
| 42 // WebPluginDelegate implementation | 60 // WebPluginDelegate implementation |
| 43 virtual void PluginDestroyed(); | 61 virtual void PluginDestroyed(); |
| 44 virtual bool Initialize(const GURL& url, | 62 virtual bool Initialize(const GURL& url, |
| 45 char** argn, | 63 const std::vector<std::string>& arg_names, |
| 46 char** argv, | 64 const std::vector<std::string>& arg_values, |
| 47 int argc, | |
| 48 webkit_glue::WebPlugin* plugin, | 65 webkit_glue::WebPlugin* plugin, |
| 49 bool load_manually); | 66 bool load_manually); |
| 50 virtual void UpdateGeometry(const gfx::Rect& window_rect, | 67 virtual void UpdateGeometry(const gfx::Rect& window_rect, |
| 51 const gfx::Rect& clip_rect); | 68 const gfx::Rect& clip_rect); |
| 52 virtual void Paint(gfx::NativeDrawingContext context, const gfx::Rect& rect); | 69 virtual void Paint(gfx::NativeDrawingContext context, const gfx::Rect& rect); |
| 53 virtual void Print(gfx::NativeDrawingContext context); | 70 virtual void Print(gfx::NativeDrawingContext context); |
| 54 | 71 |
| 55 virtual void SetFocus(); // only called when windowless | 72 virtual void SetFocus(); // only called when windowless |
| 56 // only called when windowless | 73 // only called when windowless |
| 57 // See NPAPI NPP_HandleEvent for more information. | 74 // See NPAPI NPP_HandleEvent for more information. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 79 virtual webkit_glue::WebPluginResourceClient* CreateResourceClient( | 96 virtual webkit_glue::WebPluginResourceClient* CreateResourceClient( |
| 80 int resource_id, | 97 int resource_id, |
| 81 const GURL& url, | 98 const GURL& url, |
| 82 bool notify_needed, | 99 bool notify_needed, |
| 83 intptr_t notify_data, | 100 intptr_t notify_data, |
| 84 intptr_t stream); | 101 intptr_t stream); |
| 85 | 102 |
| 86 virtual bool IsWindowless() const { return windowless_ ; } | 103 virtual bool IsWindowless() const { return windowless_ ; } |
| 87 virtual gfx::Rect GetRect() const { return window_rect_; } | 104 virtual gfx::Rect GetRect() const { return window_rect_; } |
| 88 virtual gfx::Rect GetClipRect() const { return clip_rect_; } | 105 virtual gfx::Rect GetClipRect() const { return clip_rect_; } |
| 89 virtual int GetQuirks() const { return quirks_; } | 106 |
| 107 // Returns a combination of PluginQuirks. |
| 108 int GetQuirks() const { return quirks_; } |
| 90 | 109 |
| 91 #if defined(OS_MACOSX) | 110 #if defined(OS_MACOSX) |
| 92 // Informs the delegate that the context used for painting windowless plugins | 111 // Informs the delegate that the context used for painting windowless plugins |
| 93 // has changed. | 112 // has changed. |
| 94 virtual void UpdateContext(gfx::NativeDrawingContext context); | 113 virtual void UpdateContext(gfx::NativeDrawingContext context); |
| 95 #endif | 114 #endif |
| 96 | 115 |
| 97 private: | 116 private: |
| 98 friend class DeleteTask<WebPluginDelegateImpl>; | 117 friend class DeleteTask<WebPluginDelegateImpl>; |
| 99 | 118 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 326 |
| 308 // Holds the current cursor set by the windowless plugin. | 327 // Holds the current cursor set by the windowless plugin. |
| 309 WebCursor current_windowless_cursor_; | 328 WebCursor current_windowless_cursor_; |
| 310 | 329 |
| 311 friend class webkit_glue::WebPluginDelegate; | 330 friend class webkit_glue::WebPluginDelegate; |
| 312 | 331 |
| 313 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl); | 332 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl); |
| 314 }; | 333 }; |
| 315 | 334 |
| 316 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ | 335 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ |
| OLD | NEW |