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 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 bool succeeded, | 2107 bool succeeded, |
2108 int32_t bytes_written) { | 2108 int32_t bytes_written) { |
2109 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = | 2109 webkit::ppapi::PPB_TCPSocket_Private_Impl* socket = |
2110 tcp_sockets_.Lookup(socket_id); | 2110 tcp_sockets_.Lookup(socket_id); |
2111 if (socket) | 2111 if (socket) |
2112 socket->OnWriteCompleted(succeeded, bytes_written); | 2112 socket->OnWriteCompleted(succeeded, bytes_written); |
2113 } | 2113 } |
2114 | 2114 |
2115 void PepperPluginDelegateImpl::OnUDPSocketBindACK(uint32 plugin_dispatcher_id, | 2115 void PepperPluginDelegateImpl::OnUDPSocketBindACK(uint32 plugin_dispatcher_id, |
2116 uint32 socket_id, | 2116 uint32 socket_id, |
2117 bool succeeded) { | 2117 bool succeeded, |
| 2118 uint32 bound_port) { |
2118 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = | 2119 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = |
2119 udp_sockets_.Lookup(socket_id); | 2120 udp_sockets_.Lookup(socket_id); |
2120 if (socket) | 2121 if (socket) |
2121 socket->OnBindCompleted(succeeded); | 2122 socket->OnBindCompleted(succeeded, bound_port); |
2122 } | 2123 } |
2123 | 2124 |
2124 void PepperPluginDelegateImpl::OnUDPSocketRecvFromACK( | 2125 void PepperPluginDelegateImpl::OnUDPSocketRecvFromACK( |
2125 uint32 plugin_dispatcher_id, | 2126 uint32 plugin_dispatcher_id, |
2126 uint32 socket_id, | 2127 uint32 socket_id, |
2127 bool succeeded, | 2128 bool succeeded, |
2128 const std::string& data, | 2129 const std::string& data, |
2129 const PP_NetAddress_Private& remote_addr) { | 2130 const PP_NetAddress_Private& remote_addr) { |
2130 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = | 2131 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = |
2131 udp_sockets_.Lookup(socket_id); | 2132 udp_sockets_.Lookup(socket_id); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 | 2166 |
2166 bool PepperPluginDelegateImpl::CanUseSocketAPIs() { | 2167 bool PepperPluginDelegateImpl::CanUseSocketAPIs() { |
2167 WebView* webview = render_view_->webview(); | 2168 WebView* webview = render_view_->webview(); |
2168 WebFrame* main_frame = webview ? webview->mainFrame() : NULL; | 2169 WebFrame* main_frame = webview ? webview->mainFrame() : NULL; |
2169 GURL url(main_frame ? GURL(main_frame->document().url()) : GURL()); | 2170 GURL url(main_frame ? GURL(main_frame->document().url()) : GURL()); |
2170 if (!url.is_valid()) | 2171 if (!url.is_valid()) |
2171 return false; | 2172 return false; |
2172 | 2173 |
2173 return content::GetContentClient()->renderer()->AllowSocketAPI(url); | 2174 return content::GetContentClient()->renderer()->AllowSocketAPI(url); |
2174 } | 2175 } |
OLD | NEW |