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 NET_BASE_TCP_LISTEN_SOCKET_H_ | 5 #ifndef NET_BASE_TCP_LISTEN_SOCKET_H_ |
6 #define NET_BASE_TCP_LISTEN_SOCKET_H_ | 6 #define NET_BASE_TCP_LISTEN_SOCKET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 static SOCKET CreateAndBind(const std::string& ip, int port); | 33 static SOCKET CreateAndBind(const std::string& ip, int port); |
34 | 34 |
35 // Implements StreamListenSocket::Accept. | 35 // Implements StreamListenSocket::Accept. |
36 virtual void Accept() OVERRIDE; | 36 virtual void Accept() OVERRIDE; |
37 | 37 |
38 private: | 38 private: |
39 DISALLOW_COPY_AND_ASSIGN(TCPListenSocket); | 39 DISALLOW_COPY_AND_ASSIGN(TCPListenSocket); |
40 }; | 40 }; |
41 | 41 |
| 42 // Factory that can be used to instantiate TCPListenSocket. |
| 43 class TCPListenSocketFactory : public StreamListenSocketFactory { |
| 44 public: |
| 45 TCPListenSocketFactory(const std::string& ip, int port); |
| 46 virtual ~TCPListenSocketFactory(); |
| 47 |
| 48 // StreamListenSocketFactory overrides. |
| 49 virtual scoped_refptr<StreamListenSocket> CreateAndListen( |
| 50 StreamListenSocket::Delegate* delegate) OVERRIDE; |
| 51 |
| 52 private: |
| 53 const std::string ip_; |
| 54 const int port_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(TCPListenSocketFactory); |
| 57 }; |
| 58 |
42 } // namespace net | 59 } // namespace net |
43 | 60 |
44 #endif // NET_BASE_TCP_LISTEN_SOCKET_H_ | 61 #endif // NET_BASE_TCP_LISTEN_SOCKET_H_ |
OLD | NEW |