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 CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_H_ |
6 #define CONTENT_RENDERER_PEPPER_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/process.h" | 16 #include "base/process/process.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "ipc/ipc_platform_file.h" | 19 #include "ipc/ipc_platform_file.h" |
20 #include "ppapi/c/dev/pp_video_dev.h" | 20 #include "ppapi/c/dev/pp_video_dev.h" |
21 #include "ppapi/c/pp_completion_callback.h" | 21 #include "ppapi/c/pp_completion_callback.h" |
22 #include "ppapi/c/pp_errors.h" | 22 #include "ppapi/c/pp_errors.h" |
23 #include "ppapi/c/pp_file_info.h" | 23 #include "ppapi/c/pp_file_info.h" |
24 #include "ppapi/c/pp_instance.h" | 24 #include "ppapi/c/pp_instance.h" |
25 #include "ppapi/c/pp_resource.h" | 25 #include "ppapi/c/pp_resource.h" |
26 #include "ppapi/c/pp_stdint.h" | 26 #include "ppapi/c/pp_stdint.h" |
27 #include "ppapi/c/ppb_tcp_socket.h" | |
28 #include "ppapi/c/private/ppb_flash.h" | 27 #include "ppapi/c/private/ppb_flash.h" |
29 #include "ppapi/c/private/ppb_tcp_socket_private.h" | |
30 #include "ppapi/c/private/ppb_udp_socket_private.h" | 28 #include "ppapi/c/private/ppb_udp_socket_private.h" |
31 #include "ppapi/shared_impl/dir_contents.h" | 29 #include "ppapi/shared_impl/dir_contents.h" |
32 #include "ui/gfx/size.h" | 30 #include "ui/gfx/size.h" |
33 #include "url/gurl.h" | 31 #include "url/gurl.h" |
34 #include "webkit/common/fileapi/file_system_types.h" | 32 #include "webkit/common/fileapi/file_system_types.h" |
35 | 33 |
36 class GURL; | 34 class GURL; |
37 class SkCanvas; | 35 class SkCanvas; |
38 class TransportDIB; | 36 class TransportDIB; |
39 struct PP_NetAddress_Private; | 37 struct PP_NetAddress_Private; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 PepperPluginInstanceImpl* instance) = 0; | 101 PepperPluginInstanceImpl* instance) = 0; |
104 // Notification that the caret position in the given plugin is changed. | 102 // Notification that the caret position in the given plugin is changed. |
105 virtual void PluginCaretPositionChanged( | 103 virtual void PluginCaretPositionChanged( |
106 PepperPluginInstanceImpl* instance) = 0; | 104 PepperPluginInstanceImpl* instance) = 0; |
107 // Notification that the plugin requested to cancel the current composition. | 105 // Notification that the plugin requested to cancel the current composition. |
108 virtual void PluginRequestedCancelComposition( | 106 virtual void PluginRequestedCancelComposition( |
109 PepperPluginInstanceImpl* instance) = 0; | 107 PepperPluginInstanceImpl* instance) = 0; |
110 // Notification that the text selection in the given plugin is changed. | 108 // Notification that the text selection in the given plugin is changed. |
111 virtual void PluginSelectionChanged(PepperPluginInstanceImpl* instance) = 0; | 109 virtual void PluginSelectionChanged(PepperPluginInstanceImpl* instance) = 0; |
112 | 110 |
113 // Notification that the given plugin has crashed. When a plugin crashes, all | |
114 // instances associated with that plugin will notify that they've crashed via | |
115 // this function. | |
116 virtual void PluginCrashed(PepperPluginInstanceImpl* instance) = 0; | |
117 | |
118 // Indicates that the given instance has been created. | 111 // Indicates that the given instance has been created. |
119 virtual void InstanceCreated(PepperPluginInstanceImpl* instance) = 0; | 112 virtual void InstanceCreated(PepperPluginInstanceImpl* instance) = 0; |
120 | 113 |
121 // Indicates that the given instance is being destroyed. This is called from | 114 // Indicates that the given instance is being destroyed. This is called from |
122 // the destructor, so it's important that the instance is not dereferenced | 115 // the destructor, so it's important that the instance is not dereferenced |
123 // from this call. | 116 // from this call. |
124 virtual void InstanceDeleted(PepperPluginInstanceImpl* instance) = 0; | 117 virtual void InstanceDeleted(PepperPluginInstanceImpl* instance) = 0; |
125 | 118 |
126 // Sends an async IPC to open a local file. | 119 // Sends an async IPC to open a local file. |
127 typedef base::Callback<void (base::PlatformFileError, base::PassPlatformFile)> | 120 typedef base::Callback<void (base::PlatformFileError, base::PassPlatformFile)> |
128 AsyncOpenFileCallback; | 121 AsyncOpenFileCallback; |
129 virtual bool AsyncOpenFile(const base::FilePath& path, | 122 virtual bool AsyncOpenFile(const base::FilePath& path, |
130 int flags, | 123 int flags, |
131 const AsyncOpenFileCallback& callback) = 0; | 124 const AsyncOpenFileCallback& callback) = 0; |
132 | 125 |
133 // Returns a MessageLoopProxy instance associated with the message loop | 126 // Returns a MessageLoopProxy instance associated with the message loop |
134 // of the file thread in this renderer. | 127 // of the file thread in this renderer. |
135 virtual scoped_refptr<base::MessageLoopProxy> | 128 virtual scoped_refptr<base::MessageLoopProxy> |
136 GetFileThreadMessageLoopProxy() = 0; | 129 GetFileThreadMessageLoopProxy() = 0; |
137 | 130 |
138 // For PPB_TCPSocket_Private. | |
139 virtual uint32 TCPSocketCreate() = 0; | |
140 virtual void TCPSocketConnect(PPB_TCPSocket_Private_Impl* socket, | |
141 uint32 socket_id, | |
142 const std::string& host, | |
143 uint16_t port) = 0; | |
144 virtual void TCPSocketConnectWithNetAddress( | |
145 PPB_TCPSocket_Private_Impl* socket, | |
146 uint32 socket_id, | |
147 const PP_NetAddress_Private& addr) = 0; | |
148 virtual void TCPSocketSSLHandshake( | |
149 uint32 socket_id, | |
150 const std::string& server_name, | |
151 uint16_t server_port, | |
152 const std::vector<std::vector<char> >& trusted_certs, | |
153 const std::vector<std::vector<char> >& untrusted_certs) = 0; | |
154 virtual void TCPSocketRead(uint32 socket_id, int32_t bytes_to_read) = 0; | |
155 virtual void TCPSocketWrite(uint32 socket_id, const std::string& buffer) = 0; | |
156 virtual void TCPSocketDisconnect(uint32 socket_id) = 0; | |
157 virtual void TCPSocketSetOption(uint32 socket_id, | |
158 PP_TCPSocket_Option name, | |
159 const ::ppapi::SocketOptionData& value) = 0; | |
160 virtual void RegisterTCPSocket(PPB_TCPSocket_Private_Impl* socket, | |
161 uint32 socket_id) = 0; | |
162 | |
163 // For PPB_TCPServerSocket_Private. | |
164 virtual void TCPServerSocketListen(PP_Resource socket_resource, | |
165 const PP_NetAddress_Private& addr, | |
166 int32_t backlog) = 0; | |
167 virtual void TCPServerSocketAccept(uint32 server_socket_id) = 0; | |
168 virtual void TCPServerSocketStopListening( | |
169 PP_Resource socket_resource, | |
170 uint32 socket_id) = 0; | |
171 | |
172 // Locks the mouse for |instance|. If false is returned, the lock is not | |
173 // possible. If true is returned then the lock is pending. Success or | |
174 // failure will be delivered asynchronously via | |
175 // PluginInstance::OnLockMouseACK(). | |
176 virtual bool LockMouse(PepperPluginInstanceImpl* instance) = 0; | |
177 | |
178 // Unlocks the mouse if |instance| currently owns the mouse lock. Whenever an | |
179 // plugin instance has lost the mouse lock, it will be notified by | |
180 // PluginInstance::OnMouseLockLost(). Please note that UnlockMouse() is not | |
181 // the only cause of losing mouse lock. For example, a user may press the Esc | |
182 // key to quit the mouse lock mode, which also results in an OnMouseLockLost() | |
183 // call to the current mouse lock owner. | |
184 virtual void UnlockMouse(PepperPluginInstanceImpl* instance) = 0; | |
185 | |
186 // Returns true iff |instance| currently owns the mouse lock. | |
187 virtual bool IsMouseLocked(PepperPluginInstanceImpl* instance) = 0; | |
188 | |
189 // Notifies that |instance| has changed the cursor. | |
190 // This will update the cursor appearance if it is currently over the plugin | |
191 // instance. | |
192 virtual void DidChangeCursor(PepperPluginInstanceImpl* instance, | |
193 const WebKit::WebCursorInfo& cursor) = 0; | |
194 | |
195 // Notifies that |instance| has received a mouse event. | |
196 virtual void DidReceiveMouseEvent(PepperPluginInstanceImpl* instance) = 0; | |
197 | |
198 // Retrieve current gamepad data. | 131 // Retrieve current gamepad data. |
199 virtual void SampleGamepads(WebKit::WebGamepads* data) = 0; | 132 virtual void SampleGamepads(WebKit::WebGamepads* data) = 0; |
200 | 133 |
201 // Notifies the plugin of the document load. This should initiate the call to | 134 // Notifies the plugin of the document load. This should initiate the call to |
202 // PPP_Instance.HandleDocumentLoad. | 135 // PPP_Instance.HandleDocumentLoad. |
203 // | 136 // |
204 // The loader object should set itself on the PluginInstance as the document | 137 // The loader object should set itself on the PluginInstance as the document |
205 // loader using set_document_loader. | 138 // loader using set_document_loader. |
206 virtual void HandleDocumentLoad(PepperPluginInstanceImpl* instance, | 139 virtual void HandleDocumentLoad(PepperPluginInstanceImpl* instance, |
207 const WebKit::WebURLResponse& response) = 0; | 140 const WebKit::WebURLResponse& response) = 0; |
208 | 141 |
209 // Sets up the renderer host and out-of-process proxy for an external plugin | 142 // Sets up the renderer host and out-of-process proxy for an external plugin |
210 // module. Returns the renderer host, or NULL if it couldn't be created. | 143 // module. Returns the renderer host, or NULL if it couldn't be created. |
211 virtual RendererPpapiHost* CreateExternalPluginModule( | 144 virtual RendererPpapiHost* CreateExternalPluginModule( |
212 scoped_refptr<PluginModule> module, | 145 scoped_refptr<PluginModule> module, |
213 const base::FilePath& path, | 146 const base::FilePath& path, |
214 ::ppapi::PpapiPermissions permissions, | 147 ::ppapi::PpapiPermissions permissions, |
215 const IPC::ChannelHandle& channel_handle, | 148 const IPC::ChannelHandle& channel_handle, |
216 base::ProcessId plugin_pid, | 149 base::ProcessId plugin_pid, |
217 int plugin_child_id) = 0; | 150 int plugin_child_id) = 0; |
218 }; | 151 }; |
219 | 152 |
220 } // namespace content | 153 } // namespace content |
221 | 154 |
222 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_H_ | 155 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_H_ |
OLD | NEW |