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 REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ | 5 #ifndef REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ |
6 #define REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ | 6 #define REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "remoting/proto/mux.pb.h" | 9 #include "remoting/proto/mux.pb.h" |
10 #include "remoting/protocol/buffered_socket_writer.h" | 10 #include "remoting/protocol/buffered_socket_writer.h" |
11 #include "remoting/protocol/message_reader.h" | 11 #include "remoting/protocol/message_reader.h" |
12 #include "remoting/protocol/stream_channel_factory.h" | 12 #include "remoting/protocol/stream_channel_factory.h" |
13 | 13 |
14 namespace remoting { | 14 namespace remoting { |
15 namespace protocol { | 15 namespace protocol { |
16 | 16 |
17 class ChannelMultiplexer : public StreamChannelFactory { | 17 class ChannelMultiplexer : public StreamChannelFactory { |
18 public: | 18 public: |
19 static const char kMuxChannelName[]; | 19 static const char kMuxChannelName[]; |
20 | 20 |
21 // |factory| is used to create the channel upon which to multiplex. | 21 // |factory| is used to create the channel upon which to multiplex. |
22 ChannelMultiplexer(StreamChannelFactory* factory, | 22 ChannelMultiplexer(StreamChannelFactory* factory, |
23 const std::string& base_channel_name); | 23 const std::string& base_channel_name); |
24 virtual ~ChannelMultiplexer(); | 24 virtual ~ChannelMultiplexer(); |
25 | 25 |
26 // StreamChannelFactory interface. | 26 // StreamChannelFactory interface. |
27 virtual void CreateChannel(const std::string& name, | 27 virtual void CreateChannel(const std::string& name, |
28 const ChannelCreatedCallback& callback) OVERRIDE; | 28 const ChannelCreatedCallback& callback) override; |
29 virtual void CancelChannelCreation(const std::string& name) OVERRIDE; | 29 virtual void CancelChannelCreation(const std::string& name) override; |
30 | 30 |
31 private: | 31 private: |
32 struct PendingChannel; | 32 struct PendingChannel; |
33 class MuxChannel; | 33 class MuxChannel; |
34 class MuxSocket; | 34 class MuxSocket; |
35 friend class MuxChannel; | 35 friend class MuxChannel; |
36 | 36 |
37 // Callback for |base_channel_| creation. | 37 // Callback for |base_channel_| creation. |
38 void OnBaseChannelReady(scoped_ptr<net::StreamSocket> socket); | 38 void OnBaseChannelReady(scoped_ptr<net::StreamSocket> socket); |
39 | 39 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 base::WeakPtrFactory<ChannelMultiplexer> weak_factory_; | 83 base::WeakPtrFactory<ChannelMultiplexer> weak_factory_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(ChannelMultiplexer); | 85 DISALLOW_COPY_AND_ASSIGN(ChannelMultiplexer); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace protocol | 88 } // namespace protocol |
89 } // namespace remoting | 89 } // namespace remoting |
90 | 90 |
91 | 91 |
92 #endif // REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ | 92 #endif // REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ |
OLD | NEW |