| 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "content/browser/renderer_host/p2p/socket_host_throttler.h" | 13 #include "content/browser/renderer_host/p2p/socket_host_throttler.h" |
| 14 #include "content/public/browser/browser_message_filter.h" | 14 #include "content/public/browser/browser_message_filter.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/common/p2p_socket_type.h" | 16 #include "content/public/common/p2p_socket_type.h" |
| 17 #include "net/base/ip_endpoint.h" | 17 #include "net/base/ip_endpoint.h" |
| 18 #include "net/base/network_change_notifier.h" | 18 #include "net/base/network_change_notifier.h" |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace talk_base { | |
| 25 struct PacketOptions; | |
| 26 } | |
| 27 | |
| 28 namespace content { | 24 namespace content { |
| 29 | 25 |
| 30 class P2PSocketHost; | 26 class P2PSocketHost; |
| 31 class ResourceContext; | 27 class ResourceContext; |
| 32 | 28 |
| 33 class P2PSocketDispatcherHost | 29 class P2PSocketDispatcherHost |
| 34 : public content::BrowserMessageFilter, | 30 : public content::BrowserMessageFilter, |
| 35 public net::NetworkChangeNotifier::IPAddressObserver { | 31 public net::NetworkChangeNotifier::IPAddressObserver { |
| 36 public: | 32 public: |
| 37 P2PSocketDispatcherHost(content::ResourceContext* resource_context, | 33 P2PSocketDispatcherHost(content::ResourceContext* resource_context, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 void OnCreateSocket(P2PSocketType type, | 65 void OnCreateSocket(P2PSocketType type, |
| 70 int socket_id, | 66 int socket_id, |
| 71 const net::IPEndPoint& local_address, | 67 const net::IPEndPoint& local_address, |
| 72 const net::IPEndPoint& remote_address); | 68 const net::IPEndPoint& remote_address); |
| 73 void OnAcceptIncomingTcpConnection(int listen_socket_id, | 69 void OnAcceptIncomingTcpConnection(int listen_socket_id, |
| 74 const net::IPEndPoint& remote_address, | 70 const net::IPEndPoint& remote_address, |
| 75 int connected_socket_id); | 71 int connected_socket_id); |
| 76 void OnSend(int socket_id, | 72 void OnSend(int socket_id, |
| 77 const net::IPEndPoint& socket_address, | 73 const net::IPEndPoint& socket_address, |
| 78 const std::vector<char>& data, | 74 const std::vector<char>& data, |
| 79 const talk_base::PacketOptions& options, | 75 net::DiffServCodePoint dscp, |
| 80 uint64 packet_id); | 76 uint64 packet_id); |
| 81 void OnSetOption(int socket_id, P2PSocketOption option, int value); | 77 void OnSetOption(int socket_id, P2PSocketOption option, int value); |
| 82 void OnDestroySocket(int socket_id); | 78 void OnDestroySocket(int socket_id); |
| 83 | 79 |
| 84 void DoGetNetworkList(); | 80 void DoGetNetworkList(); |
| 85 void SendNetworkList(const net::NetworkInterfaceList& list); | 81 void SendNetworkList(const net::NetworkInterfaceList& list); |
| 86 | 82 |
| 87 void OnAddressResolved(DnsRequest* request, | 83 void OnAddressResolved(DnsRequest* request, |
| 88 const net::IPAddressList& addresses); | 84 const net::IPAddressList& addresses); |
| 89 | 85 |
| 90 content::ResourceContext* resource_context_; | 86 content::ResourceContext* resource_context_; |
| 91 scoped_refptr<net::URLRequestContextGetter> url_context_; | 87 scoped_refptr<net::URLRequestContextGetter> url_context_; |
| 92 | 88 |
| 93 SocketsMap sockets_; | 89 SocketsMap sockets_; |
| 94 | 90 |
| 95 bool monitoring_networks_; | 91 bool monitoring_networks_; |
| 96 | 92 |
| 97 std::set<DnsRequest*> dns_requests_; | 93 std::set<DnsRequest*> dns_requests_; |
| 98 P2PMessageThrottler throttler_; | 94 P2PMessageThrottler throttler_; |
| 99 | 95 |
| 100 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcherHost); | 96 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcherHost); |
| 101 }; | 97 }; |
| 102 | 98 |
| 103 } // namespace content | 99 } // namespace content |
| 104 | 100 |
| 105 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ | 101 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ |
| OLD | NEW |