| 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 | 9 |
| 10 #include "content/common/p2p_sockets.h" | 10 #include "content/common/p2p_sockets.h" |
| 11 #include "content/public/browser/browser_message_filter.h" | 11 #include "content/public/browser/browser_message_filter.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "net/base/ip_endpoint.h" | 13 #include "net/base/ip_endpoint.h" |
| 14 #include "net/base/network_change_notifier.h" | 14 #include "net/base/network_change_notifier.h" |
| 15 | 15 |
| 16 namespace net { |
| 17 class URLRequestContextGetter; |
| 18 } |
| 19 |
| 16 namespace content { | 20 namespace content { |
| 17 | 21 |
| 18 class P2PSocketHost; | 22 class P2PSocketHost; |
| 19 class ResourceContext; | 23 class ResourceContext; |
| 20 | 24 |
| 21 class P2PSocketDispatcherHost | 25 class P2PSocketDispatcherHost |
| 22 : public content::BrowserMessageFilter, | 26 : public content::BrowserMessageFilter, |
| 23 public net::NetworkChangeNotifier::IPAddressObserver { | 27 public net::NetworkChangeNotifier::IPAddressObserver { |
| 24 public: | 28 public: |
| 25 P2PSocketDispatcherHost(content::ResourceContext* resource_context); | 29 P2PSocketDispatcherHost(content::ResourceContext* resource_context, |
| 30 net::URLRequestContextGetter* url_context); |
| 26 | 31 |
| 27 // content::BrowserMessageFilter overrides. | 32 // content::BrowserMessageFilter overrides. |
| 28 virtual void OnChannelClosing() OVERRIDE; | 33 virtual void OnChannelClosing() OVERRIDE; |
| 29 virtual void OnDestruct() const OVERRIDE; | 34 virtual void OnDestruct() const OVERRIDE; |
| 30 virtual bool OnMessageReceived(const IPC::Message& message, | 35 virtual bool OnMessageReceived(const IPC::Message& message, |
| 31 bool* message_was_ok) OVERRIDE; | 36 bool* message_was_ok) OVERRIDE; |
| 32 | 37 |
| 33 // net::NetworkChangeNotifier::IPAddressObserver interface. | 38 // net::NetworkChangeNotifier::IPAddressObserver interface. |
| 34 virtual void OnIPAddressChanged() OVERRIDE; | 39 virtual void OnIPAddressChanged() OVERRIDE; |
| 35 | 40 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 65 const std::vector<char>& data); | 70 const std::vector<char>& data); |
| 66 void OnDestroySocket(int socket_id); | 71 void OnDestroySocket(int socket_id); |
| 67 | 72 |
| 68 void DoGetNetworkList(); | 73 void DoGetNetworkList(); |
| 69 void SendNetworkList(const net::NetworkInterfaceList& list); | 74 void SendNetworkList(const net::NetworkInterfaceList& list); |
| 70 | 75 |
| 71 void OnAddressResolved(DnsRequest* request, | 76 void OnAddressResolved(DnsRequest* request, |
| 72 const net::IPAddressNumber& result); | 77 const net::IPAddressNumber& result); |
| 73 | 78 |
| 74 content::ResourceContext* resource_context_; | 79 content::ResourceContext* resource_context_; |
| 80 scoped_refptr<net::URLRequestContextGetter> url_context_; |
| 75 | 81 |
| 76 SocketsMap sockets_; | 82 SocketsMap sockets_; |
| 77 | 83 |
| 78 bool monitoring_networks_; | 84 bool monitoring_networks_; |
| 79 | 85 |
| 80 std::set<DnsRequest*> dns_requests_; | 86 std::set<DnsRequest*> dns_requests_; |
| 81 | 87 |
| 82 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcherHost); | 88 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcherHost); |
| 83 }; | 89 }; |
| 84 | 90 |
| 85 } // namespace content | 91 } // namespace content |
| 86 | 92 |
| 87 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ | 93 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ |
| OLD | NEW |