Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 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. | |
| 4 | |
| 5 #ifndef REMOTING_PROTOCOL_HOST_INPUT_DISPATCHER_H_ | |
| 6 #define REMOTING_PROTOCOL_HOST_INPUT_DISPATCHER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "remoting/protocol/message_reader.h" | |
| 10 | |
| 11 namespace remoting { | |
| 12 namespace protocol { | |
| 13 | |
| 14 class EventMessage; | |
| 15 class InputStub; | |
| 16 class Session; | |
| 17 | |
| 18 // A message dispatcher used to listen for messages received in | |
| 19 // protocol::Session. It dispatches messages to the corresponding | |
| 20 // handler. | |
| 21 class HostInputDispatcher { | |
| 22 public: | |
| 23 typedef base::Callback<void(int64)> SequenceNumberCallback; | |
| 24 | |
| 25 HostInputDispatcher(); | |
| 26 virtual ~HostInputDispatcher(); | |
| 27 | |
| 28 // Initialize the message dispatcher with the given connection and | |
| 29 // message handlers. | |
|
Wez
2011/11/17 02:03:40
How are they used, and who owns them, etc?
Sergey Ulanov
2011/11/17 18:38:14
Done.
| |
| 30 void Init(Session* session, | |
| 31 InputStub* input_stub, | |
| 32 const SequenceNumberCallback& seq_num_callback); | |
|
Wez
2011/11/17 02:03:40
Style guide says no abbreviated names. :(
Sergey Ulanov
2011/11/17 18:38:14
Done.
| |
| 33 | |
| 34 void Close(); | |
| 35 | |
| 36 private: | |
| 37 // This method is called by |reader_| when a message is received. | |
| 38 void OnMessageReceived(EventMessage* message, | |
| 39 const base::Closure& done_task); | |
| 40 | |
| 41 InputStub* input_stub_; | |
| 42 SequenceNumberCallback seq_num_callback_; | |
| 43 | |
| 44 ProtobufMessageReader<EventMessage> reader_; | |
| 45 | |
| 46 DISALLOW_COPY_AND_ASSIGN(HostInputDispatcher); | |
| 47 }; | |
| 48 | |
| 49 } // namespace protocol | |
| 50 } // namespace remoting | |
| 51 | |
| 52 #endif // REMOTING_PROTOCOL_HOST_INPUT_DISPATCHER_H_ | |
| OLD | NEW |