diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-09 20:09:14 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-09 20:09:14 +0000 |
commit | efa5d93850c47d34931c89533ec3f480938e056a (patch) | |
tree | 69ccd135eb2be4c5d6c96c945f9206b902d4f240 /content/renderer/p2p/socket_dispatcher.cc | |
parent | cbee936231bafb19a7be8a2eec44470b40ad326b (diff) | |
download | chromium_src-efa5d93850c47d34931c89533ec3f480938e056a.zip chromium_src-efa5d93850c47d34931c89533ec3f480938e056a.tar.gz chromium_src-efa5d93850c47d34931c89533ec3f480938e056a.tar.bz2 |
Add IPC for DNS host address resolution.
TEST=None
BUG=83242
Review URL: http://codereview.chromium.org/7599003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96047 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/p2p/socket_dispatcher.cc')
-rw-r--r-- | content/renderer/p2p/socket_dispatcher.cc | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/content/renderer/p2p/socket_dispatcher.cc b/content/renderer/p2p/socket_dispatcher.cc index 43c9de3..ba00e99 100644 --- a/content/renderer/p2p/socket_dispatcher.cc +++ b/content/renderer/p2p/socket_dispatcher.cc @@ -6,6 +6,8 @@ #include "base/message_loop_proxy.h" #include "content/common/p2p_messages.h" +#include "content/renderer/p2p/host_address_request.h" +#include "content/renderer/p2p/socket_client.h" P2PSocketDispatcher::P2PSocketDispatcher(RenderView* render_view) : RenderViewObserver(render_view), @@ -42,6 +44,7 @@ bool P2PSocketDispatcher::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(P2PSocketDispatcher, message) IPC_MESSAGE_HANDLER(P2PMsg_NetworkListChanged, OnNetworkListChanged) + IPC_MESSAGE_HANDLER(P2PMsg_GetHostAddressResult, OnGetHostAddressResult) IPC_MESSAGE_HANDLER(P2PMsg_OnSocketCreated, OnSocketCreated) IPC_MESSAGE_HANDLER(P2PMsg_OnIncomingTcpConnection, OnIncomingTcpConnection) IPC_MESSAGE_HANDLER(P2PMsg_OnError, OnError) @@ -51,6 +54,10 @@ bool P2PSocketDispatcher::OnMessageReceived(const IPC::Message& message) { return handled; } +base::MessageLoopProxy* P2PSocketDispatcher::message_loop() { + return message_loop_; +} + int P2PSocketDispatcher::RegisterClient(P2PSocketClient* client) { return clients_.Add(client); } @@ -64,8 +71,13 @@ void P2PSocketDispatcher::SendP2PMessage(IPC::Message* msg) { Send(msg); } -base::MessageLoopProxy* P2PSocketDispatcher::message_loop() { - return message_loop_; +int P2PSocketDispatcher::RegisterHostAddressRequest( + P2PHostAddressRequest* request) { + return host_address_requests_.Add(request); +} + +void P2PSocketDispatcher::UnregisterHostAddressRequest(int id) { + host_address_requests_.Remove(id); } void P2PSocketDispatcher::OnNetworkListChanged( @@ -74,6 +86,18 @@ void P2PSocketDispatcher::OnNetworkListChanged( networks); } +void P2PSocketDispatcher::OnGetHostAddressResult( + int32 request_id, + const net::IPAddressNumber& address) { + P2PHostAddressRequest* request = host_address_requests_.Lookup(request_id); + if (!request) { + VLOG(1) << "Received P2P message for socket that doesn't exist."; + return; + } + + request->OnResponse(address); +} + void P2PSocketDispatcher::OnSocketCreated( int socket_id, const net::IPEndPoint& address) { P2PSocketClient* client = GetClient(socket_id); |