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 CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
14 #include "base/message_loop/message_loop_proxy.h" | 14 #include "base/message_loop/message_loop_proxy.h" |
15 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
16 #include "base/process.h" | 16 #include "base/process.h" |
17 #include "base/sync_socket.h" | 17 #include "base/sync_socket.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "content/common/content_export.h" |
19 #include "ipc/ipc_platform_file.h" | 20 #include "ipc/ipc_platform_file.h" |
20 #include "media/video/capture/video_capture.h" | 21 #include "media/video/capture/video_capture.h" |
21 #include "media/video/video_decode_accelerator.h" | 22 #include "media/video/video_decode_accelerator.h" |
22 #include "ppapi/c/dev/pp_video_dev.h" | 23 #include "ppapi/c/dev/pp_video_dev.h" |
23 #include "ppapi/c/dev/ppb_device_ref_dev.h" | 24 #include "ppapi/c/dev/ppb_device_ref_dev.h" |
24 #include "ppapi/c/pp_completion_callback.h" | 25 #include "ppapi/c/pp_completion_callback.h" |
25 #include "ppapi/c/pp_errors.h" | 26 #include "ppapi/c/pp_errors.h" |
26 #include "ppapi/c/pp_file_info.h" | 27 #include "ppapi/c/pp_file_info.h" |
27 #include "ppapi/c/pp_instance.h" | 28 #include "ppapi/c/pp_instance.h" |
28 #include "ppapi/c/pp_resource.h" | 29 #include "ppapi/c/pp_resource.h" |
29 #include "ppapi/c/pp_stdint.h" | 30 #include "ppapi/c/pp_stdint.h" |
30 #include "ppapi/c/ppb_tcp_socket.h" | 31 #include "ppapi/c/ppb_tcp_socket.h" |
31 #include "ppapi/c/private/ppb_flash.h" | 32 #include "ppapi/c/private/ppb_flash.h" |
32 #include "ppapi/c/private/ppb_tcp_socket_private.h" | 33 #include "ppapi/c/private/ppb_tcp_socket_private.h" |
33 #include "ppapi/c/private/ppb_udp_socket_private.h" | 34 #include "ppapi/c/private/ppb_udp_socket_private.h" |
34 #include "ppapi/shared_impl/dir_contents.h" | 35 #include "ppapi/shared_impl/dir_contents.h" |
35 #include "ui/gfx/size.h" | 36 #include "ui/gfx/size.h" |
36 #include "url/gurl.h" | 37 #include "url/gurl.h" |
37 #include "webkit/common/fileapi/file_system_types.h" | 38 #include "webkit/common/fileapi/file_system_types.h" |
38 #include "webkit/common/quota/quota_types.h" | 39 #include "webkit/common/quota/quota_types.h" |
39 #include "webkit/plugins/webkit_plugins_export.h" | |
40 | 40 |
41 class GURL; | 41 class GURL; |
42 class SkBitmap; | 42 class SkBitmap; |
43 class SkCanvas; | 43 class SkCanvas; |
44 class TransportDIB; | 44 class TransportDIB; |
45 struct PP_NetAddress_Private; | 45 struct PP_NetAddress_Private; |
46 | 46 |
47 namespace IPC { | 47 namespace IPC { |
48 struct ChannelHandle; | 48 struct ChannelHandle; |
49 } | 49 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 class PluginModule; | 115 class PluginModule; |
116 class PPB_Broker_Impl; | 116 class PPB_Broker_Impl; |
117 class PPB_Flash_Menu_Impl; | 117 class PPB_Flash_Menu_Impl; |
118 class PPB_ImageData_Impl; | 118 class PPB_ImageData_Impl; |
119 class PPB_TCPSocket_Private_Impl; | 119 class PPB_TCPSocket_Private_Impl; |
120 | 120 |
121 // Virtual interface that the browser implements to implement features for | 121 // Virtual interface that the browser implements to implement features for |
122 // PPAPI plugins. | 122 // PPAPI plugins. |
123 class PluginDelegate { | 123 class PluginDelegate { |
124 public: | 124 public: |
125 // This interface is used for the PluginModule to tell the code in charge of | |
126 // re-using modules which modules currently exist. | |
127 // | |
128 // It is different than the other interfaces, which are scoped to the | |
129 // lifetime of the plugin instance. The implementor of this interface must | |
130 // outlive all plugin modules, and is in practice a singleton | |
131 // (PepperPluginRegistry). This requirement means we can't do the obvious | |
132 // thing and just have a PluginDelegate call for this purpose (when the | |
133 // module is being deleted, we know there are no more PluginInstances that | |
134 // have PluginDelegates). | |
135 class ModuleLifetime { | |
136 public: | |
137 // Notification that the given plugin object is no longer usable. It either | |
138 // indicates the module was deleted, or that it has crashed. | |
139 // | |
140 // This can be called from the module's destructor, so you should not | |
141 // dereference the given pointer. | |
142 virtual void PluginModuleDead(PluginModule* dead_module) = 0; | |
143 }; | |
144 | |
145 // This class is implemented by the PluginDelegate implementation and is | 125 // This class is implemented by the PluginDelegate implementation and is |
146 // designed to manage the lifetime and communication with the proxy's | 126 // designed to manage the lifetime and communication with the proxy's |
147 // HostDispatcher for out-of-process PPAPI plugins. | 127 // HostDispatcher for out-of-process PPAPI plugins. |
148 // | 128 // |
149 // The point of this is to avoid having a relationship from the PPAPI plugin | 129 // The point of this is to avoid having a relationship from the PPAPI plugin |
150 // implementation to the ppapi proxy code. Otherwise, things like the IPC | 130 // implementation to the ppapi proxy code. Otherwise, things like the IPC |
151 // system will be dependencies of the webkit directory, which we don't want. | 131 // system will be dependencies of the webkit directory, which we don't want. |
152 // | 132 // |
153 // The PluginModule will scope the lifetime of this object to its own | 133 // The PluginModule will scope the lifetime of this object to its own |
154 // lifetime, so the implementation can use this to manage the HostDispatcher | 134 // lifetime, so the implementation can use this to manage the HostDispatcher |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 166 |
187 // Returns the platform-specific shared memory handle of the data backing | 167 // Returns the platform-specific shared memory handle of the data backing |
188 // this image. This is used by PPAPI proxying to send the image to the | 168 // this image. This is used by PPAPI proxying to send the image to the |
189 // out-of-process plugin. On success, the size in bytes will be placed into | 169 // out-of-process plugin. On success, the size in bytes will be placed into |
190 // |*bytes_count|. Returns 0 on failure. | 170 // |*bytes_count|. Returns 0 on failure. |
191 virtual intptr_t GetSharedMemoryHandle(uint32* byte_count) const = 0; | 171 virtual intptr_t GetSharedMemoryHandle(uint32* byte_count) const = 0; |
192 | 172 |
193 virtual TransportDIB* GetTransportDIB() const = 0; | 173 virtual TransportDIB* GetTransportDIB() const = 0; |
194 }; | 174 }; |
195 | 175 |
196 class WEBKIT_PLUGINS_EXPORT PlatformGraphics2D { | 176 class CONTENT_EXPORT PlatformGraphics2D { |
197 public: | 177 public: |
198 virtual ~PlatformGraphics2D() {} | 178 virtual ~PlatformGraphics2D() {} |
199 | 179 |
200 virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0; | 180 virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0; |
201 | 181 |
202 // Assciates this device with the given plugin instance. You can pass NULL | 182 // Assciates this device with the given plugin instance. You can pass NULL |
203 // to clear the existing device. Returns true on success. In this case, a | 183 // to clear the existing device. Returns true on success. In this case, a |
204 // repaint of the page will also be scheduled. Failure means that the device | 184 // repaint of the page will also be scheduled. Failure means that the device |
205 // is already bound to a different instance, and nothing will happen. | 185 // is already bound to a different instance, and nothing will happen. |
206 virtual bool BindToInstance(PluginInstanceImpl* new_instance) = 0; | 186 virtual bool BindToInstance(PluginInstanceImpl* new_instance) = 0; |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 const base::FilePath& path, | 682 const base::FilePath& path, |
703 ::ppapi::PpapiPermissions permissions, | 683 ::ppapi::PpapiPermissions permissions, |
704 const IPC::ChannelHandle& channel_handle, | 684 const IPC::ChannelHandle& channel_handle, |
705 base::ProcessId plugin_pid, | 685 base::ProcessId plugin_pid, |
706 int plugin_child_id) = 0; | 686 int plugin_child_id) = 0; |
707 }; | 687 }; |
708 | 688 |
709 } // namespace ppapi | 689 } // namespace ppapi |
710 } // namespace webkit | 690 } // namespace webkit |
711 | 691 |
712 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 692 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_H_ |
OLD | NEW |