| 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 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 16 #include "base/file_util_proxy.h" | 16 #include "base/file_util_proxy.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/string_split.h" | 18 #include "base/string_split.h" |
| 19 #include "base/sync_socket.h" | 19 #include "base/sync_socket.h" |
| 20 #include "base/time.h" | 20 #include "base/time.h" |
| 21 #include "content/common/child_process.h" | 21 #include "content/common/child_process.h" |
| 22 #include "content/common/child_process_messages.h" | 22 #include "content/common/child_process_messages.h" |
| 23 #include "content/common/child_thread.h" | 23 #include "content/common/child_thread.h" |
| 24 #include "content/common/fileapi/file_system_dispatcher.h" | 24 #include "content/common/fileapi/file_system_dispatcher.h" |
| 25 #include "content/common/fileapi/file_system_messages.h" | 25 #include "content/common/fileapi/file_system_messages.h" |
| 26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 27 #include "content/common/pepper_messages.h" |
| 27 #include "content/common/pepper_plugin_registry.h" | 28 #include "content/common/pepper_plugin_registry.h" |
| 28 #include "content/common/pepper_messages.h" | |
| 29 #include "content/common/quota_dispatcher.h" | 29 #include "content/common/quota_dispatcher.h" |
| 30 #include "content/common/view_messages.h" | 30 #include "content/common/view_messages.h" |
| 31 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
| 32 #include "content/public/common/context_menu_params.h" | 32 #include "content/public/common/context_menu_params.h" |
| 33 #include "content/public/common/media_stream_request.h" | 33 #include "content/public/common/media_stream_request.h" |
| 34 #include "content/public/common/referrer.h" | 34 #include "content/public/common/referrer.h" |
| 35 #include "content/public/renderer/content_renderer_client.h" | 35 #include "content/public/renderer/content_renderer_client.h" |
| 36 #include "content/public/renderer/renderer_restrict_dispatch_group.h" | 36 #include "content/public/renderer/renderer_restrict_dispatch_group.h" |
| 37 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" | 37 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" |
| 38 #include "content/renderer/browser_plugin/old/browser_plugin_registry.h" | 38 #include "content/renderer/browser_plugin/old/browser_plugin_registry.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
| 80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 81 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 81 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 82 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 82 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 83 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 83 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 84 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 84 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
| 85 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 85 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 86 #include "ui/gfx/size.h" | 86 #include "ui/gfx/size.h" |
| 87 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 87 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 88 #include "webkit/plugins/npapi/webplugin.h" | 88 #include "webkit/plugins/npapi/webplugin.h" |
| 89 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" | |
| 90 #include "webkit/plugins/ppapi/plugin_module.h" | 89 #include "webkit/plugins/ppapi/plugin_module.h" |
| 91 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 90 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 91 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" |
| 92 #include "webkit/plugins/ppapi/ppb_flash_impl.h" | 92 #include "webkit/plugins/ppapi/ppb_flash_impl.h" |
| 93 #include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h" | 93 #include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h" |
| 94 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" | 94 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" |
| 95 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" | 95 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" |
| 96 #include "webkit/plugins/ppapi/resource_helper.h" | 96 #include "webkit/plugins/ppapi/resource_helper.h" |
| 97 #include "webkit/plugins/webplugininfo.h" | 97 #include "webkit/plugins/webplugininfo.h" |
| 98 | 98 |
| 99 using WebKit::WebView; | 99 using WebKit::WebView; |
| 100 using WebKit::WebFrame; | 100 using WebKit::WebFrame; |
| 101 | 101 |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 tcp_sockets_.AddWithID(socket, socket_id); | 1118 tcp_sockets_.AddWithID(socket, socket_id); |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 uint32 PepperPluginDelegateImpl::UDPSocketCreate() { | 1121 uint32 PepperPluginDelegateImpl::UDPSocketCreate() { |
| 1122 uint32 socket_id = 0; | 1122 uint32 socket_id = 0; |
| 1123 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Create( | 1123 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Create( |
| 1124 render_view_->routing_id(), 0, &socket_id)); | 1124 render_view_->routing_id(), 0, &socket_id)); |
| 1125 return socket_id; | 1125 return socket_id; |
| 1126 } | 1126 } |
| 1127 | 1127 |
| 1128 void PepperPluginDelegateImpl::UDPSocketSetSocketFeature( |
| 1129 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket, |
| 1130 uint32 socket_id, |
| 1131 PP_UDPSocketFeature_Private name, |
| 1132 PP_Var value) { |
| 1133 if (!udp_sockets_.Lookup(socket_id)) |
| 1134 udp_sockets_.AddWithID(socket, socket_id); |
| 1135 switch (name) { |
| 1136 case PP_UDPSOCKETFEATURE_ADDRESS_REUSE: |
| 1137 case PP_UDPSOCKETFEATURE_BROADCAST: |
| 1138 DCHECK_EQ(PP_VARTYPE_BOOL, value.type); |
| 1139 render_view_->Send( |
| 1140 new PpapiHostMsg_PPBUDPSocket_SetBoolSocketFeature( |
| 1141 render_view_->routing_id(), socket_id, |
| 1142 name, (value.value.as_bool == PP_TRUE))); |
| 1143 break; |
| 1144 default: |
| 1145 NOTREACHED(); |
| 1146 } |
| 1147 } |
| 1148 |
| 1128 void PepperPluginDelegateImpl::UDPSocketBind( | 1149 void PepperPluginDelegateImpl::UDPSocketBind( |
| 1129 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket, | 1150 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket, |
| 1130 uint32 socket_id, | 1151 uint32 socket_id, |
| 1131 const PP_NetAddress_Private& addr) { | 1152 const PP_NetAddress_Private& addr) { |
| 1132 udp_sockets_.AddWithID(socket, socket_id); | 1153 if (!udp_sockets_.Lookup(socket_id)) |
| 1154 udp_sockets_.AddWithID(socket, socket_id); |
| 1133 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Bind( | 1155 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Bind( |
| 1134 render_view_->routing_id(), socket_id, addr)); | 1156 render_view_->routing_id(), socket_id, addr)); |
| 1135 } | 1157 } |
| 1136 | 1158 |
| 1137 void PepperPluginDelegateImpl::UDPSocketRecvFrom(uint32 socket_id, | 1159 void PepperPluginDelegateImpl::UDPSocketRecvFrom(uint32 socket_id, |
| 1138 int32_t num_bytes) { | 1160 int32_t num_bytes) { |
| 1139 DCHECK(udp_sockets_.Lookup(socket_id)); | 1161 DCHECK(udp_sockets_.Lookup(socket_id)); |
| 1140 render_view_->Send( | 1162 render_view_->Send( |
| 1141 new PpapiHostMsg_PPBUDPSocket_RecvFrom(socket_id, num_bytes)); | 1163 new PpapiHostMsg_PPBUDPSocket_RecvFrom(socket_id, num_bytes)); |
| 1142 } | 1164 } |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 | 1530 |
| 1509 bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) { | 1531 bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) { |
| 1510 bool handled = true; | 1532 bool handled = true; |
| 1511 IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message) | 1533 IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message) |
| 1512 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, | 1534 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, |
| 1513 OnTCPSocketConnectACK) | 1535 OnTCPSocketConnectACK) |
| 1514 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, | 1536 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, |
| 1515 OnTCPSocketSSLHandshakeACK) | 1537 OnTCPSocketSSLHandshakeACK) |
| 1516 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) | 1538 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) |
| 1517 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) | 1539 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) |
| 1540 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SetSocketFeatureACK, |
| 1541 OnUDPSocketSetSocketFeatureACK) |
| 1518 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK) | 1542 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK) |
| 1519 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK, | 1543 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK, |
| 1520 OnUDPSocketRecvFromACK) | 1544 OnUDPSocketRecvFromACK) |
| 1521 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK, OnUDPSocketSendToACK) | 1545 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK, OnUDPSocketSendToACK) |
| 1522 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_ListenACK, | 1546 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_ListenACK, |
| 1523 OnTCPServerSocketListenACK) | 1547 OnTCPServerSocketListenACK) |
| 1524 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_AcceptACK, | 1548 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_AcceptACK, |
| 1525 OnTCPServerSocketAcceptACK) | 1549 OnTCPServerSocketAcceptACK) |
| 1526 IPC_MESSAGE_HANDLER(PpapiMsg_PPBHostResolver_ResolveACK, | 1550 IPC_MESSAGE_HANDLER(PpapiMsg_PPBHostResolver_ResolveACK, |
| 1527 OnHostResolverResolveACK) | 1551 OnHostResolverResolveACK) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1574 void PepperPluginDelegateImpl::OnTCPSocketWriteACK(uint32 plugin_dispatcher_id, | 1598 void PepperPluginDelegateImpl::OnTCPSocketWriteACK(uint32 plugin_dispatcher_id, |
| 1575 uint32 socket_id, | 1599 uint32 socket_id, |
| 1576 bool succeeded, | 1600 bool succeeded, |
| 1577 int32_t bytes_written) { | 1601 int32_t bytes_written) { |
| 1578 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = | 1602 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = |
| 1579 tcp_sockets_.Lookup(socket_id); | 1603 tcp_sockets_.Lookup(socket_id); |
| 1580 if (socket) | 1604 if (socket) |
| 1581 socket->OnWriteCompleted(succeeded, bytes_written); | 1605 socket->OnWriteCompleted(succeeded, bytes_written); |
| 1582 } | 1606 } |
| 1583 | 1607 |
| 1608 void PepperPluginDelegateImpl::OnUDPSocketSetSocketFeatureACK( |
| 1609 uint32 plugin_dispatcher_id, |
| 1610 uint32 socket_id, |
| 1611 bool succeeded) { |
| 1612 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = |
| 1613 udp_sockets_.Lookup(socket_id); |
| 1614 if (socket) |
| 1615 socket->OnSetSocketFeatureCompleted(succeeded); |
| 1616 } |
| 1617 |
| 1584 void PepperPluginDelegateImpl::OnUDPSocketBindACK( | 1618 void PepperPluginDelegateImpl::OnUDPSocketBindACK( |
| 1585 uint32 plugin_dispatcher_id, | 1619 uint32 plugin_dispatcher_id, |
| 1586 uint32 socket_id, | 1620 uint32 socket_id, |
| 1587 bool succeeded, | 1621 bool succeeded, |
| 1588 const PP_NetAddress_Private& addr) { | 1622 const PP_NetAddress_Private& addr) { |
| 1589 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = | 1623 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = |
| 1590 udp_sockets_.Lookup(socket_id); | 1624 udp_sockets_.Lookup(socket_id); |
| 1591 if (socket) | 1625 if (socket) |
| 1592 socket->OnBindCompleted(succeeded, addr); | 1626 socket->OnBindCompleted(succeeded, addr); |
| 1593 if (!succeeded) | 1627 if (!succeeded) |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1764 else | 1798 else |
| 1765 return render_view_->mouse_lock_dispatcher(); | 1799 return render_view_->mouse_lock_dispatcher(); |
| 1766 } | 1800 } |
| 1767 | 1801 |
| 1768 webkit_glue::ClipboardClient* | 1802 webkit_glue::ClipboardClient* |
| 1769 PepperPluginDelegateImpl::CreateClipboardClient() const { | 1803 PepperPluginDelegateImpl::CreateClipboardClient() const { |
| 1770 return new RendererClipboardClient; | 1804 return new RendererClipboardClient; |
| 1771 } | 1805 } |
| 1772 | 1806 |
| 1773 } // namespace content | 1807 } // namespace content |
| OLD | NEW |