| 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_WEBPLUGIN_DELEGATE_H_ | 5 #ifndef WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H_ |
| 6 #define WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H_ | 6 #define WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gfx/native_widget_types.h" | 10 #include "base/gfx/native_widget_types.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace webkit_glue { | 27 namespace webkit_glue { |
| 28 | 28 |
| 29 class WebPlugin; | 29 class WebPlugin; |
| 30 class WebPluginResourceClient; | 30 class WebPluginResourceClient; |
| 31 | 31 |
| 32 // This is the interface that a plugin implementation needs to provide. | 32 // This is the interface that a plugin implementation needs to provide. |
| 33 class WebPluginDelegate { | 33 class WebPluginDelegate { |
| 34 public: | 34 public: |
| 35 enum PluginQuirks { | |
| 36 PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32 | |
| 37 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32 | |
| 38 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32 | |
| 39 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32 | |
| 40 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32 | |
| 41 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32 | |
| 42 PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32 | |
| 43 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32 | |
| 44 PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux | |
| 45 PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux | |
| 46 }; | |
| 47 | |
| 48 virtual ~WebPluginDelegate() {} | 35 virtual ~WebPluginDelegate() {} |
| 49 | 36 |
| 50 static WebPluginDelegate* Create(const FilePath& filename, | |
| 51 const std::string& mime_type, | |
| 52 gfx::PluginWindowHandle containing_view); | |
| 53 | |
| 54 // Initializes the plugin implementation with the given (UTF8) arguments. | 37 // Initializes the plugin implementation with the given (UTF8) arguments. |
| 55 // Note that the lifetime of WebPlugin must be longer than this delegate. | 38 // Note that the lifetime of WebPlugin must be longer than this delegate. |
| 56 // If this function returns false the plugin isn't started and shouldn't be | 39 // If this function returns false the plugin isn't started and shouldn't be |
| 57 // called again. If this method succeeds, then the WebPlugin is valid until | 40 // called again. If this method succeeds, then the WebPlugin is valid until |
| 58 // PluginDestroyed is called. | 41 // PluginDestroyed is called. |
| 59 // The load_manually parameter if true indicates that the plugin data would | 42 // The load_manually parameter if true indicates that the plugin data would |
| 60 // be passed from webkit. if false indicates that the plugin should download | 43 // be passed from webkit. if false indicates that the plugin should download |
| 61 // the data. This also controls whether the plugin is instantiated as a full | 44 // the data. This also controls whether the plugin is instantiated as a full |
| 62 // page plugin (NP_FULL) or embedded (NP_EMBED). | 45 // page plugin (NP_FULL) or embedded (NP_EMBED). |
| 63 virtual bool Initialize(const GURL& url, char** argn, char** argv, int argc, | 46 virtual bool Initialize(const GURL& url, |
| 64 WebPlugin* plugin, bool load_manually) = 0; | 47 const std::vector<std::string>& arg_names, |
| 48 const std::vector<std::string>& arg_values, |
| 49 WebPlugin* plugin, |
| 50 bool load_manually) = 0; |
| 65 | 51 |
| 66 // Called when the WebPlugin is being destroyed. This is a signal to the | 52 // Called when the WebPlugin is being destroyed. This is a signal to the |
| 67 // delegate that it should tear-down the plugin implementation and not call | 53 // delegate that it should tear-down the plugin implementation and not call |
| 68 // methods on the WebPlugin again. | 54 // methods on the WebPlugin again. |
| 69 virtual void PluginDestroyed() = 0; | 55 virtual void PluginDestroyed() = 0; |
| 70 | 56 |
| 71 // Update the geometry of the plugin. This is a request to move the | 57 // Update the geometry of the plugin. This is a request to move the |
| 72 // plugin, relative to its containing window, to the coords given by | 58 // plugin, relative to its containing window, to the coords given by |
| 73 // window_rect. Its contents should be clipped to the coords given | 59 // window_rect. Its contents should be clipped to the coords given |
| 74 // by clip_rect, which are relative to the origin of the plugin | 60 // by clip_rect, which are relative to the origin of the plugin |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 105 |
| 120 // Receives the data. | 106 // Receives the data. |
| 121 virtual void DidReceiveManualData(const char* buffer, int length) = 0; | 107 virtual void DidReceiveManualData(const char* buffer, int length) = 0; |
| 122 | 108 |
| 123 // Indicates end of data load. | 109 // Indicates end of data load. |
| 124 virtual void DidFinishManualLoading() = 0; | 110 virtual void DidFinishManualLoading() = 0; |
| 125 | 111 |
| 126 // Indicates a failure in data receipt. | 112 // Indicates a failure in data receipt. |
| 127 virtual void DidManualLoadFail() = 0; | 113 virtual void DidManualLoadFail() = 0; |
| 128 | 114 |
| 129 // Only available after Initialize is called. | |
| 130 virtual FilePath GetPluginPath() = 0; | |
| 131 | |
| 132 // Only supported when the plugin is the default plugin. | 115 // Only supported when the plugin is the default plugin. |
| 133 virtual void InstallMissingPlugin() = 0; | 116 virtual void InstallMissingPlugin() = 0; |
| 134 | 117 |
| 135 // Creates a WebPluginResourceClient instance and returns the same. | 118 // Creates a WebPluginResourceClient instance and returns the same. |
| 136 virtual WebPluginResourceClient* CreateResourceClient(int resource_id, | 119 virtual WebPluginResourceClient* CreateResourceClient(int resource_id, |
| 137 const GURL& url, | 120 const GURL& url, |
| 138 bool notify_needed, | 121 bool notify_needed, |
| 139 intptr_t notify_data, | 122 intptr_t notify_data, |
| 140 intptr_t stream) = 0; | 123 intptr_t stream) = 0; |
| 141 | |
| 142 virtual bool IsWindowless() const = 0; | |
| 143 | |
| 144 virtual gfx::Rect GetRect() const = 0; | |
| 145 | |
| 146 virtual gfx::Rect GetClipRect() const = 0; | |
| 147 | |
| 148 // Returns a combination of PluginQuirks. | |
| 149 virtual int GetQuirks() const = 0; | |
| 150 }; | 124 }; |
| 151 | 125 |
| 152 } // namespace webkit_glue | 126 } // namespace webkit_glue |
| 153 | 127 |
| 154 #endif // WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H_ | 128 #endif // WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H_ |
| OLD | NEW |