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