OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_ | 5 #ifndef REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_ |
6 #define REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_ | 6 #define REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "remoting/protocol/stream_channel_factory.h" | 11 #include "remoting/protocol/stream_channel_factory.h" |
12 | 12 |
13 namespace remoting { | 13 namespace remoting { |
14 namespace protocol { | 14 namespace protocol { |
15 | 15 |
16 class DatagramChannelFactory; | 16 class DatagramChannelFactory; |
17 | 17 |
18 // StreamChannelFactory that creates PseudoTCP-based stream channels that run on | 18 // StreamChannelFactory that creates PseudoTCP-based stream channels that run on |
19 // top of datagram channels created using specified |datagram_channel_factory|. | 19 // top of datagram channels created using specified |datagram_channel_factory|. |
20 class PseudoTcpChannelFactory : public StreamChannelFactory { | 20 class PseudoTcpChannelFactory : public StreamChannelFactory { |
21 public: | 21 public: |
22 // |datagram_channel_factory| must outlive this object. | 22 // |datagram_channel_factory| must outlive this object. |
23 explicit PseudoTcpChannelFactory( | 23 explicit PseudoTcpChannelFactory( |
24 DatagramChannelFactory* datagram_channel_factory); | 24 DatagramChannelFactory* datagram_channel_factory); |
25 virtual ~PseudoTcpChannelFactory(); | 25 virtual ~PseudoTcpChannelFactory(); |
26 | 26 |
27 // StreamChannelFactory interface. | 27 // StreamChannelFactory interface. |
28 virtual void CreateChannel(const std::string& name, | 28 virtual void CreateChannel(const std::string& name, |
29 const ChannelCreatedCallback& callback) OVERRIDE; | 29 const ChannelCreatedCallback& callback) override; |
30 virtual void CancelChannelCreation(const std::string& name) OVERRIDE; | 30 virtual void CancelChannelCreation(const std::string& name) override; |
31 | 31 |
32 private: | 32 private: |
33 typedef std::map<std::string, net::StreamSocket*> PendingSocketsMap; | 33 typedef std::map<std::string, net::StreamSocket*> PendingSocketsMap; |
34 | 34 |
35 void OnDatagramChannelCreated(const std::string& name, | 35 void OnDatagramChannelCreated(const std::string& name, |
36 const ChannelCreatedCallback& callback, | 36 const ChannelCreatedCallback& callback, |
37 scoped_ptr<net::Socket> socket); | 37 scoped_ptr<net::Socket> socket); |
38 void OnPseudoTcpConnected(const std::string& name, | 38 void OnPseudoTcpConnected(const std::string& name, |
39 const ChannelCreatedCallback& callback, | 39 const ChannelCreatedCallback& callback, |
40 int result); | 40 int result); |
41 | 41 |
42 DatagramChannelFactory* datagram_channel_factory_; | 42 DatagramChannelFactory* datagram_channel_factory_; |
43 | 43 |
44 PendingSocketsMap pending_sockets_; | 44 PendingSocketsMap pending_sockets_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(PseudoTcpChannelFactory); | 46 DISALLOW_COPY_AND_ASSIGN(PseudoTcpChannelFactory); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace protocol | 49 } // namespace protocol |
50 } // namespace remoting | 50 } // namespace remoting |
51 | 51 |
52 #endif // REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_ | 52 #endif // REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_ |
OLD | NEW |