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/browser/renderer_host/p2p/socket_dispatcher_host.h" | 5 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "content/browser/renderer_host/p2p/socket_host.h" | 9 #include "content/browser/renderer_host/p2p/socket_host.h" |
10 #include "content/common/p2p_messages.h" | 10 #include "content/common/p2p_messages.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 if (monitoring_networks_) { | 113 if (monitoring_networks_) { |
114 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); | 114 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
115 monitoring_networks_ = false; | 115 monitoring_networks_ = false; |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 void P2PSocketDispatcherHost::OnDestruct() const { | 119 void P2PSocketDispatcherHost::OnDestruct() const { |
120 BrowserThread::DeleteOnIOThread::Destruct(this); | 120 BrowserThread::DeleteOnIOThread::Destruct(this); |
121 } | 121 } |
122 | 122 |
123 bool P2PSocketDispatcherHost::OnMessageReceived(const IPC::Message& message, | 123 bool P2PSocketDispatcherHost::OnMessageReceived(const IPC::Message& message) { |
124 bool* message_was_ok) { | |
125 bool handled = true; | 124 bool handled = true; |
126 IPC_BEGIN_MESSAGE_MAP_EX(P2PSocketDispatcherHost, message, *message_was_ok) | 125 IPC_BEGIN_MESSAGE_MAP(P2PSocketDispatcherHost, message) |
127 IPC_MESSAGE_HANDLER(P2PHostMsg_StartNetworkNotifications, | 126 IPC_MESSAGE_HANDLER(P2PHostMsg_StartNetworkNotifications, |
128 OnStartNetworkNotifications) | 127 OnStartNetworkNotifications) |
129 IPC_MESSAGE_HANDLER(P2PHostMsg_StopNetworkNotifications, | 128 IPC_MESSAGE_HANDLER(P2PHostMsg_StopNetworkNotifications, |
130 OnStopNetworkNotifications) | 129 OnStopNetworkNotifications) |
131 IPC_MESSAGE_HANDLER(P2PHostMsg_GetHostAddress, OnGetHostAddress) | 130 IPC_MESSAGE_HANDLER(P2PHostMsg_GetHostAddress, OnGetHostAddress) |
132 IPC_MESSAGE_HANDLER(P2PHostMsg_CreateSocket, OnCreateSocket) | 131 IPC_MESSAGE_HANDLER(P2PHostMsg_CreateSocket, OnCreateSocket) |
133 IPC_MESSAGE_HANDLER(P2PHostMsg_AcceptIncomingTcpConnection, | 132 IPC_MESSAGE_HANDLER(P2PHostMsg_AcceptIncomingTcpConnection, |
134 OnAcceptIncomingTcpConnection) | 133 OnAcceptIncomingTcpConnection) |
135 IPC_MESSAGE_HANDLER(P2PHostMsg_Send, OnSend) | 134 IPC_MESSAGE_HANDLER(P2PHostMsg_Send, OnSend) |
136 IPC_MESSAGE_HANDLER(P2PHostMsg_SetOption, OnSetOption) | 135 IPC_MESSAGE_HANDLER(P2PHostMsg_SetOption, OnSetOption) |
137 IPC_MESSAGE_HANDLER(P2PHostMsg_DestroySocket, OnDestroySocket) | 136 IPC_MESSAGE_HANDLER(P2PHostMsg_DestroySocket, OnDestroySocket) |
138 IPC_MESSAGE_UNHANDLED(handled = false) | 137 IPC_MESSAGE_UNHANDLED(handled = false) |
139 IPC_END_MESSAGE_MAP_EX() | 138 IPC_END_MESSAGE_MAP() |
140 return handled; | 139 return handled; |
141 } | 140 } |
142 | 141 |
143 void P2PSocketDispatcherHost::OnIPAddressChanged() { | 142 void P2PSocketDispatcherHost::OnIPAddressChanged() { |
144 // Notify the renderer about changes to list of network interfaces. | 143 // Notify the renderer about changes to list of network interfaces. |
145 BrowserThread::PostTask( | 144 BrowserThread::PostTask( |
146 BrowserThread::FILE, FROM_HERE, base::Bind( | 145 BrowserThread::FILE, FROM_HERE, base::Bind( |
147 &P2PSocketDispatcherHost::DoGetNetworkList, this)); | 146 &P2PSocketDispatcherHost::DoGetNetworkList, this)); |
148 } | 147 } |
149 | 148 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 void P2PSocketDispatcherHost::OnAddressResolved( | 288 void P2PSocketDispatcherHost::OnAddressResolved( |
290 DnsRequest* request, | 289 DnsRequest* request, |
291 const net::IPAddressList& addresses) { | 290 const net::IPAddressList& addresses) { |
292 Send(new P2PMsg_GetHostAddressResult(request->request_id(), addresses)); | 291 Send(new P2PMsg_GetHostAddressResult(request->request_id(), addresses)); |
293 | 292 |
294 dns_requests_.erase(request); | 293 dns_requests_.erase(request); |
295 delete request; | 294 delete request; |
296 } | 295 } |
297 | 296 |
298 } // namespace content | 297 } // namespace content |
OLD | NEW |