Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: blimp/net/tcp_client_transport.h

Issue 2632803002: Remove all blimp network code. (Closed)
Patch Set: merge from origin/master for good measure Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « blimp/net/stream_socket_connection.cc ('k') | blimp/net/tcp_client_transport.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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.
4
5 #ifndef BLIMP_NET_TCP_CLIENT_TRANSPORT_H_
6 #define BLIMP_NET_TCP_CLIENT_TRANSPORT_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/callback.h"
12 #include "base/macros.h"
13 #include "blimp/net/blimp_net_export.h"
14 #include "blimp/net/blimp_transport.h"
15 #include "net/base/address_list.h"
16 #include "net/base/net_errors.h"
17
18 namespace net {
19 class ClientSocketFactory;
20 class NetLog;
21 class StreamSocket;
22 } // namespace net
23
24 namespace blimp {
25
26 class MessagePort;
27
28 // BlimpTransport which creates a TCP connection to one of the specified
29 // |addresses| on each call to Connect().
30 class BLIMP_NET_EXPORT TCPClientTransport : public BlimpTransport {
31 public:
32 TCPClientTransport(const net::IPEndPoint& ip_endpoint,
33 net::NetLog* net_log);
34 ~TCPClientTransport() override;
35
36 void SetClientSocketFactoryForTest(net::ClientSocketFactory* factory);
37
38 // BlimpTransport implementation.
39 void Connect(const net::CompletionCallback& callback) override;
40 std::unique_ptr<BlimpConnection> MakeConnection() override;
41
42 std::unique_ptr<MessagePort> TakeMessagePort();
43
44 const char* GetName() const override;
45
46 protected:
47 // Called when the TCP connection completed.
48 virtual void OnTCPConnectComplete(int result);
49
50 // Called when the connection attempt completed or failed.
51 // Resets |socket_| if |result| indicates a failure (!= net::OK).
52 void OnConnectComplete(int result);
53
54 // Methods for taking and setting |socket_|. Can be used by subclasses to
55 // swap out a socket for an upgraded one, e.g. adding SSL encryption.
56 std::unique_ptr<net::StreamSocket> TakeSocket();
57 void SetSocket(std::unique_ptr<net::StreamSocket> socket);
58
59 // Gets the socket factory instance.
60 net::ClientSocketFactory* socket_factory() const;
61
62 private:
63 net::IPEndPoint ip_endpoint_;
64 net::NetLog* net_log_;
65 net::CompletionCallback connect_callback_;
66 net::ClientSocketFactory* socket_factory_ = nullptr;
67 std::unique_ptr<net::StreamSocket> socket_;
68
69 DISALLOW_COPY_AND_ASSIGN(TCPClientTransport);
70 };
71
72 } // namespace blimp
73
74 #endif // BLIMP_NET_TCP_CLIENT_TRANSPORT_H_
OLDNEW
« no previous file with comments | « blimp/net/stream_socket_connection.cc ('k') | blimp/net/tcp_client_transport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698