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