| 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_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper_plugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <queue> | |
| 9 | 8 |
| 10 #include "base/bind.h" | 9 #include "base/bind.h" |
| 11 #include "base/callback.h" | 10 #include "base/callback.h" |
| 12 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 13 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 14 #include "base/file_util_proxy.h" | 13 #include "base/file_util_proxy.h" |
| 15 #include "base/logging.h" | 14 #include "base/logging.h" |
| 16 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 18 #include "base/string_split.h" | 17 #include "base/string_split.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 68 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 70 #include "webkit/glue/context_menu.h" | 69 #include "webkit/glue/context_menu.h" |
| 71 #include "webkit/plugins/npapi/webplugin.h" | 70 #include "webkit/plugins/npapi/webplugin.h" |
| 72 #include "webkit/plugins/ppapi/file_path.h" | 71 #include "webkit/plugins/ppapi/file_path.h" |
| 73 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" | 72 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" |
| 74 #include "webkit/plugins/ppapi/plugin_module.h" | 73 #include "webkit/plugins/ppapi/plugin_module.h" |
| 75 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 74 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 76 #include "webkit/plugins/ppapi/ppb_broker_impl.h" | 75 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
| 77 #include "webkit/plugins/ppapi/ppb_flash_impl.h" | 76 #include "webkit/plugins/ppapi/ppb_flash_impl.h" |
| 78 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" | 77 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" |
| 78 #include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h" |
| 79 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" | 79 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" |
| 80 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" | 80 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" |
| 81 #include "webkit/plugins/ppapi/resource_helper.h" | 81 #include "webkit/plugins/ppapi/resource_helper.h" |
| 82 #include "webkit/plugins/webplugininfo.h" | 82 #include "webkit/plugins/webplugininfo.h" |
| 83 | 83 |
| 84 using WebKit::WebView; | 84 using WebKit::WebView; |
| 85 using WebKit::WebFrame; | 85 using WebKit::WebFrame; |
| 86 | 86 |
| 87 namespace { | 87 namespace { |
| 88 | 88 |
| (...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Create( | 1656 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Create( |
| 1657 render_view_->routing_id(), 0, &socket_id)); | 1657 render_view_->routing_id(), 0, &socket_id)); |
| 1658 return socket_id; | 1658 return socket_id; |
| 1659 } | 1659 } |
| 1660 | 1660 |
| 1661 void PepperPluginDelegateImpl::TCPSocketConnect( | 1661 void PepperPluginDelegateImpl::TCPSocketConnect( |
| 1662 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket, | 1662 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket, |
| 1663 uint32 socket_id, | 1663 uint32 socket_id, |
| 1664 const std::string& host, | 1664 const std::string& host, |
| 1665 uint16_t port) { | 1665 uint16_t port) { |
| 1666 tcp_sockets_.AddWithID(socket, socket_id); | 1666 RegisterTCPSocket(socket, socket_id); |
| 1667 render_view_->Send( | 1667 render_view_->Send( |
| 1668 new PpapiHostMsg_PPBTCPSocket_Connect(socket_id, host, port)); | 1668 new PpapiHostMsg_PPBTCPSocket_Connect(socket_id, host, port)); |
| 1669 } | 1669 } |
| 1670 | 1670 |
| 1671 void PepperPluginDelegateImpl::TCPSocketConnectWithNetAddress( | 1671 void PepperPluginDelegateImpl::TCPSocketConnectWithNetAddress( |
| 1672 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket, | 1672 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket, |
| 1673 uint32 socket_id, | 1673 uint32 socket_id, |
| 1674 const PP_NetAddress_Private& addr) { | 1674 const PP_NetAddress_Private& addr) { |
| 1675 tcp_sockets_.AddWithID(socket, socket_id); | 1675 RegisterTCPSocket(socket, socket_id); |
| 1676 render_view_->Send( | 1676 render_view_->Send( |
| 1677 new PpapiHostMsg_PPBTCPSocket_ConnectWithNetAddress(socket_id, addr)); | 1677 new PpapiHostMsg_PPBTCPSocket_ConnectWithNetAddress(socket_id, addr)); |
| 1678 } | 1678 } |
| 1679 | 1679 |
| 1680 void PepperPluginDelegateImpl::TCPSocketSSLHandshake( | 1680 void PepperPluginDelegateImpl::TCPSocketSSLHandshake( |
| 1681 uint32 socket_id, | 1681 uint32 socket_id, |
| 1682 const std::string& server_name, | 1682 const std::string& server_name, |
| 1683 uint16_t server_port) { | 1683 uint16_t server_port) { |
| 1684 DCHECK(tcp_sockets_.Lookup(socket_id)); | 1684 DCHECK(tcp_sockets_.Lookup(socket_id)); |
| 1685 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_SSLHandshake( | 1685 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_SSLHandshake( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1700 } | 1700 } |
| 1701 | 1701 |
| 1702 void PepperPluginDelegateImpl::TCPSocketDisconnect(uint32 socket_id) { | 1702 void PepperPluginDelegateImpl::TCPSocketDisconnect(uint32 socket_id) { |
| 1703 // There are no DCHECK(tcp_sockets_.Lookup(socket_id)) because it | 1703 // There are no DCHECK(tcp_sockets_.Lookup(socket_id)) because it |
| 1704 // can be called before | 1704 // can be called before |
| 1705 // TCPSocketConnect/TCPSocketConnectWithNetAddress is called. | 1705 // TCPSocketConnect/TCPSocketConnectWithNetAddress is called. |
| 1706 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id)); | 1706 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id)); |
| 1707 tcp_sockets_.Remove(socket_id); | 1707 tcp_sockets_.Remove(socket_id); |
| 1708 } | 1708 } |
| 1709 | 1709 |
| 1710 void PepperPluginDelegateImpl::RegisterTCPSocket( |
| 1711 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket, |
| 1712 uint32 socket_id) { |
| 1713 tcp_sockets_.AddWithID(socket, socket_id); |
| 1714 } |
| 1715 |
| 1710 uint32 PepperPluginDelegateImpl::UDPSocketCreate() { | 1716 uint32 PepperPluginDelegateImpl::UDPSocketCreate() { |
| 1711 if (!CanUseSocketAPIs()) | 1717 if (!CanUseSocketAPIs()) |
| 1712 return 0; | 1718 return 0; |
| 1713 | 1719 |
| 1714 uint32 socket_id = 0; | 1720 uint32 socket_id = 0; |
| 1715 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Create( | 1721 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Create( |
| 1716 render_view_->routing_id(), 0, &socket_id)); | 1722 render_view_->routing_id(), 0, &socket_id)); |
| 1717 return socket_id; | 1723 return socket_id; |
| 1718 } | 1724 } |
| 1719 | 1725 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1741 new PpapiHostMsg_PPBUDPSocket_SendTo(socket_id, buffer, net_addr)); | 1747 new PpapiHostMsg_PPBUDPSocket_SendTo(socket_id, buffer, net_addr)); |
| 1742 } | 1748 } |
| 1743 | 1749 |
| 1744 void PepperPluginDelegateImpl::UDPSocketClose(uint32 socket_id) { | 1750 void PepperPluginDelegateImpl::UDPSocketClose(uint32 socket_id) { |
| 1745 // There are no DCHECK(udp_sockets_.Lookup(socket_id)) because it | 1751 // There are no DCHECK(udp_sockets_.Lookup(socket_id)) because it |
| 1746 // can be called before UDPSocketBind is called. | 1752 // can be called before UDPSocketBind is called. |
| 1747 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Close(socket_id)); | 1753 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Close(socket_id)); |
| 1748 udp_sockets_.Remove(socket_id); | 1754 udp_sockets_.Remove(socket_id); |
| 1749 } | 1755 } |
| 1750 | 1756 |
| 1757 bool PepperPluginDelegateImpl::TCPServerSocketInitialize( |
| 1758 webkit::ppapi::PPB_TCPServerSocket_Private_Impl* socket) { |
| 1759 DCHECK(socket != NULL); |
| 1760 if (!CanUseSocketAPIs()) |
| 1761 return false; |
| 1762 |
| 1763 uninitialized_tcp_server_sockets_.push_back(socket); |
| 1764 tcp_server_sockets_positions_[socket] = |
| 1765 --uninitialized_tcp_server_sockets_.end(); |
| 1766 render_view_->Send(new PpapiHostMsg_PPBTCPServerSocket_Initialize( |
| 1767 render_view_->routing_id(), 0)); |
| 1768 return true; |
| 1769 } |
| 1770 |
| 1771 void PepperPluginDelegateImpl::TCPServerSocketListen( |
| 1772 webkit::ppapi::PPB_TCPServerSocket_Private_Impl* socket, |
| 1773 uint32 socket_id, |
| 1774 const PP_NetAddress_Private& addr, |
| 1775 int32_t backlog) { |
| 1776 tcp_server_sockets_.AddWithID(socket, socket_id); |
| 1777 render_view_->Send( |
| 1778 new PpapiHostMsg_PPBTCPServerSocket_Listen(socket_id, addr, backlog)); |
| 1779 } |
| 1780 |
| 1781 void PepperPluginDelegateImpl::TCPServerSocketAccept(uint32 socket_id) { |
| 1782 DCHECK(tcp_server_sockets_.Lookup(socket_id)); |
| 1783 render_view_->Send(new PpapiHostMsg_PPBTCPServerSocket_Accept(socket_id)); |
| 1784 } |
| 1785 |
| 1786 void PepperPluginDelegateImpl::TCPServerSocketStopListening(uint32 socket_id) { |
| 1787 // There are no DCHECK(tcp_server_sockets_.Lookup(socket_id)) |
| 1788 // because it can be called before TCPServerSocketListen is called. |
| 1789 render_view_->Send( |
| 1790 new PpapiHostMsg_PPBTCPServerSocket_StopListening(socket_id)); |
| 1791 tcp_server_sockets_.Remove(socket_id); |
| 1792 } |
| 1793 |
| 1794 void PepperPluginDelegateImpl::CancelInitializationOfTCPServerSocket( |
| 1795 webkit::ppapi::PPB_TCPServerSocket_Private_Impl* socket) { |
| 1796 TCPServerSocketMap::iterator it = tcp_server_sockets_positions_.find(socket); |
| 1797 DCHECK(it != tcp_server_sockets_positions_.end()); |
| 1798 |
| 1799 uninitialized_tcp_server_sockets_.erase(it->second); |
| 1800 tcp_server_sockets_positions_.erase(it); |
| 1801 } |
| 1802 |
| 1751 int32_t PepperPluginDelegateImpl::ShowContextMenu( | 1803 int32_t PepperPluginDelegateImpl::ShowContextMenu( |
| 1752 webkit::ppapi::PluginInstance* instance, | 1804 webkit::ppapi::PluginInstance* instance, |
| 1753 webkit::ppapi::PPB_Flash_Menu_Impl* menu, | 1805 webkit::ppapi::PPB_Flash_Menu_Impl* menu, |
| 1754 const gfx::Point& position) { | 1806 const gfx::Point& position) { |
| 1755 int32 render_widget_id = render_view_->routing_id(); | 1807 int32 render_widget_id = render_view_->routing_id(); |
| 1756 if (instance->FlashIsFullscreen(instance->pp_instance())) { | 1808 if (instance->FlashIsFullscreen(instance->pp_instance())) { |
| 1757 webkit::ppapi::FullscreenContainer* container = | 1809 webkit::ppapi::FullscreenContainer* container = |
| 1758 instance->fullscreen_container(); | 1810 instance->fullscreen_container(); |
| 1759 DCHECK(container); | 1811 DCHECK(container); |
| 1760 render_widget_id = | 1812 render_widget_id = |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, | 2023 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, |
| 1972 OnTCPSocketConnectACK) | 2024 OnTCPSocketConnectACK) |
| 1973 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, | 2025 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, |
| 1974 OnTCPSocketSSLHandshakeACK) | 2026 OnTCPSocketSSLHandshakeACK) |
| 1975 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) | 2027 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) |
| 1976 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) | 2028 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) |
| 1977 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK) | 2029 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK) |
| 1978 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK, | 2030 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK, |
| 1979 OnUDPSocketRecvFromACK) | 2031 OnUDPSocketRecvFromACK) |
| 1980 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK, OnUDPSocketSendToACK) | 2032 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK, OnUDPSocketSendToACK) |
| 2033 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_InitializeACK, |
| 2034 OnTCPServerSocketInitializeACK) |
| 2035 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_ListenACK, |
| 2036 OnTCPServerSocketListenACK) |
| 2037 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_AcceptACK, |
| 2038 OnTCPServerSocketAcceptACK) |
| 1981 IPC_MESSAGE_UNHANDLED(handled = false) | 2039 IPC_MESSAGE_UNHANDLED(handled = false) |
| 1982 IPC_END_MESSAGE_MAP() | 2040 IPC_END_MESSAGE_MAP() |
| 1983 return handled; | 2041 return handled; |
| 1984 } | 2042 } |
| 1985 | 2043 |
| 1986 void PepperPluginDelegateImpl::OnDestruct() { | 2044 void PepperPluginDelegateImpl::OnDestruct() { |
| 1987 // Nothing to do here. Default implementation in RenderViewObserver does | 2045 // Nothing to do here. Default implementation in RenderViewObserver does |
| 1988 // 'delete this' but it's not suitable for PepperPluginDelegateImpl because | 2046 // 'delete this' but it's not suitable for PepperPluginDelegateImpl because |
| 1989 // it's non-pointer member in RenderViewImpl. | 2047 // it's non-pointer member in RenderViewImpl. |
| 1990 } | 2048 } |
| 1991 | 2049 |
| 1992 void PepperPluginDelegateImpl::OnTCPSocketConnectACK( | 2050 void PepperPluginDelegateImpl::OnTCPSocketConnectACK( |
| 1993 uint32 plugin_dispatcher_id, | 2051 uint32 plugin_dispatcher_id, |
| 1994 uint32 socket_id, | 2052 uint32 socket_id, |
| 1995 bool succeeded, | 2053 bool succeeded, |
| 1996 const PP_NetAddress_Private& local_addr, | 2054 const PP_NetAddress_Private& local_addr, |
| 1997 const PP_NetAddress_Private& remote_addr) { | 2055 const PP_NetAddress_Private& remote_addr) { |
| 1998 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = | 2056 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = |
| 1999 tcp_sockets_.Lookup(socket_id); | 2057 tcp_sockets_.Lookup(socket_id); |
| 2000 if (socket) | 2058 if (socket) |
| 2001 socket->OnConnectCompleted(succeeded, local_addr, remote_addr); | 2059 socket->OnConnectCompleted(succeeded, local_addr, remote_addr); |
| 2060 if (!succeeded) |
| 2061 tcp_sockets_.Remove(socket_id); |
| 2002 } | 2062 } |
| 2003 | 2063 |
| 2004 void PepperPluginDelegateImpl::OnTCPSocketSSLHandshakeACK( | 2064 void PepperPluginDelegateImpl::OnTCPSocketSSLHandshakeACK( |
| 2005 uint32 plugin_dispatcher_id, | 2065 uint32 plugin_dispatcher_id, |
| 2006 uint32 socket_id, | 2066 uint32 socket_id, |
| 2007 bool succeeded) { | 2067 bool succeeded) { |
| 2008 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = | 2068 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = |
| 2009 tcp_sockets_.Lookup(socket_id); | 2069 tcp_sockets_.Lookup(socket_id); |
| 2010 if (socket) | 2070 if (socket) |
| 2011 socket->OnSSLHandshakeCompleted(succeeded); | 2071 socket->OnSSLHandshakeCompleted(succeeded); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2031 socket->OnWriteCompleted(succeeded, bytes_written); | 2091 socket->OnWriteCompleted(succeeded, bytes_written); |
| 2032 } | 2092 } |
| 2033 | 2093 |
| 2034 void PepperPluginDelegateImpl::OnUDPSocketBindACK(uint32 plugin_dispatcher_id, | 2094 void PepperPluginDelegateImpl::OnUDPSocketBindACK(uint32 plugin_dispatcher_id, |
| 2035 uint32 socket_id, | 2095 uint32 socket_id, |
| 2036 bool succeeded) { | 2096 bool succeeded) { |
| 2037 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = | 2097 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = |
| 2038 udp_sockets_.Lookup(socket_id); | 2098 udp_sockets_.Lookup(socket_id); |
| 2039 if (socket) | 2099 if (socket) |
| 2040 socket->OnBindCompleted(succeeded); | 2100 socket->OnBindCompleted(succeeded); |
| 2101 if (!succeeded) |
| 2102 udp_sockets_.Remove(socket_id); |
| 2041 } | 2103 } |
| 2042 | 2104 |
| 2043 void PepperPluginDelegateImpl::OnUDPSocketRecvFromACK( | 2105 void PepperPluginDelegateImpl::OnUDPSocketRecvFromACK( |
| 2044 uint32 plugin_dispatcher_id, | 2106 uint32 plugin_dispatcher_id, |
| 2045 uint32 socket_id, | 2107 uint32 socket_id, |
| 2046 bool succeeded, | 2108 bool succeeded, |
| 2047 const std::string& data, | 2109 const std::string& data, |
| 2048 const PP_NetAddress_Private& remote_addr) { | 2110 const PP_NetAddress_Private& remote_addr) { |
| 2049 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = | 2111 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = |
| 2050 udp_sockets_.Lookup(socket_id); | 2112 udp_sockets_.Lookup(socket_id); |
| 2051 if (socket) | 2113 if (socket) |
| 2052 socket->OnRecvFromCompleted(succeeded, data, remote_addr); | 2114 socket->OnRecvFromCompleted(succeeded, data, remote_addr); |
| 2053 } | 2115 } |
| 2054 | 2116 |
| 2055 void PepperPluginDelegateImpl::OnUDPSocketSendToACK(uint32 plugin_dispatcher_id, | 2117 void PepperPluginDelegateImpl::OnUDPSocketSendToACK(uint32 plugin_dispatcher_id, |
| 2056 uint32 socket_id, | 2118 uint32 socket_id, |
| 2057 bool succeeded, | 2119 bool succeeded, |
| 2058 int32_t bytes_written) { | 2120 int32_t bytes_written) { |
| 2059 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = | 2121 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = |
| 2060 udp_sockets_.Lookup(socket_id); | 2122 udp_sockets_.Lookup(socket_id); |
| 2061 if (socket) | 2123 if (socket) |
| 2062 socket->OnSendToCompleted(succeeded, bytes_written); | 2124 socket->OnSendToCompleted(succeeded, bytes_written); |
| 2063 } | 2125 } |
| 2064 | 2126 |
| 2127 void PepperPluginDelegateImpl::OnTCPServerSocketListenACK( |
| 2128 uint32 plugin_dispatcher_id, |
| 2129 uint32 socket_id, |
| 2130 bool succeeded) { |
| 2131 webkit::ppapi::PPB_TCPServerSocket_Private_Impl* socket = |
| 2132 tcp_server_sockets_.Lookup(socket_id); |
| 2133 if (socket) |
| 2134 socket->OnListenCompleted(succeeded); |
| 2135 if (!succeeded) |
| 2136 tcp_server_sockets_.Remove(socket_id); |
| 2137 } |
| 2138 |
| 2139 void PepperPluginDelegateImpl::OnTCPServerSocketInitializeACK( |
| 2140 uint32 plugin_dispatcher_id, |
| 2141 uint32 tcp_server_socket_id) { |
| 2142 if (!uninitialized_tcp_server_sockets_.empty()) { |
| 2143 webkit::ppapi::PPB_TCPServerSocket_Private_Impl* socket = |
| 2144 uninitialized_tcp_server_sockets_.front(); |
| 2145 uninitialized_tcp_server_sockets_.pop_front(); |
| 2146 tcp_server_sockets_positions_.erase(socket); |
| 2147 DCHECK(socket != NULL); |
| 2148 socket->OnInitializeCompleted(tcp_server_socket_id); |
| 2149 } else { |
| 2150 render_view_->Send( |
| 2151 new PpapiHostMsg_PPBTCPServerSocket_Destroy( |
| 2152 tcp_server_socket_id)); |
| 2153 } |
| 2154 } |
| 2155 |
| 2156 void PepperPluginDelegateImpl::OnTCPServerSocketAcceptACK( |
| 2157 uint32 plugin_dispatcher_id, |
| 2158 uint32 tcp_server_socket_id, |
| 2159 uint32 tcp_socket_id, |
| 2160 const PP_NetAddress_Private& local_addr, |
| 2161 const PP_NetAddress_Private& remote_addr) { |
| 2162 webkit::ppapi::PPB_TCPServerSocket_Private_Impl* socket = |
| 2163 tcp_server_sockets_.Lookup(tcp_server_socket_id); |
| 2164 if (socket) { |
| 2165 bool succeeded = tcp_socket_id != 0; |
| 2166 socket->OnAcceptCompleted(succeeded, |
| 2167 tcp_socket_id, |
| 2168 local_addr, |
| 2169 remote_addr); |
| 2170 } |
| 2171 } |
| 2172 |
| 2065 int PepperPluginDelegateImpl::GetRoutingId() const { | 2173 int PepperPluginDelegateImpl::GetRoutingId() const { |
| 2066 return render_view_->routing_id(); | 2174 return render_view_->routing_id(); |
| 2067 } | 2175 } |
| 2068 | 2176 |
| 2069 ContentGLContext* | 2177 ContentGLContext* |
| 2070 PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { | 2178 PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { |
| 2071 WebGraphicsContext3DCommandBufferImpl* context = | 2179 WebGraphicsContext3DCommandBufferImpl* context = |
| 2072 static_cast<WebGraphicsContext3DCommandBufferImpl*>( | 2180 static_cast<WebGraphicsContext3DCommandBufferImpl*>( |
| 2073 render_view_->webview()->graphicsContext3D()); | 2181 render_view_->webview()->graphicsContext3D()); |
| 2074 if (!context) | 2182 if (!context) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 void PepperPluginDelegateImpl::UnSetAndDeleteLockTargetAdapter( | 2214 void PepperPluginDelegateImpl::UnSetAndDeleteLockTargetAdapter( |
| 2107 webkit::ppapi::PluginInstance* instance) { | 2215 webkit::ppapi::PluginInstance* instance) { |
| 2108 LockTargetMap::iterator it = mouse_lock_instances_.find(instance); | 2216 LockTargetMap::iterator it = mouse_lock_instances_.find(instance); |
| 2109 if (it != mouse_lock_instances_.end()) { | 2217 if (it != mouse_lock_instances_.end()) { |
| 2110 MouseLockDispatcher::LockTarget* target = it->second; | 2218 MouseLockDispatcher::LockTarget* target = it->second; |
| 2111 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target); | 2219 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target); |
| 2112 delete target; | 2220 delete target; |
| 2113 mouse_lock_instances_.erase(it); | 2221 mouse_lock_instances_.erase(it); |
| 2114 } | 2222 } |
| 2115 } | 2223 } |
| OLD | NEW |