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 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/gfx/native_widget_types.h" | 13 #include "base/gfx/native_widget_types.h" |
14 #include "base/gfx/rect.h" | 14 #include "base/gfx/rect.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "third_party/npapi/bindings/npapi.h" | 16 #include "third_party/npapi/bindings/npapi.h" |
17 | 17 |
18 // TODO(port): put in OS_WIN check. | 18 // TODO(port): put in OS_WIN check. |
19 typedef struct HDC__* HDC; | 19 typedef struct HDC__* HDC; |
20 struct NPObject; | 20 struct NPObject; |
21 | 21 |
22 class GURL; | 22 class GURL; |
23 class WebCursor; | 23 class WebCursor; |
24 class WebPlugin; | 24 class WebPlugin; |
25 class WebPluginResourceClient; | 25 class WebPluginResourceClient; |
26 | 26 |
27 // This is the interface that a plugin implementation needs to provide. | 27 // This is the interface that a plugin implementation needs to provide. |
28 class WebPluginDelegate { | 28 class WebPluginDelegate { |
29 public: | 29 public: |
| 30 #if defined(OS_WIN) |
| 31 enum PluginQuirks { |
| 32 PLUGIN_QUIRK_SETWINDOW_TWICE = 1 << 0, |
| 33 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 1 << 1, |
| 34 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 1 << 2, |
| 35 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 1 << 3, |
| 36 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 1 << 4, |
| 37 PLUGIN_QUIRK_PATCH_TRACKPOPUP_MENU = 1 << 5, |
| 38 PLUGIN_QUIRK_PATCH_SETCURSOR = 1 << 6, |
| 39 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 1 << 7, |
| 40 }; |
| 41 #endif |
| 42 |
30 WebPluginDelegate() {} | 43 WebPluginDelegate() {} |
31 virtual ~WebPluginDelegate() {} | 44 virtual ~WebPluginDelegate() {} |
32 | 45 |
| 46 static WebPluginDelegate* Create(const FilePath& filename, |
| 47 const std::string& mime_type, |
| 48 gfx::NativeView containing_view); |
| 49 |
33 // Initializes the plugin implementation with the given (UTF8) arguments. | 50 // Initializes the plugin implementation with the given (UTF8) arguments. |
34 // Note that the lifetime of WebPlugin must be longer than this delegate. | 51 // Note that the lifetime of WebPlugin must be longer than this delegate. |
35 // If this function returns false the plugin isn't started and shouldn't be | 52 // If this function returns false the plugin isn't started and shouldn't be |
36 // called again. If this method succeeds, then the WebPlugin is valid until | 53 // called again. If this method succeeds, then the WebPlugin is valid until |
37 // PluginDestroyed is called. | 54 // PluginDestroyed is called. |
38 // The load_manually parameter if true indicates that the plugin data would | 55 // The load_manually parameter if true indicates that the plugin data would |
39 // be passed from webkit. if false indicates that the plugin should download | 56 // be passed from webkit. if false indicates that the plugin should download |
40 // the data. This also controls whether the plugin is instantiated as a full | 57 // the data. This also controls whether the plugin is instantiated as a full |
41 // page plugin (NP_FULL) or embedded (NP_EMBED). | 58 // page plugin (NP_FULL) or embedded (NP_EMBED). |
42 virtual bool Initialize(const GURL& url, char** argn, char** argv, | 59 virtual bool Initialize(const GURL& url, char** argn, char** argv, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // Creates a WebPluginResourceClient instance and returns the same. | 130 // Creates a WebPluginResourceClient instance and returns the same. |
114 virtual WebPluginResourceClient* CreateResourceClient(int resource_id, | 131 virtual WebPluginResourceClient* CreateResourceClient(int resource_id, |
115 const std::string &url, | 132 const std::string &url, |
116 bool notify_needed, | 133 bool notify_needed, |
117 void *notify_data, | 134 void *notify_data, |
118 void* stream) = 0; | 135 void* stream) = 0; |
119 | 136 |
120 // Notifies the delegate about a Get/Post URL request getting routed. | 137 // Notifies the delegate about a Get/Post URL request getting routed. |
121 virtual void URLRequestRouted(const std::string&url, bool notify_needed, | 138 virtual void URLRequestRouted(const std::string&url, bool notify_needed, |
122 void* notify_data) = 0; | 139 void* notify_data) = 0; |
| 140 |
| 141 virtual bool IsWindowless() const { |
| 142 NOTREACHED(); |
| 143 return false; |
| 144 } |
| 145 |
| 146 virtual const gfx::Rect& GetRect() const { |
| 147 NOTREACHED(); |
| 148 static gfx::Rect dummy; |
| 149 return dummy; |
| 150 } |
| 151 |
| 152 virtual const gfx::Rect& GetClipRect() const { |
| 153 NOTREACHED(); |
| 154 return GetRect(); |
| 155 } |
| 156 |
| 157 #if defined(OS_WIN) |
| 158 // Returns a combinaison of PluginQuirks. |
| 159 virtual int GetQuirks() const { |
| 160 NOTREACHED(); |
| 161 return 0; |
| 162 } |
| 163 #endif |
| 164 |
123 private: | 165 private: |
124 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegate); | 166 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegate); |
125 }; | 167 }; |
126 | 168 |
127 #endif // #ifndef WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H__ | 169 #endif // #ifndef WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H_ |
128 | |
OLD | NEW |