| 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_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/id_map.h" | 14 #include "base/id_map.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 19 #include "content/public/renderer/render_view_observer.h" | 19 #include "content/public/renderer/render_view_observer.h" |
| 20 #include "content/renderer/mouse_lock_dispatcher.h" | |
| 21 #include "content/renderer/pepper/pepper_browser_connection.h" | 20 #include "content/renderer/pepper/pepper_browser_connection.h" |
| 22 #include "content/renderer/pepper/plugin_delegate.h" | 21 #include "content/renderer/pepper/plugin_delegate.h" |
| 23 #include "content/renderer/render_view_pepper_helper.h" | 22 #include "content/renderer/render_view_pepper_helper.h" |
| 24 #include "ppapi/c/pp_file_info.h" | 23 #include "ppapi/c/pp_file_info.h" |
| 24 #include "ppapi/c/ppb_tcp_socket.h" |
| 25 #include "ppapi/c/private/ppb_tcp_socket_private.h" |
| 25 #include "ppapi/shared_impl/private/ppb_tcp_server_socket_shared.h" | 26 #include "ppapi/shared_impl/private/ppb_tcp_server_socket_shared.h" |
| 26 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" | 27 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" |
| 27 #include "ui/base/ime/text_input_type.h" | 28 #include "ui/base/ime/text_input_type.h" |
| 28 | 29 |
| 29 namespace base { | 30 namespace base { |
| 30 class FilePath; | 31 class FilePath; |
| 31 } | 32 } |
| 32 | 33 |
| 33 namespace ppapi { | 34 namespace ppapi { |
| 34 class PepperFilePath; | 35 class PepperFilePath; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 70 |
| 70 // A pointer is returned immediately, but it is not ready to be used until | 71 // A pointer is returned immediately, but it is not ready to be used until |
| 71 // BrokerConnected has been called. | 72 // BrokerConnected has been called. |
| 72 // The caller is responsible for calling Disconnect() on the returned pointer | 73 // The caller is responsible for calling Disconnect() on the returned pointer |
| 73 // to clean up the corresponding resources allocated during this call. | 74 // to clean up the corresponding resources allocated during this call. |
| 74 PepperBroker* ConnectToBroker(PPB_Broker_Impl* client); | 75 PepperBroker* ConnectToBroker(PPB_Broker_Impl* client); |
| 75 | 76 |
| 76 // Removes broker from pending_connect_broker_ if present. Returns true if so. | 77 // Removes broker from pending_connect_broker_ if present. Returns true if so. |
| 77 bool StopWaitingForBrokerConnection(PepperBroker* broker); | 78 bool StopWaitingForBrokerConnection(PepperBroker* broker); |
| 78 | 79 |
| 79 CONTENT_EXPORT int GetRoutingID() const; | 80 void RegisterTCPSocket(PPB_TCPSocket_Private_Impl* socket, uint32 socket_id); |
| 81 void UnregisterTCPSocket(uint32 socket_id); |
| 82 void TCPServerSocketStopListening(uint32 socket_id); |
| 83 |
| 84 // Notifies that |instance| has changed the cursor. |
| 85 // This will update the cursor appearance if it is currently over the plugin |
| 86 // instance. |
| 87 void DidChangeCursor(PepperPluginInstanceImpl* instance, |
| 88 const WebKit::WebCursorInfo& cursor); |
| 89 |
| 90 // Notifies that |instance| has received a mouse event. |
| 91 void DidReceiveMouseEvent(PepperPluginInstanceImpl* instance); |
| 80 | 92 |
| 81 private: | 93 private: |
| 82 // RenderViewPepperHelper implementation. | 94 // RenderViewPepperHelper implementation. |
| 83 virtual WebKit::WebPlugin* CreatePepperWebPlugin( | 95 virtual WebKit::WebPlugin* CreatePepperWebPlugin( |
| 84 const WebPluginInfo& webplugin_info, | 96 const WebPluginInfo& webplugin_info, |
| 85 const WebKit::WebPluginParams& params) OVERRIDE; | 97 const WebKit::WebPluginParams& params) OVERRIDE; |
| 86 virtual void ViewWillInitiatePaint() OVERRIDE; | 98 virtual void ViewWillInitiatePaint() OVERRIDE; |
| 87 virtual void ViewInitiatedPaint() OVERRIDE; | 99 virtual void ViewInitiatedPaint() OVERRIDE; |
| 88 virtual void ViewFlushedPaint() OVERRIDE; | 100 virtual void ViewFlushedPaint() OVERRIDE; |
| 89 virtual PepperPluginInstanceImpl* GetBitmapForOptimizedPluginPaint( | 101 virtual PepperPluginInstanceImpl* GetBitmapForOptimizedPluginPaint( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 113 virtual void PluginFocusChanged(PepperPluginInstanceImpl* instance, | 125 virtual void PluginFocusChanged(PepperPluginInstanceImpl* instance, |
| 114 bool focused) OVERRIDE; | 126 bool focused) OVERRIDE; |
| 115 virtual void PluginTextInputTypeChanged( | 127 virtual void PluginTextInputTypeChanged( |
| 116 PepperPluginInstanceImpl* instance) OVERRIDE; | 128 PepperPluginInstanceImpl* instance) OVERRIDE; |
| 117 virtual void PluginCaretPositionChanged( | 129 virtual void PluginCaretPositionChanged( |
| 118 PepperPluginInstanceImpl* instance) OVERRIDE; | 130 PepperPluginInstanceImpl* instance) OVERRIDE; |
| 119 virtual void PluginRequestedCancelComposition( | 131 virtual void PluginRequestedCancelComposition( |
| 120 PepperPluginInstanceImpl* instance) OVERRIDE; | 132 PepperPluginInstanceImpl* instance) OVERRIDE; |
| 121 virtual void PluginSelectionChanged( | 133 virtual void PluginSelectionChanged( |
| 122 PepperPluginInstanceImpl* instance) OVERRIDE; | 134 PepperPluginInstanceImpl* instance) OVERRIDE; |
| 123 virtual void PluginCrashed(PepperPluginInstanceImpl* instance) OVERRIDE; | |
| 124 virtual void InstanceCreated(PepperPluginInstanceImpl* instance) OVERRIDE; | 135 virtual void InstanceCreated(PepperPluginInstanceImpl* instance) OVERRIDE; |
| 125 virtual void InstanceDeleted(PepperPluginInstanceImpl* instance) OVERRIDE; | 136 virtual void InstanceDeleted(PepperPluginInstanceImpl* instance) OVERRIDE; |
| 126 virtual bool AsyncOpenFile(const base::FilePath& path, | 137 virtual bool AsyncOpenFile(const base::FilePath& path, |
| 127 int flags, | 138 int flags, |
| 128 const AsyncOpenFileCallback& callback) OVERRIDE; | 139 const AsyncOpenFileCallback& callback) OVERRIDE; |
| 129 virtual scoped_refptr<base::MessageLoopProxy> | 140 virtual scoped_refptr<base::MessageLoopProxy> |
| 130 GetFileThreadMessageLoopProxy() OVERRIDE; | 141 GetFileThreadMessageLoopProxy() OVERRIDE; |
| 131 virtual uint32 TCPSocketCreate() OVERRIDE; | |
| 132 virtual void TCPSocketConnect(PPB_TCPSocket_Private_Impl* socket, | |
| 133 uint32 socket_id, | |
| 134 const std::string& host, | |
| 135 uint16_t port) OVERRIDE; | |
| 136 virtual void TCPSocketConnectWithNetAddress( | |
| 137 PPB_TCPSocket_Private_Impl* socket, | |
| 138 uint32 socket_id, | |
| 139 const PP_NetAddress_Private& addr) OVERRIDE; | |
| 140 virtual void TCPSocketSSLHandshake( | |
| 141 uint32 socket_id, | |
| 142 const std::string& server_name, | |
| 143 uint16_t server_port, | |
| 144 const std::vector<std::vector<char> >& trusted_certs, | |
| 145 const std::vector<std::vector<char> >& untrusted_certs) OVERRIDE; | |
| 146 virtual void TCPSocketRead(uint32 socket_id, int32_t bytes_to_read) OVERRIDE; | |
| 147 virtual void TCPSocketWrite(uint32 socket_id, | |
| 148 const std::string& buffer) OVERRIDE; | |
| 149 virtual void TCPSocketDisconnect(uint32 socket_id) OVERRIDE; | |
| 150 virtual void TCPSocketSetOption( | |
| 151 uint32 socket_id, | |
| 152 PP_TCPSocket_Option name, | |
| 153 const ppapi::SocketOptionData& value) OVERRIDE; | |
| 154 virtual void RegisterTCPSocket(PPB_TCPSocket_Private_Impl* socket, | |
| 155 uint32 socket_id) OVERRIDE; | |
| 156 virtual void TCPServerSocketListen( | |
| 157 PP_Resource socket_resource, | |
| 158 const PP_NetAddress_Private& addr, | |
| 159 int32_t backlog) OVERRIDE; | |
| 160 virtual void TCPServerSocketAccept(uint32 server_socket_id) OVERRIDE; | |
| 161 virtual void TCPServerSocketStopListening( | |
| 162 PP_Resource socket_resource, | |
| 163 uint32 socket_id) OVERRIDE; | |
| 164 virtual bool LockMouse(PepperPluginInstanceImpl* instance) OVERRIDE; | |
| 165 virtual void UnlockMouse(PepperPluginInstanceImpl* instance) OVERRIDE; | |
| 166 virtual bool IsMouseLocked(PepperPluginInstanceImpl* instance) OVERRIDE; | |
| 167 virtual void DidChangeCursor(PepperPluginInstanceImpl* instance, | |
| 168 const WebKit::WebCursorInfo& cursor) OVERRIDE; | |
| 169 virtual void DidReceiveMouseEvent( | |
| 170 PepperPluginInstanceImpl* instance) OVERRIDE; | |
| 171 virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE; | 142 virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE; |
| 172 virtual void HandleDocumentLoad( | 143 virtual void HandleDocumentLoad( |
| 173 PepperPluginInstanceImpl* instance, | 144 PepperPluginInstanceImpl* instance, |
| 174 const WebKit::WebURLResponse& response) OVERRIDE; | 145 const WebKit::WebURLResponse& response) OVERRIDE; |
| 175 virtual RendererPpapiHost* CreateExternalPluginModule( | 146 virtual RendererPpapiHost* CreateExternalPluginModule( |
| 176 scoped_refptr<PluginModule> module, | 147 scoped_refptr<PluginModule> module, |
| 177 const base::FilePath& path, | 148 const base::FilePath& path, |
| 178 ::ppapi::PpapiPermissions permissions, | 149 ::ppapi::PpapiPermissions permissions, |
| 179 const IPC::ChannelHandle& channel_handle, | 150 const IPC::ChannelHandle& channel_handle, |
| 180 base::ProcessId plugin_pid, | 151 base::ProcessId plugin_pid, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // and perform other common initialization. | 213 // and perform other common initialization. |
| 243 RendererPpapiHost* CreateOutOfProcessModule( | 214 RendererPpapiHost* CreateOutOfProcessModule( |
| 244 PluginModule* module, | 215 PluginModule* module, |
| 245 const base::FilePath& path, | 216 const base::FilePath& path, |
| 246 ppapi::PpapiPermissions permissions, | 217 ppapi::PpapiPermissions permissions, |
| 247 const IPC::ChannelHandle& channel_handle, | 218 const IPC::ChannelHandle& channel_handle, |
| 248 base::ProcessId plugin_pid, | 219 base::ProcessId plugin_pid, |
| 249 int plugin_child_id, | 220 int plugin_child_id, |
| 250 bool is_external); | 221 bool is_external); |
| 251 | 222 |
| 252 MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter( | |
| 253 PepperPluginInstanceImpl* instance); | |
| 254 void UnSetAndDeleteLockTargetAdapter(PepperPluginInstanceImpl* instance); | |
| 255 | |
| 256 MouseLockDispatcher* GetMouseLockDispatcher( | |
| 257 PepperPluginInstanceImpl* instance); | |
| 258 | |
| 259 // Pointer to the RenderView that owns us. | 223 // Pointer to the RenderView that owns us. |
| 260 RenderViewImpl* render_view_; | 224 RenderViewImpl* render_view_; |
| 261 | 225 |
| 262 // Connection for sending and receiving pepper host-related messages to/from | 226 // Connection for sending and receiving pepper host-related messages to/from |
| 263 // the browser. | 227 // the browser. |
| 264 PepperBrowserConnection pepper_browser_connection_; | 228 PepperBrowserConnection pepper_browser_connection_; |
| 265 | 229 |
| 266 std::set<PepperPluginInstanceImpl*> active_instances_; | 230 std::set<PepperPluginInstanceImpl*> active_instances_; |
| 267 typedef std::map<PepperPluginInstanceImpl*, | |
| 268 MouseLockDispatcher::LockTarget*> LockTargetMap; | |
| 269 LockTargetMap mouse_lock_instances_; | |
| 270 | 231 |
| 271 IDMap<AsyncOpenFileCallback> pending_async_open_files_; | 232 IDMap<AsyncOpenFileCallback> pending_async_open_files_; |
| 272 | 233 |
| 273 IDMap<PPB_TCPSocket_Private_Impl> tcp_sockets_; | 234 IDMap<PPB_TCPSocket_Private_Impl> tcp_sockets_; |
| 274 | 235 |
| 275 IDMap<ppapi::PPB_TCPServerSocket_Shared> tcp_server_sockets_; | 236 IDMap<ppapi::PPB_TCPServerSocket_Shared> tcp_server_sockets_; |
| 276 | 237 |
| 277 typedef IDMap<scoped_refptr<PepperBroker>, IDMapOwnPointer> BrokerMap; | 238 typedef IDMap<scoped_refptr<PepperBroker>, IDMapOwnPointer> BrokerMap; |
| 278 BrokerMap pending_connect_broker_; | 239 BrokerMap pending_connect_broker_; |
| 279 | 240 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 296 scoped_ptr<GamepadSharedMemoryReader> gamepad_shared_memory_reader_; | 257 scoped_ptr<GamepadSharedMemoryReader> gamepad_shared_memory_reader_; |
| 297 | 258 |
| 298 scoped_refptr<ContextProviderCommandBuffer> offscreen_context3d_; | 259 scoped_refptr<ContextProviderCommandBuffer> offscreen_context3d_; |
| 299 | 260 |
| 300 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); | 261 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); |
| 301 }; | 262 }; |
| 302 | 263 |
| 303 } // namespace content | 264 } // namespace content |
| 304 | 265 |
| 305 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 266 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
| OLD | NEW |