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_HOST_POSIX_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_POSIX_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_POSIX_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_POSIX_H_ |
7 | 7 |
8 #include "content/common/p2p_sockets.h" | 8 #include "content/common/p2p_sockets.h" |
9 | 9 |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "content/browser/renderer_host/p2p_socket_host.h" | 11 #include "content/browser/renderer_host/p2p_socket_host.h" |
12 | 12 |
13 class P2PSocketHostPosix : public P2PSocketHost { | 13 class P2PSocketHostPosix : public P2PSocketHost { |
14 public: | 14 public: |
15 P2PSocketHostPosix(P2PSocketsHost* host, int routing_id, int id); | 15 P2PSocketHostPosix(P2PSocketsHost* host, int routing_id, int id); |
16 virtual ~P2PSocketHostPosix(); | 16 virtual ~P2PSocketHostPosix(); |
17 | 17 |
18 virtual bool Init(); | 18 virtual bool Init(); |
19 virtual void Send(const P2PSocketAddress& socket_address, | 19 virtual void Send(const net::IPEndPoint& socket_address, |
20 const std::vector<char>& data); | 20 const std::vector<char>& data); |
21 | 21 |
22 private: | 22 private: |
23 enum State { | 23 enum State { |
24 STATE_UNINITIALIZED, | 24 STATE_UNINITIALIZED, |
25 STATE_OPEN, | 25 STATE_OPEN, |
26 STATE_ERROR, | 26 STATE_ERROR, |
27 }; | 27 }; |
28 | 28 |
29 // MessageLoopForIO::Watcher implementation used to catch read | 29 // MessageLoopForIO::Watcher implementation used to catch read |
(...skipping 19 matching lines...) Expand all Loading... |
49 | 49 |
50 State state_; | 50 State state_; |
51 int socket_; | 51 int socket_; |
52 MessageLoopForIO::FileDescriptorWatcher read_socket_watcher_; | 52 MessageLoopForIO::FileDescriptorWatcher read_socket_watcher_; |
53 ReadWatcher read_watcher_; | 53 ReadWatcher read_watcher_; |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostPosix); | 55 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostPosix); |
56 }; | 56 }; |
57 | 57 |
58 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_POSIX_H_ | 58 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_POSIX_H_ |
OLD | NEW |