OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/base/ip_endpoint.h" | 13 #include "net/base/ip_endpoint.h" |
13 #include "net/base/network_change_notifier.h" | 14 #include "net/base/network_change_notifier.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 class P2PSocketHost; | 18 class P2PSocketHost; |
18 class ResourceContext; | 19 class ResourceContext; |
19 | 20 |
20 class P2PSocketDispatcherHost | 21 class P2PSocketDispatcherHost |
21 : public content::BrowserMessageFilter, | 22 : public content::BrowserMessageFilter, |
22 public net::NetworkChangeNotifier::IPAddressObserver { | 23 public net::NetworkChangeNotifier::IPAddressObserver { |
23 public: | 24 public: |
24 P2PSocketDispatcherHost(content::ResourceContext* resource_context); | 25 P2PSocketDispatcherHost(content::ResourceContext* resource_context); |
25 virtual ~P2PSocketDispatcherHost(); | |
26 | 26 |
27 // content::BrowserMessageFilter overrides. | 27 // content::BrowserMessageFilter overrides. |
28 virtual void OnChannelClosing() OVERRIDE; | 28 virtual void OnChannelClosing() OVERRIDE; |
29 virtual void OnDestruct() const OVERRIDE; | 29 virtual void OnDestruct() const OVERRIDE; |
30 virtual bool OnMessageReceived(const IPC::Message& message, | 30 virtual bool OnMessageReceived(const IPC::Message& message, |
31 bool* message_was_ok) OVERRIDE; | 31 bool* message_was_ok) OVERRIDE; |
32 | 32 |
33 // net::NetworkChangeNotifier::IPAddressObserver interface. | 33 // net::NetworkChangeNotifier::IPAddressObserver interface. |
34 virtual void OnIPAddressChanged() OVERRIDE; | 34 virtual void OnIPAddressChanged() OVERRIDE; |
35 | 35 |
| 36 protected: |
| 37 virtual ~P2PSocketDispatcherHost(); |
| 38 |
36 private: | 39 private: |
| 40 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
| 41 friend class base::DeleteHelper<P2PSocketDispatcherHost>; |
| 42 |
37 typedef std::pair<int32, int> ExtendedSocketId; | 43 typedef std::pair<int32, int> ExtendedSocketId; |
38 typedef std::map<ExtendedSocketId, P2PSocketHost*> SocketsMap; | 44 typedef std::map<ExtendedSocketId, P2PSocketHost*> SocketsMap; |
39 | 45 |
40 class DnsRequest; | 46 class DnsRequest; |
41 | 47 |
42 P2PSocketHost* LookupSocket(int32 routing_id, int socket_id); | 48 P2PSocketHost* LookupSocket(int32 routing_id, int socket_id); |
43 | 49 |
44 // Handlers for the messages coming from the renderer. | 50 // Handlers for the messages coming from the renderer. |
45 void OnStartNetworkNotifications(const IPC::Message& msg); | 51 void OnStartNetworkNotifications(const IPC::Message& msg); |
46 void OnStopNetworkNotifications(const IPC::Message& msg); | 52 void OnStopNetworkNotifications(const IPC::Message& msg); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 std::set<int> notifications_routing_ids_; | 86 std::set<int> notifications_routing_ids_; |
81 | 87 |
82 std::set<DnsRequest*> dns_requests_; | 88 std::set<DnsRequest*> dns_requests_; |
83 | 89 |
84 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcherHost); | 90 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcherHost); |
85 }; | 91 }; |
86 | 92 |
87 } // namespace content | 93 } // namespace content |
88 | 94 |
89 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ | 95 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ |
OLD | NEW |