OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 namespace thunk { | 67 namespace thunk { |
68 class ResourceCreationAPI; | 68 class ResourceCreationAPI; |
69 } | 69 } |
70 | 70 |
71 } // namespace ppapi | 71 } // namespace ppapi |
72 | 72 |
73 namespace skia { | 73 namespace skia { |
74 class PlatformCanvas; | 74 class PlatformCanvas; |
75 } | 75 } |
76 | 76 |
| 77 class SkCanvas; |
| 78 |
77 namespace WebKit { | 79 namespace WebKit { |
| 80 typedef SkCanvas WebCanvas; |
78 class WebGamepads; | 81 class WebGamepads; |
79 class WebPlugin; | 82 class WebPlugin; |
80 struct WebCompositionUnderline; | 83 struct WebCompositionUnderline; |
81 struct WebCursorInfo; | 84 struct WebCursorInfo; |
82 } | 85 } |
83 | 86 |
84 namespace webkit_glue { | 87 namespace webkit_glue { |
85 class ClipboardClient; | 88 class ClipboardClient; |
86 class P2PTransport; | 89 class P2PTransport; |
87 class NetworkListObserver; | 90 class NetworkListObserver; |
88 } // namespace webkit_glue | 91 } // namespace webkit_glue |
89 | 92 |
90 namespace webkit { | 93 namespace webkit { |
91 namespace ppapi { | 94 namespace ppapi { |
92 | 95 |
93 class FileIO; | 96 class FileIO; |
94 class FullscreenContainer; | 97 class FullscreenContainer; |
95 class PluginInstance; | 98 class PluginInstance; |
96 class PluginModule; | 99 class PluginModule; |
97 class PPB_Broker_Impl; | 100 class PPB_Broker_Impl; |
98 class PPB_Flash_Menu_Impl; | 101 class PPB_Flash_Menu_Impl; |
| 102 class PPB_ImageData_Impl; |
99 class PPB_TCPSocket_Private_Impl; | 103 class PPB_TCPSocket_Private_Impl; |
100 class PPB_UDPSocket_Private_Impl; | 104 class PPB_UDPSocket_Private_Impl; |
101 | 105 |
102 // Virtual interface that the browser implements to implement features for | 106 // Virtual interface that the browser implements to implement features for |
103 // PPAPI plugins. | 107 // PPAPI plugins. |
104 class PluginDelegate { | 108 class PluginDelegate { |
105 public: | 109 public: |
106 // This interface is used for the PluginModule to tell the code in charge of | 110 // This interface is used for the PluginModule to tell the code in charge of |
107 // re-using modules which modules currently exist. | 111 // re-using modules which modules currently exist. |
108 // | 112 // |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 168 |
165 // Returns the platform-specific shared memory handle of the data backing | 169 // Returns the platform-specific shared memory handle of the data backing |
166 // this image. This is used by PPAPI proxying to send the image to the | 170 // this image. This is used by PPAPI proxying to send the image to the |
167 // out-of-process plugin. On success, the size in bytes will be placed into | 171 // out-of-process plugin. On success, the size in bytes will be placed into |
168 // |*bytes_count|. Returns 0 on failure. | 172 // |*bytes_count|. Returns 0 on failure. |
169 virtual intptr_t GetSharedMemoryHandle(uint32* byte_count) const = 0; | 173 virtual intptr_t GetSharedMemoryHandle(uint32* byte_count) const = 0; |
170 | 174 |
171 virtual TransportDIB* GetTransportDIB() const = 0; | 175 virtual TransportDIB* GetTransportDIB() const = 0; |
172 }; | 176 }; |
173 | 177 |
| 178 class PlatformGraphics2D { |
| 179 public: |
| 180 virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0; |
| 181 |
| 182 // Assciates this device with the given plugin instance. You can pass NULL |
| 183 // to clear the existing device. Returns true on success. In this case, a |
| 184 // repaint of the page will also be scheduled. Failure means that the device |
| 185 // is already bound to a different instance, and nothing will happen. |
| 186 virtual bool BindToInstance(PluginInstance* new_instance) = 0; |
| 187 |
| 188 // Paints the current backing store to the web page. |
| 189 virtual void Paint(WebKit::WebCanvas* canvas, |
| 190 const gfx::Rect& plugin_rect, |
| 191 const gfx::Rect& paint_rect) = 0; |
| 192 |
| 193 // Notifications about the view's progress painting. See PluginInstance. |
| 194 // These messages are used to send Flush callbacks to the plugin. |
| 195 virtual void ViewWillInitiatePaint() = 0; |
| 196 virtual void ViewInitiatedPaint() = 0; |
| 197 virtual void ViewFlushedPaint() = 0; |
| 198 |
| 199 virtual bool IsAlwaysOpaque() const = 0; |
| 200 virtual float GetScale() const = 0; |
| 201 virtual PPB_ImageData_Impl* ImageData() = 0; |
| 202 }; |
| 203 |
174 class PlatformContext3D { | 204 class PlatformContext3D { |
175 public: | 205 public: |
176 virtual ~PlatformContext3D() {} | 206 virtual ~PlatformContext3D() {} |
177 | 207 |
178 // Initialize the context. | 208 // Initialize the context. |
179 virtual bool Init(const int32* attrib_list, | 209 virtual bool Init(const int32* attrib_list, |
180 PlatformContext3D* share_context) = 0; | 210 PlatformContext3D* share_context) = 0; |
181 | 211 |
182 // If the plugin instance is backed by an OpenGL, return its ID in the | 212 // If the plugin instance is backed by an OpenGL, return its ID in the |
183 // compositors namespace. Otherwise return 0. Returns 0 by default. | 213 // compositors namespace. Otherwise return 0. Returns 0 by default. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 virtual SkBitmap* GetSadPluginBitmap() = 0; | 385 virtual SkBitmap* GetSadPluginBitmap() = 0; |
356 | 386 |
357 // Creates a replacement plug-in that is shown when the plug-in at |file_path| | 387 // Creates a replacement plug-in that is shown when the plug-in at |file_path| |
358 // couldn't be loaded. | 388 // couldn't be loaded. |
359 virtual WebKit::WebPlugin* CreatePluginReplacement( | 389 virtual WebKit::WebPlugin* CreatePluginReplacement( |
360 const FilePath& file_path) = 0; | 390 const FilePath& file_path) = 0; |
361 | 391 |
362 // The caller will own the pointer returned from this. | 392 // The caller will own the pointer returned from this. |
363 virtual PlatformImage2D* CreateImage2D(int width, int height) = 0; | 393 virtual PlatformImage2D* CreateImage2D(int width, int height) = 0; |
364 | 394 |
| 395 // Returns the internal PlatformGraphics2D implementation. |
| 396 virtual PlatformGraphics2D* GetGraphics2D(PluginInstance* instance, |
| 397 PP_Resource graphics_2d) = 0; |
| 398 |
365 // The caller will own the pointer returned from this. | 399 // The caller will own the pointer returned from this. |
366 virtual PlatformContext3D* CreateContext3D() = 0; | 400 virtual PlatformContext3D* CreateContext3D() = 0; |
367 | 401 |
368 // Set that the context will now present to the delegate. | 402 // Set that the context will now present to the delegate. |
369 virtual void ReparentContext(PlatformContext3D*) = 0; | 403 virtual void ReparentContext(PlatformContext3D*) = 0; |
370 | 404 |
371 // If |device_id| is empty, the default video capture device will be used. The | 405 // If |device_id| is empty, the default video capture device will be used. The |
372 // user can start using the returned object to capture video right away. | 406 // user can start using the returned object to capture video right away. |
373 // Otherwise, the specified device will be used. The user needs to wait till | 407 // Otherwise, the specified device will be used. The user needs to wait till |
374 // |handler| gets an OnInitialized() notification to start using the returned | 408 // |handler| gets an OnInitialized() notification to start using the returned |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 // Returns restrictions on local data handled by the plug-in. | 709 // Returns restrictions on local data handled by the plug-in. |
676 virtual PP_FlashLSORestrictions GetLocalDataRestrictions( | 710 virtual PP_FlashLSORestrictions GetLocalDataRestrictions( |
677 const GURL& document_url, | 711 const GURL& document_url, |
678 const GURL& plugin_url) = 0; | 712 const GURL& plugin_url) = 0; |
679 }; | 713 }; |
680 | 714 |
681 } // namespace ppapi | 715 } // namespace ppapi |
682 } // namespace webkit | 716 } // namespace webkit |
683 | 717 |
684 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 718 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ |
OLD | NEW |