| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_MESSAGE_READER_H_ | 5 #ifndef REMOTING_PROTOCOL_MESSAGE_READER_H_ |
| 6 #define REMOTING_PROTOCOL_MESSAGE_READER_H_ | 6 #define REMOTING_PROTOCOL_MESSAGE_READER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "base/task.h" | 11 #include "base/task.h" |
| 12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
| 13 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 14 #include "remoting/protocol/message_decoder.h" | 14 #include "remoting/protocol/message_decoder.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 class Socket; | 17 class Socket; |
| 18 } // namespace net | 18 } // namespace net |
| 19 | 19 |
| 20 namespace remoting { | 20 namespace remoting { |
| 21 namespace protocol { |
| 21 | 22 |
| 22 class ChromotocolConnection; | |
| 23 class MessageReader; | 23 class MessageReader; |
| 24 | 24 |
| 25 namespace internal { | 25 namespace internal { |
| 26 | 26 |
| 27 template <class T> | 27 template <class T> |
| 28 class MessageReaderPrivate { | 28 class MessageReaderPrivate { |
| 29 private: | 29 private: |
| 30 friend class remoting::MessageReader; | 30 friend class remoting::protocol::MessageReader; |
| 31 | 31 |
| 32 typedef typename Callback1<T*>::Type MessageReceivedCallback; | 32 typedef typename Callback1<T*>::Type MessageReceivedCallback; |
| 33 | 33 |
| 34 MessageReaderPrivate(MessageReceivedCallback* callback) | 34 MessageReaderPrivate(MessageReceivedCallback* callback) |
| 35 : message_received_callback_(callback) { | 35 : message_received_callback_(callback) { |
| 36 } | 36 } |
| 37 | 37 |
| 38 ~MessageReaderPrivate() { } | 38 ~MessageReaderPrivate() { } |
| 39 | 39 |
| 40 void OnDataReceived(net::IOBuffer* buffer, int data_size) { | 40 void OnDataReceived(net::IOBuffer* buffer, int data_size) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 net::Socket* socket_; | 95 net::Socket* socket_; |
| 96 | 96 |
| 97 bool closed_; | 97 bool closed_; |
| 98 scoped_refptr<net::IOBuffer> read_buffer_; | 98 scoped_refptr<net::IOBuffer> read_buffer_; |
| 99 net::CompletionCallbackImpl<MessageReader> read_callback_; | 99 net::CompletionCallbackImpl<MessageReader> read_callback_; |
| 100 | 100 |
| 101 scoped_ptr<Callback2<net::IOBuffer*, int>::Type> data_received_callback_; | 101 scoped_ptr<Callback2<net::IOBuffer*, int>::Type> data_received_callback_; |
| 102 scoped_ptr<Callback0::Type> destruction_callback_; | 102 scoped_ptr<Callback0::Type> destruction_callback_; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } // namespace protocol |
| 105 } // namespace remoting | 106 } // namespace remoting |
| 106 | 107 |
| 107 #endif // REMOTING_PROTOCOL_MESSAGE_READER_H_ | 108 #endif // REMOTING_PROTOCOL_MESSAGE_READER_H_ |
| OLD | NEW |