Chromium Code Reviews| 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> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 71 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 72 #include "webkit/glue/context_menu.h" | 72 #include "webkit/glue/context_menu.h" |
| 73 #include "webkit/plugins/npapi/webplugin.h" | 73 #include "webkit/plugins/npapi/webplugin.h" |
| 74 #include "webkit/plugins/ppapi/file_path.h" | 74 #include "webkit/plugins/ppapi/file_path.h" |
| 75 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" | 75 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" |
| 76 #include "webkit/plugins/ppapi/plugin_module.h" | 76 #include "webkit/plugins/ppapi/plugin_module.h" |
| 77 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 77 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 78 #include "webkit/plugins/ppapi/ppb_broker_impl.h" | 78 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
| 79 #include "webkit/plugins/ppapi/ppb_flash_impl.h" | 79 #include "webkit/plugins/ppapi/ppb_flash_impl.h" |
| 80 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" | 80 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" |
| 81 #include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h" | |
| 81 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" | 82 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" |
| 82 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" | 83 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" |
| 83 #include "webkit/plugins/ppapi/resource_helper.h" | 84 #include "webkit/plugins/ppapi/resource_helper.h" |
| 84 #include "webkit/plugins/webplugininfo.h" | 85 #include "webkit/plugins/webplugininfo.h" |
| 85 | 86 |
| 86 using WebKit::WebView; | 87 using WebKit::WebView; |
| 87 using WebKit::WebFrame; | 88 using WebKit::WebFrame; |
| 88 | 89 |
| 89 namespace { | 90 namespace { |
| 90 | 91 |
| (...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1702 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Create( | 1703 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Create( |
| 1703 render_view_->routing_id(), 0, &socket_id)); | 1704 render_view_->routing_id(), 0, &socket_id)); |
| 1704 return socket_id; | 1705 return socket_id; |
| 1705 } | 1706 } |
| 1706 | 1707 |
| 1707 void PepperPluginDelegateImpl::TCPSocketConnect( | 1708 void PepperPluginDelegateImpl::TCPSocketConnect( |
| 1708 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket, | 1709 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket, |
| 1709 uint32 socket_id, | 1710 uint32 socket_id, |
| 1710 const std::string& host, | 1711 const std::string& host, |
| 1711 uint16_t port) { | 1712 uint16_t port) { |
| 1712 tcp_sockets_.AddWithID(socket, socket_id); | 1713 TCPSocketRegister(socket, socket_id); |
| 1713 render_view_->Send( | 1714 render_view_->Send( |
| 1714 new PpapiHostMsg_PPBTCPSocket_Connect(socket_id, host, port)); | 1715 new PpapiHostMsg_PPBTCPSocket_Connect(socket_id, host, port)); |
| 1715 } | 1716 } |
| 1716 | 1717 |
| 1717 void PepperPluginDelegateImpl::TCPSocketConnectWithNetAddress( | 1718 void PepperPluginDelegateImpl::TCPSocketConnectWithNetAddress( |
| 1718 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket, | 1719 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket, |
| 1719 uint32 socket_id, | 1720 uint32 socket_id, |
| 1720 const PP_NetAddress_Private& addr) { | 1721 const PP_NetAddress_Private& addr) { |
| 1721 tcp_sockets_.AddWithID(socket, socket_id); | 1722 tcp_sockets_.AddWithID(socket, socket_id); |
| 1722 render_view_->Send( | 1723 render_view_->Send( |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1746 } | 1747 } |
| 1747 | 1748 |
| 1748 void PepperPluginDelegateImpl::TCPSocketDisconnect(uint32 socket_id) { | 1749 void PepperPluginDelegateImpl::TCPSocketDisconnect(uint32 socket_id) { |
| 1749 // There are no DCHECK(tcp_sockets_.Lookup(socket_id)) because it | 1750 // There are no DCHECK(tcp_sockets_.Lookup(socket_id)) because it |
| 1750 // can be called before | 1751 // can be called before |
| 1751 // TCPSocketConnect/TCPSocketConnectWithNetAddress is called. | 1752 // TCPSocketConnect/TCPSocketConnectWithNetAddress is called. |
| 1752 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id)); | 1753 render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id)); |
| 1753 tcp_sockets_.Remove(socket_id); | 1754 tcp_sockets_.Remove(socket_id); |
| 1754 } | 1755 } |
| 1755 | 1756 |
| 1757 void PepperPluginDelegateImpl::TCPSocketRegister( | |
| 1758 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket, | |
| 1759 uint32 socket_id) { | |
| 1760 tcp_sockets_.AddWithID(socket, socket_id); | |
| 1761 } | |
| 1762 | |
| 1756 uint32 PepperPluginDelegateImpl::UDPSocketCreate() { | 1763 uint32 PepperPluginDelegateImpl::UDPSocketCreate() { |
| 1757 if (!CanUseSocketAPIs()) | 1764 if (!CanUseSocketAPIs()) |
| 1758 return 0; | 1765 return 0; |
| 1759 | 1766 |
| 1760 uint32 socket_id = 0; | 1767 uint32 socket_id = 0; |
| 1761 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Create( | 1768 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Create( |
| 1762 render_view_->routing_id(), 0, &socket_id)); | 1769 render_view_->routing_id(), 0, &socket_id)); |
| 1763 return socket_id; | 1770 return socket_id; |
| 1764 } | 1771 } |
| 1765 | 1772 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1787 new PpapiHostMsg_PPBUDPSocket_SendTo(socket_id, buffer, net_addr)); | 1794 new PpapiHostMsg_PPBUDPSocket_SendTo(socket_id, buffer, net_addr)); |
| 1788 } | 1795 } |
| 1789 | 1796 |
| 1790 void PepperPluginDelegateImpl::UDPSocketClose(uint32 socket_id) { | 1797 void PepperPluginDelegateImpl::UDPSocketClose(uint32 socket_id) { |
| 1791 // There are no DCHECK(udp_sockets_.Lookup(socket_id)) because it | 1798 // There are no DCHECK(udp_sockets_.Lookup(socket_id)) because it |
| 1792 // can be called before UDPSocketBind is called. | 1799 // can be called before UDPSocketBind is called. |
| 1793 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Close(socket_id)); | 1800 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Close(socket_id)); |
| 1794 udp_sockets_.Remove(socket_id); | 1801 udp_sockets_.Remove(socket_id); |
| 1795 } | 1802 } |
| 1796 | 1803 |
| 1804 uint32 PepperPluginDelegateImpl::TCPServerSocketCreate() { | |
| 1805 if (!CanUseSocketAPIs()) | |
| 1806 return 0; | |
| 1807 | |
| 1808 uint32 socket_id = 0; | |
| 1809 render_view_->Send(new PpapiHostMsg_PPBTCPServerSocket_Create( | |
|
brettw
2012/02/07 00:15:22
Supporting these in the renderer is very problemat
Dmitry Polukhin
2012/02/07 06:45:50
I think we need to transform "create" methods to a
ygorshenin1
2012/02/07 13:42:59
Fixed: PPB_TCPServerSocke_Private::Create method i
| |
| 1810 render_view_->routing_id(), 0, &socket_id)); | |
| 1811 return socket_id; | |
| 1812 } | |
| 1813 | |
| 1814 void PepperPluginDelegateImpl::TCPServerSocketListen( | |
| 1815 webkit::ppapi::PPB_TCPServerSocket_Private_Impl* socket, | |
| 1816 uint32 socket_id, | |
| 1817 const PP_NetAddress_Private& addr, | |
| 1818 int32_t backlog) { | |
| 1819 tcp_server_sockets_.AddWithID(socket, socket_id); | |
| 1820 render_view_->Send( | |
| 1821 new PpapiHostMsg_PPBTCPServerSocket_Listen(socket_id, addr, backlog)); | |
| 1822 } | |
| 1823 | |
| 1824 void PepperPluginDelegateImpl::TCPServerSocketAccept(uint32 socket_id) { | |
| 1825 DCHECK(tcp_server_sockets_.Lookup(socket_id)); | |
| 1826 render_view_->Send(new PpapiHostMsg_PPBTCPServerSocket_Accept(socket_id)); | |
| 1827 } | |
| 1828 | |
| 1829 void PepperPluginDelegateImpl::TCPServerSocketStopListening(uint32 socket_id) { | |
| 1830 // There are no DCHECK(tcp_server_sockets_.Lookup(socket_id)) | |
| 1831 // because it can be called before TCPServerSocketListen is called. | |
| 1832 render_view_->Send( | |
| 1833 new PpapiHostMsg_PPBTCPServerSocket_StopListening(socket_id)); | |
| 1834 tcp_server_sockets_.Remove(socket_id); | |
| 1835 } | |
| 1836 | |
| 1797 int32_t PepperPluginDelegateImpl::ShowContextMenu( | 1837 int32_t PepperPluginDelegateImpl::ShowContextMenu( |
| 1798 webkit::ppapi::PluginInstance* instance, | 1838 webkit::ppapi::PluginInstance* instance, |
| 1799 webkit::ppapi::PPB_Flash_Menu_Impl* menu, | 1839 webkit::ppapi::PPB_Flash_Menu_Impl* menu, |
| 1800 const gfx::Point& position) { | 1840 const gfx::Point& position) { |
| 1801 int32 render_widget_id = render_view_->routing_id(); | 1841 int32 render_widget_id = render_view_->routing_id(); |
| 1802 if (instance->FlashIsFullscreen(instance->pp_instance())) { | 1842 if (instance->FlashIsFullscreen(instance->pp_instance())) { |
| 1803 webkit::ppapi::FullscreenContainer* container = | 1843 webkit::ppapi::FullscreenContainer* container = |
| 1804 instance->fullscreen_container(); | 1844 instance->fullscreen_container(); |
| 1805 DCHECK(container); | 1845 DCHECK(container); |
| 1806 render_widget_id = | 1846 render_widget_id = |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2050 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, | 2090 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, |
| 2051 OnTCPSocketConnectACK) | 2091 OnTCPSocketConnectACK) |
| 2052 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, | 2092 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, |
| 2053 OnTCPSocketSSLHandshakeACK) | 2093 OnTCPSocketSSLHandshakeACK) |
| 2054 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) | 2094 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) |
| 2055 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) | 2095 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) |
| 2056 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK) | 2096 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK) |
| 2057 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK, | 2097 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK, |
| 2058 OnUDPSocketRecvFromACK) | 2098 OnUDPSocketRecvFromACK) |
| 2059 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK, OnUDPSocketSendToACK) | 2099 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK, OnUDPSocketSendToACK) |
| 2100 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_ListenACK, | |
| 2101 OnTCPServerSocketListenACK) | |
| 2102 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_AcceptACK, | |
| 2103 OnTCPServerSocketAcceptACK) | |
| 2060 IPC_MESSAGE_UNHANDLED(handled = false) | 2104 IPC_MESSAGE_UNHANDLED(handled = false) |
| 2061 IPC_END_MESSAGE_MAP() | 2105 IPC_END_MESSAGE_MAP() |
| 2062 return handled; | 2106 return handled; |
| 2063 } | 2107 } |
| 2064 | 2108 |
| 2065 void PepperPluginDelegateImpl::OnDestruct() { | 2109 void PepperPluginDelegateImpl::OnDestruct() { |
| 2066 // Nothing to do here. Default implementation in RenderViewObserver does | 2110 // Nothing to do here. Default implementation in RenderViewObserver does |
| 2067 // 'delete this' but it's not suitable for PepperPluginDelegateImpl because | 2111 // 'delete this' but it's not suitable for PepperPluginDelegateImpl because |
| 2068 // it's non-pointer member in RenderViewImpl. | 2112 // it's non-pointer member in RenderViewImpl. |
| 2069 } | 2113 } |
| 2070 | 2114 |
| 2071 void PepperPluginDelegateImpl::OnTCPSocketConnectACK( | 2115 void PepperPluginDelegateImpl::OnTCPSocketConnectACK( |
| 2072 uint32 plugin_dispatcher_id, | 2116 uint32 plugin_dispatcher_id, |
| 2073 uint32 socket_id, | 2117 uint32 socket_id, |
| 2074 bool succeeded, | 2118 bool succeeded, |
| 2075 const PP_NetAddress_Private& local_addr, | 2119 const PP_NetAddress_Private& local_addr, |
| 2076 const PP_NetAddress_Private& remote_addr) { | 2120 const PP_NetAddress_Private& remote_addr) { |
| 2077 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = | 2121 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = |
| 2078 tcp_sockets_.Lookup(socket_id); | 2122 tcp_sockets_.Lookup(socket_id); |
| 2079 if (socket) | 2123 if (socket) |
| 2080 socket->OnConnectCompleted(succeeded, local_addr, remote_addr); | 2124 socket->OnConnectCompleted(succeeded, local_addr, remote_addr); |
| 2125 if (!succeeded) | |
| 2126 tcp_sockets_.Remove(socket_id); | |
| 2081 } | 2127 } |
| 2082 | 2128 |
| 2083 void PepperPluginDelegateImpl::OnTCPSocketSSLHandshakeACK( | 2129 void PepperPluginDelegateImpl::OnTCPSocketSSLHandshakeACK( |
| 2084 uint32 plugin_dispatcher_id, | 2130 uint32 plugin_dispatcher_id, |
| 2085 uint32 socket_id, | 2131 uint32 socket_id, |
| 2086 bool succeeded) { | 2132 bool succeeded) { |
| 2087 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = | 2133 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = |
| 2088 tcp_sockets_.Lookup(socket_id); | 2134 tcp_sockets_.Lookup(socket_id); |
| 2089 if (socket) | 2135 if (socket) |
| 2090 socket->OnSSLHandshakeCompleted(succeeded); | 2136 socket->OnSSLHandshakeCompleted(succeeded); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 2110 socket->OnWriteCompleted(succeeded, bytes_written); | 2156 socket->OnWriteCompleted(succeeded, bytes_written); |
| 2111 } | 2157 } |
| 2112 | 2158 |
| 2113 void PepperPluginDelegateImpl::OnUDPSocketBindACK(uint32 plugin_dispatcher_id, | 2159 void PepperPluginDelegateImpl::OnUDPSocketBindACK(uint32 plugin_dispatcher_id, |
| 2114 uint32 socket_id, | 2160 uint32 socket_id, |
| 2115 bool succeeded) { | 2161 bool succeeded) { |
| 2116 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = | 2162 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = |
| 2117 udp_sockets_.Lookup(socket_id); | 2163 udp_sockets_.Lookup(socket_id); |
| 2118 if (socket) | 2164 if (socket) |
| 2119 socket->OnBindCompleted(succeeded); | 2165 socket->OnBindCompleted(succeeded); |
| 2166 if (!succeeded) | |
| 2167 udp_sockets_.Remove(socket_id); | |
| 2120 } | 2168 } |
| 2121 | 2169 |
| 2122 void PepperPluginDelegateImpl::OnUDPSocketRecvFromACK( | 2170 void PepperPluginDelegateImpl::OnUDPSocketRecvFromACK( |
| 2123 uint32 plugin_dispatcher_id, | 2171 uint32 plugin_dispatcher_id, |
| 2124 uint32 socket_id, | 2172 uint32 socket_id, |
| 2125 bool succeeded, | 2173 bool succeeded, |
| 2126 const std::string& data, | 2174 const std::string& data, |
| 2127 const PP_NetAddress_Private& remote_addr) { | 2175 const PP_NetAddress_Private& remote_addr) { |
| 2128 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = | 2176 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = |
| 2129 udp_sockets_.Lookup(socket_id); | 2177 udp_sockets_.Lookup(socket_id); |
| 2130 if (socket) | 2178 if (socket) |
| 2131 socket->OnRecvFromCompleted(succeeded, data, remote_addr); | 2179 socket->OnRecvFromCompleted(succeeded, data, remote_addr); |
| 2132 } | 2180 } |
| 2133 | 2181 |
| 2134 void PepperPluginDelegateImpl::OnUDPSocketSendToACK(uint32 plugin_dispatcher_id, | 2182 void PepperPluginDelegateImpl::OnUDPSocketSendToACK(uint32 plugin_dispatcher_id, |
| 2135 uint32 socket_id, | 2183 uint32 socket_id, |
| 2136 bool succeeded, | 2184 bool succeeded, |
| 2137 int32_t bytes_written) { | 2185 int32_t bytes_written) { |
| 2138 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = | 2186 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = |
| 2139 udp_sockets_.Lookup(socket_id); | 2187 udp_sockets_.Lookup(socket_id); |
| 2140 if (socket) | 2188 if (socket) |
| 2141 socket->OnSendToCompleted(succeeded, bytes_written); | 2189 socket->OnSendToCompleted(succeeded, bytes_written); |
| 2142 } | 2190 } |
| 2143 | 2191 |
| 2192 void PepperPluginDelegateImpl::OnTCPServerSocketListenACK( | |
| 2193 uint32 plugin_dispatcher_id, | |
| 2194 uint32 socket_id, | |
| 2195 bool succeeded) { | |
| 2196 webkit::ppapi::PPB_TCPServerSocket_Private_Impl* socket = | |
| 2197 tcp_server_sockets_.Lookup(socket_id); | |
| 2198 if (socket) | |
| 2199 socket->OnListenCompleted(succeeded); | |
| 2200 if (!succeeded) | |
| 2201 tcp_server_sockets_.Remove(socket_id); | |
| 2202 } | |
| 2203 | |
| 2204 void PepperPluginDelegateImpl::OnTCPServerSocketAcceptACK( | |
| 2205 uint32 plugin_dispatcher_id, | |
| 2206 uint32 tcp_server_socket_id, | |
| 2207 uint32 tcp_socket_id, | |
| 2208 const PP_NetAddress_Private& local_addr, | |
| 2209 const PP_NetAddress_Private& remote_addr) { | |
| 2210 webkit::ppapi::PPB_TCPServerSocket_Private_Impl* socket = | |
| 2211 tcp_server_sockets_.Lookup(tcp_server_socket_id); | |
| 2212 if (socket) { | |
| 2213 bool succeeded = tcp_socket_id != 0; | |
| 2214 socket->OnAcceptCompleted(succeeded, | |
| 2215 tcp_socket_id, | |
| 2216 local_addr, | |
| 2217 remote_addr); | |
| 2218 } | |
| 2219 } | |
| 2220 | |
| 2144 int PepperPluginDelegateImpl::GetRoutingId() const { | 2221 int PepperPluginDelegateImpl::GetRoutingId() const { |
| 2145 return render_view_->routing_id(); | 2222 return render_view_->routing_id(); |
| 2146 } | 2223 } |
| 2147 | 2224 |
| 2148 RendererGLContext* | 2225 RendererGLContext* |
| 2149 PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { | 2226 PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { |
| 2150 WebGraphicsContext3DCommandBufferImpl* context = | 2227 WebGraphicsContext3DCommandBufferImpl* context = |
| 2151 static_cast<WebGraphicsContext3DCommandBufferImpl*>( | 2228 static_cast<WebGraphicsContext3DCommandBufferImpl*>( |
| 2152 render_view_->webview()->graphicsContext3D()); | 2229 render_view_->webview()->graphicsContext3D()); |
| 2153 if (!context) | 2230 if (!context) |
| 2154 return NULL; | 2231 return NULL; |
| 2155 if (!context->makeContextCurrent() || context->isContextLost()) | 2232 if (!context->makeContextCurrent() || context->isContextLost()) |
| 2156 return NULL; | 2233 return NULL; |
| 2157 | 2234 |
| 2158 RendererGLContext* parent_context = context->context(); | 2235 RendererGLContext* parent_context = context->context(); |
| 2159 if (!parent_context) | 2236 if (!parent_context) |
| 2160 return NULL; | 2237 return NULL; |
| 2161 return parent_context; | 2238 return parent_context; |
| 2162 } | 2239 } |
| 2163 | 2240 |
| 2164 bool PepperPluginDelegateImpl::CanUseSocketAPIs() { | 2241 bool PepperPluginDelegateImpl::CanUseSocketAPIs() { |
| 2165 WebView* webview = render_view_->webview(); | 2242 WebView* webview = render_view_->webview(); |
| 2166 WebFrame* main_frame = webview ? webview->mainFrame() : NULL; | 2243 WebFrame* main_frame = webview ? webview->mainFrame() : NULL; |
| 2167 GURL url(main_frame ? GURL(main_frame->document().url()) : GURL()); | 2244 GURL url(main_frame ? GURL(main_frame->document().url()) : GURL()); |
| 2168 if (!url.is_valid()) | 2245 if (!url.is_valid()) |
| 2169 return false; | 2246 return false; |
| 2170 | 2247 |
| 2171 return content::GetContentClient()->renderer()->AllowSocketAPI(url); | 2248 return content::GetContentClient()->renderer()->AllowSocketAPI(url); |
| 2172 } | 2249 } |
| OLD | NEW |