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