Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / net / socket / tcp_server_socket.h
blobb161be65723f3e7593c614c1304b882a17ca97e4
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
3 // found in the LICENSE file.
5 #ifndef NET_SOCKET_TCP_SERVER_SOCKET_H_
6 #define NET_SOCKET_TCP_SERVER_SOCKET_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "net/base/ip_endpoint.h"
12 #include "net/base/net_export.h"
13 #include "net/log/net_log.h"
14 #include "net/socket/server_socket.h"
15 #include "net/socket/tcp_socket.h"
17 namespace net {
19 class NET_EXPORT_PRIVATE TCPServerSocket : public ServerSocket {
20 public:
21 TCPServerSocket(NetLog* net_log, const NetLog::Source& source);
22 ~TCPServerSocket() override;
24 // net::ServerSocket implementation.
25 int Listen(const IPEndPoint& address, int backlog) override;
26 int GetLocalAddress(IPEndPoint* address) const override;
27 int Accept(scoped_ptr<StreamSocket>* socket,
28 const CompletionCallback& callback) override;
30 private:
31 // Converts |accepted_socket_| and stores the result in
32 // |output_accepted_socket|.
33 // |output_accepted_socket| is untouched on failure. But |accepted_socket_| is
34 // set to NULL in any case.
35 int ConvertAcceptedSocket(int result,
36 scoped_ptr<StreamSocket>* output_accepted_socket);
37 // Completion callback for calling TCPSocket::Accept().
38 void OnAcceptCompleted(scoped_ptr<StreamSocket>* output_accepted_socket,
39 const CompletionCallback& forward_callback,
40 int result);
42 TCPSocket socket_;
44 scoped_ptr<TCPSocket> accepted_socket_;
45 IPEndPoint accepted_address_;
46 bool pending_accept_;
48 DISALLOW_COPY_AND_ASSIGN(TCPServerSocket);
51 } // namespace net
53 #endif // NET_SOCKET_TCP_SERVER_SOCKET_H_