Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / remoting / protocol / pseudotcp_channel_factory.h
blob2d2dd89c14bd6ab86c30c29ccce2fe70cbe413be
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_
6 #define REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_
8 #include <map>
10 #include "base/basictypes.h"
11 #include "remoting/protocol/stream_channel_factory.h"
13 namespace remoting {
14 namespace protocol {
16 class DatagramChannelFactory;
17 class P2PDatagramSocket;
19 // StreamChannelFactory that creates PseudoTCP-based stream channels that run on
20 // top of datagram channels created using specified |datagram_channel_factory|.
21 class PseudoTcpChannelFactory : public StreamChannelFactory {
22 public:
23 // |datagram_channel_factory| must outlive this object.
24 explicit PseudoTcpChannelFactory(
25 DatagramChannelFactory* datagram_channel_factory);
26 ~PseudoTcpChannelFactory() override;
28 // StreamChannelFactory interface.
29 void CreateChannel(const std::string& name,
30 const ChannelCreatedCallback& callback) override;
31 void CancelChannelCreation(const std::string& name) override;
33 private:
34 typedef std::map<std::string, P2PStreamSocket*> PendingSocketsMap;
36 void OnDatagramChannelCreated(const std::string& name,
37 const ChannelCreatedCallback& callback,
38 scoped_ptr<P2PDatagramSocket> socket);
39 void OnPseudoTcpConnected(const std::string& name,
40 const ChannelCreatedCallback& callback,
41 int result);
43 DatagramChannelFactory* datagram_channel_factory_;
45 PendingSocketsMap pending_sockets_;
47 DISALLOW_COPY_AND_ASSIGN(PseudoTcpChannelFactory);
50 } // namespace protocol
51 } // namespace remoting
53 #endif // REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_