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_SOCKETS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKETS_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKETS_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKETS_HOST_H_ |
7 | 7 |
8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
9 #include "content/browser/browser_message_filter.h" | 9 #include "content/browser/browser_message_filter.h" |
10 #include "content/common/p2p_sockets.h" | 10 #include "content/common/p2p_sockets.h" |
| 11 #include "net/base/ip_endpoint.h" |
11 | 12 |
12 class P2PSocketHost; | 13 class P2PSocketHost; |
13 | 14 |
14 class P2PSocketsHost : public BrowserMessageFilter { | 15 class P2PSocketsHost : public BrowserMessageFilter { |
15 public: | 16 public: |
16 P2PSocketsHost(); | 17 P2PSocketsHost(); |
17 virtual ~P2PSocketsHost(); | 18 virtual ~P2PSocketsHost(); |
18 | 19 |
19 // BrowserMessageFilter overrides. | 20 // BrowserMessageFilter overrides. |
20 virtual void OnChannelClosing(); | 21 virtual void OnChannelClosing(); |
21 virtual void OnDestruct() const; | 22 virtual void OnDestruct() const; |
22 virtual bool OnMessageReceived(const IPC::Message& message, | 23 virtual bool OnMessageReceived(const IPC::Message& message, |
23 bool* message_was_ok); | 24 bool* message_was_ok); |
24 | 25 |
25 private: | 26 private: |
26 void OnCreateSocket(const IPC::Message& msg, P2PSocketType type, | 27 void OnCreateSocket(const IPC::Message& msg, P2PSocketType type, |
27 int socket_id, const P2PSocketAddress& remote_address); | 28 int socket_id, const net::IPEndPoint& remote_address); |
28 void OnSend(const IPC::Message& msg, int socket_id, | 29 void OnSend(const IPC::Message& msg, int socket_id, |
29 const P2PSocketAddress& socket_address, | 30 const net::IPEndPoint& socket_address, |
30 const std::vector<char>& data); | 31 const std::vector<char>& data); |
31 void OnDestroySocket(const IPC::Message& msg, int socket_id); | 32 void OnDestroySocket(const IPC::Message& msg, int socket_id); |
32 | 33 |
33 IDMap<P2PSocketHost, IDMapOwnPointer> sockets_; | 34 IDMap<P2PSocketHost, IDMapOwnPointer> sockets_; |
34 | 35 |
35 DISALLOW_COPY_AND_ASSIGN(P2PSocketsHost); | 36 DISALLOW_COPY_AND_ASSIGN(P2PSocketsHost); |
36 }; | 37 }; |
37 | 38 |
38 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKETS_HOST_H_ | 39 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKETS_HOST_H_ |
OLD | NEW |