OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_STREAM_MESSAGE_PIPE_ADAPTER_H_ | 5 #ifndef REMOTING_PROTOCOL_STREAM_MESSAGE_PIPE_ADAPTER_H_ |
6 #define REMOTING_PROTOCOL_STREAM_MESSAGE_PIPE_ADAPTER_H_ | 6 #define REMOTING_PROTOCOL_STREAM_MESSAGE_PIPE_ADAPTER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "remoting/protocol/message_channel_factory.h" | 9 #include "remoting/protocol/message_channel_factory.h" |
10 #include "remoting/protocol/message_pipe.h" | 10 #include "remoting/protocol/message_pipe.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // P2PStreamChannel. | 22 // P2PStreamChannel. |
23 class StreamMessagePipeAdapter : public MessagePipe { | 23 class StreamMessagePipeAdapter : public MessagePipe { |
24 public: | 24 public: |
25 typedef base::Callback<void(int)> ErrorCallback; | 25 typedef base::Callback<void(int)> ErrorCallback; |
26 | 26 |
27 StreamMessagePipeAdapter(std::unique_ptr<P2PStreamSocket> socket, | 27 StreamMessagePipeAdapter(std::unique_ptr<P2PStreamSocket> socket, |
28 const ErrorCallback& error_callback); | 28 const ErrorCallback& error_callback); |
29 ~StreamMessagePipeAdapter() override; | 29 ~StreamMessagePipeAdapter() override; |
30 | 30 |
31 // MessagePipe interface. | 31 // MessagePipe interface. |
32 void StartReceiving(const MessageReceivedCallback& callback) override; | 32 void Start(EventHandler* event_handler) override; |
33 void Send(google::protobuf::MessageLite* message, | 33 void Send(google::protobuf::MessageLite* message, |
34 const base::Closure& done) override; | 34 const base::Closure& done) override; |
35 | 35 |
36 private: | 36 private: |
37 void CloseOnError(int error); | 37 void CloseOnError(int error); |
38 | 38 |
39 std::unique_ptr<P2PStreamSocket> socket_; | 39 std::unique_ptr<P2PStreamSocket> socket_; |
40 ErrorCallback error_callback_; | 40 ErrorCallback error_callback_; |
41 | 41 |
42 MessageReader reader_; | 42 MessageReader reader_; |
(...skipping 23 matching lines...) Expand all Loading... |
66 StreamChannelFactory* stream_channel_factory_; | 66 StreamChannelFactory* stream_channel_factory_; |
67 ErrorCallback error_callback_; | 67 ErrorCallback error_callback_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(StreamMessageChannelFactoryAdapter); | 69 DISALLOW_COPY_AND_ASSIGN(StreamMessageChannelFactoryAdapter); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace protocol | 72 } // namespace protocol |
73 } // namespace remoting | 73 } // namespace remoting |
74 | 74 |
75 #endif // REMOTING_PROTOCOL_STREAM_MESSAGE_PIPE_ADAPTER_H_ | 75 #endif // REMOTING_PROTOCOL_STREAM_MESSAGE_PIPE_ADAPTER_H_ |
OLD | NEW |