OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ | 5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ |
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ | 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 namespace WebKit { | 42 namespace WebKit { |
43 struct WebCursorInfo; | 43 struct WebCursorInfo; |
44 class WebInputEvent; | 44 class WebInputEvent; |
45 class WebPluginContainer; | 45 class WebPluginContainer; |
46 } | 46 } |
47 | 47 |
48 namespace pepper { | 48 namespace pepper { |
49 | 49 |
50 class Graphics2D; | 50 class Graphics2D; |
| 51 class Graphics3D; |
51 class ImageData; | 52 class ImageData; |
52 class PluginDelegate; | 53 class PluginDelegate; |
53 class PluginModule; | 54 class PluginModule; |
| 55 class Resource; |
54 class URLLoader; | 56 class URLLoader; |
55 class FullscreenContainer; | 57 class FullscreenContainer; |
56 | 58 |
57 // Represents one time a plugin appears on one web page. | 59 // Represents one time a plugin appears on one web page. |
58 // | 60 // |
59 // Note: to get from a PP_Instance to a PluginInstance*, use the | 61 // Note: to get from a PP_Instance to a PluginInstance*, use the |
60 // ResourceTracker. | 62 // ResourceTracker. |
61 class PluginInstance : public base::RefCounted<PluginInstance> { | 63 class PluginInstance : public base::RefCounted<PluginInstance> { |
62 public: | 64 public: |
63 PluginInstance(PluginDelegate* delegate, | 65 PluginInstance(PluginDelegate* delegate, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // relative to the top-left of the plugin. This does nothing if the plugin | 100 // relative to the top-left of the plugin. This does nothing if the plugin |
99 // has not yet been positioned. You can supply an empty gfx::Rect() to | 101 // has not yet been positioned. You can supply an empty gfx::Rect() to |
100 // invalidate the entire plugin. | 102 // invalidate the entire plugin. |
101 void InvalidateRect(const gfx::Rect& rect); | 103 void InvalidateRect(const gfx::Rect& rect); |
102 | 104 |
103 // Schedules a scroll of the plugin. This uses optimized scrolling only for | 105 // Schedules a scroll of the plugin. This uses optimized scrolling only for |
104 // full-frame plugins, as otherwise there could be other elements on top. The | 106 // full-frame plugins, as otherwise there could be other elements on top. The |
105 // slow path can also be triggered if there is an overlapping frame. | 107 // slow path can also be triggered if there is an overlapping frame. |
106 void ScrollRect(int dx, int dy, const gfx::Rect& rect); | 108 void ScrollRect(int dx, int dy, const gfx::Rect& rect); |
107 | 109 |
| 110 // If the plugin instance is backed by a texture, return its texture ID in the |
| 111 // compositor's namespace. Otherwise return 0. Returns 0 by default. |
| 112 virtual unsigned GetBackingTextureId(); |
| 113 |
| 114 // Commit the backing texture to the screen once the side effects some |
| 115 // rendering up to an offscreen SwapBuffers are visible. |
| 116 void CommitBackingTexture(); |
| 117 |
108 // PPB_Instance implementation. | 118 // PPB_Instance implementation. |
109 PP_Var GetWindowObject(); | 119 PP_Var GetWindowObject(); |
110 PP_Var GetOwnerElementObject(); | 120 PP_Var GetOwnerElementObject(); |
111 bool BindGraphics(PP_Resource device_id); | 121 bool BindGraphics(PP_Resource graphics_id); |
112 bool full_frame() const { return full_frame_; } | 122 bool full_frame() const { return full_frame_; } |
113 bool SetCursor(PP_CursorType_Dev type); | 123 bool SetCursor(PP_CursorType_Dev type); |
114 PP_Var ExecuteScript(PP_Var script, PP_Var* exception); | 124 PP_Var ExecuteScript(PP_Var script, PP_Var* exception); |
115 | 125 |
116 // PPP_Instance pass-through. | 126 // PPP_Instance pass-through. |
117 void Delete(); | 127 void Delete(); |
118 bool Initialize(WebKit::WebPluginContainer* container, | 128 bool Initialize(WebKit::WebPluginContainer* container, |
119 const std::vector<std::string>& arg_names, | 129 const std::vector<std::string>& arg_names, |
120 const std::vector<std::string>& arg_values, | 130 const std::vector<std::string>& arg_values, |
121 bool full_frame); | 131 bool full_frame); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 bool DrawJPEGToPlatformDC(const SkBitmap& bitmap, | 198 bool DrawJPEGToPlatformDC(const SkBitmap& bitmap, |
189 const gfx::Rect& printable_area, | 199 const gfx::Rect& printable_area, |
190 WebKit::WebCanvas* canvas); | 200 WebKit::WebCanvas* canvas); |
191 #elif defined(OS_MACOSX) | 201 #elif defined(OS_MACOSX) |
192 // Draws the given kARGB_8888_Config bitmap to the specified canvas starting | 202 // Draws the given kARGB_8888_Config bitmap to the specified canvas starting |
193 // at the specified destination rect. | 203 // at the specified destination rect. |
194 void DrawSkBitmapToCanvas(const SkBitmap& bitmap, WebKit::WebCanvas* canvas, | 204 void DrawSkBitmapToCanvas(const SkBitmap& bitmap, WebKit::WebCanvas* canvas, |
195 const gfx::Rect& dest_rect, int canvas_height); | 205 const gfx::Rect& dest_rect, int canvas_height); |
196 #endif // OS_MACOSX | 206 #endif // OS_MACOSX |
197 | 207 |
| 208 // Get the bound graphics context as a concrete 2D graphics context or returns |
| 209 // null if the context is not 2D. |
| 210 Graphics2D* bound_graphics_2d() const; |
| 211 |
| 212 // Get the bound graphics context as a concrete 3D graphics context or returns |
| 213 // null if the context is not 3D. |
| 214 Graphics3D* bound_graphics_3d() const; |
| 215 |
198 PluginDelegate* delegate_; | 216 PluginDelegate* delegate_; |
199 scoped_refptr<PluginModule> module_; | 217 scoped_refptr<PluginModule> module_; |
200 const PPP_Instance* instance_interface_; | 218 const PPP_Instance* instance_interface_; |
201 | 219 |
202 PP_Instance pp_instance_; | 220 PP_Instance pp_instance_; |
203 | 221 |
204 // NULL until we have been initialized. | 222 // NULL until we have been initialized. |
205 WebKit::WebPluginContainer* container_; | 223 WebKit::WebPluginContainer* container_; |
206 | 224 |
207 // Indicates whether this is a full frame instance, which means it represents | 225 // Indicates whether this is a full frame instance, which means it represents |
208 // an entire document rather than an embed tag. | 226 // an entire document rather than an embed tag. |
209 bool full_frame_; | 227 bool full_frame_; |
210 | 228 |
211 // Position in the viewport (which moves as the page is scrolled) of this | 229 // Position in the viewport (which moves as the page is scrolled) of this |
212 // plugin. This will be a 0-sized rectangle if the plugin has not yet been | 230 // plugin. This will be a 0-sized rectangle if the plugin has not yet been |
213 // laid out. | 231 // laid out. |
214 gfx::Rect position_; | 232 gfx::Rect position_; |
215 | 233 |
216 // Current clip rect. This will be empty if the plugin is not currently | 234 // Current clip rect. This will be empty if the plugin is not currently |
217 // visible. This is in the plugin's coordinate system, so fully visible will | 235 // visible. This is in the plugin's coordinate system, so fully visible will |
218 // be (0, 0, w, h) regardless of scroll position. | 236 // be (0, 0, w, h) regardless of scroll position. |
219 gfx::Rect clip_; | 237 gfx::Rect clip_; |
220 | 238 |
| 239 // The current device context for painting in 2D or 3D. |
| 240 scoped_refptr<Resource> bound_graphics_; |
| 241 |
221 // We track two types of focus, one from WebKit, which is the focus among | 242 // We track two types of focus, one from WebKit, which is the focus among |
222 // all elements of the page, one one from the browser, which is whether the | 243 // all elements of the page, one one from the browser, which is whether the |
223 // tab/window has focus. We tell the plugin it has focus only when both of | 244 // tab/window has focus. We tell the plugin it has focus only when both of |
224 // these values are set to true. | 245 // these values are set to true. |
225 bool has_webkit_focus_; | 246 bool has_webkit_focus_; |
226 bool has_content_area_focus_; | 247 bool has_content_area_focus_; |
227 | 248 |
228 // The current device context for painting in 2D. | |
229 scoped_refptr<Graphics2D> bound_graphics_2d_; | |
230 | |
231 // The id of the current find operation, or -1 if none is in process. | 249 // The id of the current find operation, or -1 if none is in process. |
232 int find_identifier_; | 250 int find_identifier_; |
233 | 251 |
234 // The plugin-provided interfaces. | 252 // The plugin-provided interfaces. |
235 const PPP_Find_Dev* plugin_find_interface_; | 253 const PPP_Find_Dev* plugin_find_interface_; |
236 const PPP_Private* plugin_private_interface_; | 254 const PPP_Private* plugin_private_interface_; |
237 const PPP_Selection_Dev* plugin_selection_interface_; | 255 const PPP_Selection_Dev* plugin_selection_interface_; |
238 const PPP_Zoom_Dev* plugin_zoom_interface_; | 256 const PPP_Zoom_Dev* plugin_zoom_interface_; |
239 | 257 |
240 // This is only valid between a successful PrintBegin call and a PrintEnd | 258 // This is only valid between a successful PrintBegin call and a PrintEnd |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 291 |
274 // Plugin container for fullscreen mode. NULL if not in fullscreen mode. | 292 // Plugin container for fullscreen mode. NULL if not in fullscreen mode. |
275 FullscreenContainer* fullscreen_container_; | 293 FullscreenContainer* fullscreen_container_; |
276 | 294 |
277 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 295 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
278 }; | 296 }; |
279 | 297 |
280 } // namespace pepper | 298 } // namespace pepper |
281 | 299 |
282 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ | 300 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ |
OLD | NEW |