| 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> |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 | 1204 |
| 1205 void PepperPluginDelegateImpl::TCPServerSocketStopListening( | 1205 void PepperPluginDelegateImpl::TCPServerSocketStopListening( |
| 1206 PP_Resource socket_resource, | 1206 PP_Resource socket_resource, |
| 1207 uint32 socket_id) { | 1207 uint32 socket_id) { |
| 1208 if (socket_id != 0) { | 1208 if (socket_id != 0) { |
| 1209 render_view_->Send(new PpapiHostMsg_PPBTCPServerSocket_Destroy(socket_id)); | 1209 render_view_->Send(new PpapiHostMsg_PPBTCPServerSocket_Destroy(socket_id)); |
| 1210 tcp_server_sockets_.Remove(socket_id); | 1210 tcp_server_sockets_.Remove(socket_id); |
| 1211 } | 1211 } |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 void PepperPluginDelegateImpl::RegisterHostResolver( | |
| 1215 ppapi::PPB_HostResolver_Shared* host_resolver, | |
| 1216 uint32 host_resolver_id) { | |
| 1217 host_resolvers_.AddWithID(host_resolver, host_resolver_id); | |
| 1218 } | |
| 1219 | |
| 1220 void PepperPluginDelegateImpl::HostResolverResolve( | |
| 1221 uint32 host_resolver_id, | |
| 1222 const ::ppapi::HostPortPair& host_port, | |
| 1223 const PP_HostResolver_Private_Hint* hint) { | |
| 1224 DCHECK(host_resolvers_.Lookup(host_resolver_id)); | |
| 1225 if (!hint) { | |
| 1226 PP_HostResolver_Private_Hint empty_hint; | |
| 1227 empty_hint.family = PP_NETADDRESSFAMILY_UNSPECIFIED; | |
| 1228 empty_hint.flags = static_cast<PP_HostResolver_Private_Flags>(0); | |
| 1229 render_view_->Send( | |
| 1230 new PpapiHostMsg_PPBHostResolver_Resolve( | |
| 1231 GetRoutingID(), | |
| 1232 0, | |
| 1233 host_resolver_id, | |
| 1234 host_port, | |
| 1235 empty_hint)); | |
| 1236 } else { | |
| 1237 render_view_->Send( | |
| 1238 new PpapiHostMsg_PPBHostResolver_Resolve( | |
| 1239 GetRoutingID(), | |
| 1240 0, | |
| 1241 host_resolver_id, | |
| 1242 host_port, | |
| 1243 *hint)); | |
| 1244 } | |
| 1245 } | |
| 1246 | |
| 1247 void PepperPluginDelegateImpl::UnregisterHostResolver(uint32 host_resolver_id) { | |
| 1248 host_resolvers_.Remove(host_resolver_id); | |
| 1249 } | |
| 1250 | |
| 1251 bool PepperPluginDelegateImpl::AddNetworkListObserver( | 1214 bool PepperPluginDelegateImpl::AddNetworkListObserver( |
| 1252 webkit_glue::NetworkListObserver* observer) { | 1215 webkit_glue::NetworkListObserver* observer) { |
| 1253 #if defined(ENABLE_WEBRTC) | 1216 #if defined(ENABLE_WEBRTC) |
| 1254 P2PSocketDispatcher* socket_dispatcher = | 1217 P2PSocketDispatcher* socket_dispatcher = |
| 1255 RenderThreadImpl::current()->p2p_socket_dispatcher(); | 1218 RenderThreadImpl::current()->p2p_socket_dispatcher(); |
| 1256 if (!socket_dispatcher) { | 1219 if (!socket_dispatcher) { |
| 1257 return false; | 1220 return false; |
| 1258 } | 1221 } |
| 1259 socket_dispatcher->AddNetworkListObserver(observer); | 1222 socket_dispatcher->AddNetworkListObserver(observer); |
| 1260 return true; | 1223 return true; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, | 1391 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, |
| 1429 OnTCPSocketConnectACK) | 1392 OnTCPSocketConnectACK) |
| 1430 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, | 1393 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, |
| 1431 OnTCPSocketSSLHandshakeACK) | 1394 OnTCPSocketSSLHandshakeACK) |
| 1432 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) | 1395 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) |
| 1433 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) | 1396 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) |
| 1434 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_ListenACK, | 1397 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_ListenACK, |
| 1435 OnTCPServerSocketListenACK) | 1398 OnTCPServerSocketListenACK) |
| 1436 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_AcceptACK, | 1399 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_AcceptACK, |
| 1437 OnTCPServerSocketAcceptACK) | 1400 OnTCPServerSocketAcceptACK) |
| 1438 IPC_MESSAGE_HANDLER(PpapiMsg_PPBHostResolver_ResolveACK, | |
| 1439 OnHostResolverResolveACK) | |
| 1440 IPC_MESSAGE_UNHANDLED(handled = false) | 1401 IPC_MESSAGE_UNHANDLED(handled = false) |
| 1441 IPC_END_MESSAGE_MAP() | 1402 IPC_END_MESSAGE_MAP() |
| 1442 return handled; | 1403 return handled; |
| 1443 } | 1404 } |
| 1444 | 1405 |
| 1445 void PepperPluginDelegateImpl::OnDestruct() { | 1406 void PepperPluginDelegateImpl::OnDestruct() { |
| 1446 // Nothing to do here. Default implementation in RenderViewObserver does | 1407 // Nothing to do here. Default implementation in RenderViewObserver does |
| 1447 // 'delete this' but it's not suitable for PepperPluginDelegateImpl because | 1408 // 'delete this' but it's not suitable for PepperPluginDelegateImpl because |
| 1448 // it's non-pointer member in RenderViewImpl. | 1409 // it's non-pointer member in RenderViewImpl. |
| 1449 } | 1410 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 socket->OnAcceptCompleted(succeeded, | 1486 socket->OnAcceptCompleted(succeeded, |
| 1526 accepted_socket_id, | 1487 accepted_socket_id, |
| 1527 local_addr, | 1488 local_addr, |
| 1528 remote_addr); | 1489 remote_addr); |
| 1529 } else if (accepted_socket_id != 0) { | 1490 } else if (accepted_socket_id != 0) { |
| 1530 render_view_->Send( | 1491 render_view_->Send( |
| 1531 new PpapiHostMsg_PPBTCPSocket_Disconnect(accepted_socket_id)); | 1492 new PpapiHostMsg_PPBTCPSocket_Disconnect(accepted_socket_id)); |
| 1532 } | 1493 } |
| 1533 } | 1494 } |
| 1534 | 1495 |
| 1535 void PepperPluginDelegateImpl::OnHostResolverResolveACK( | |
| 1536 uint32 plugin_dispatcher_id, | |
| 1537 uint32 host_resolver_id, | |
| 1538 bool succeeded, | |
| 1539 const std::string& canonical_name, | |
| 1540 const std::vector<PP_NetAddress_Private>& net_address_list) { | |
| 1541 ppapi::PPB_HostResolver_Shared* host_resolver = | |
| 1542 host_resolvers_.Lookup(host_resolver_id); | |
| 1543 if (host_resolver) { | |
| 1544 host_resolver->OnResolveCompleted(succeeded, | |
| 1545 canonical_name, | |
| 1546 net_address_list); | |
| 1547 } | |
| 1548 } | |
| 1549 | |
| 1550 int PepperPluginDelegateImpl::GetRoutingID() const { | 1496 int PepperPluginDelegateImpl::GetRoutingID() const { |
| 1551 return render_view_->routing_id(); | 1497 return render_view_->routing_id(); |
| 1552 } | 1498 } |
| 1553 | 1499 |
| 1554 int PepperPluginDelegateImpl::OpenDevice(PP_DeviceType_Dev type, | 1500 int PepperPluginDelegateImpl::OpenDevice(PP_DeviceType_Dev type, |
| 1555 const std::string& device_id, | 1501 const std::string& device_id, |
| 1556 const OpenDeviceCallback& callback) { | 1502 const OpenDeviceCallback& callback) { |
| 1557 int request_id = | 1503 int request_id = |
| 1558 device_enumeration_event_handler_->RegisterOpenDeviceCallback(callback); | 1504 device_enumeration_event_handler_->RegisterOpenDeviceCallback(callback); |
| 1559 | 1505 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 RenderWidgetFullscreenPepper* container = | 1586 RenderWidgetFullscreenPepper* container = |
| 1641 static_cast<RenderWidgetFullscreenPepper*>( | 1587 static_cast<RenderWidgetFullscreenPepper*>( |
| 1642 instance->fullscreen_container()); | 1588 instance->fullscreen_container()); |
| 1643 return container->mouse_lock_dispatcher(); | 1589 return container->mouse_lock_dispatcher(); |
| 1644 } else { | 1590 } else { |
| 1645 return render_view_->mouse_lock_dispatcher(); | 1591 return render_view_->mouse_lock_dispatcher(); |
| 1646 } | 1592 } |
| 1647 } | 1593 } |
| 1648 | 1594 |
| 1649 } // namespace content | 1595 } // namespace content |
| OLD | NEW |