Chromium Code Reviews| Index: remoting/protocol/client_message_dispatcher.h |
| diff --git a/remoting/protocol/client_message_dispatcher.h b/remoting/protocol/client_message_dispatcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d9dde69f8b8f2b11938311853da01d94ca352fae |
| --- /dev/null |
| +++ b/remoting/protocol/client_message_dispatcher.h |
| @@ -0,0 +1,63 @@ |
| +// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef REMOTING_PROTOCOL_CLIENT_MESSAGE_DISPATCHER_H_ |
| +#define REMOTING_PROTOCOL_CLIENT_MESSAGE_DISPATCHER_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/scoped_ptr.h" |
| +#include "base/task.h" |
| + |
| +namespace remoting { |
| + |
| +class EventMessage; |
| + |
| +namespace protocol { |
| + |
| +class ControlMessage; |
| +class ClientStub; |
| +class MessageReader; |
|
awong
2010/12/23 01:15:10
sort
Alpha Left Google
2010/12/23 02:17:58
Done.
|
| +class InputStub; |
| +class Session; |
| + |
| +// A message dispatcher used to listen for messages received in |
| +// protocol::Session. It dispatches messages to the corresponding |
| +// handler. |
| +// |
| +// Internally it contains an EventStreamReader that decodes data on |
| +// communications channels into protocol buffer messages. |
| +// EventStreamReader is registered with protocol::Session given to it. |
| +// |
| +// Object of this class is owned by ConnectionToHost to dispatch messages |
|
awong
2010/12/23 01:15:10
Drop the "to dispatch messages to itself."
This d
Alpha Left Google
2010/12/23 02:17:58
Done.
|
| +// to itself. |
| +class ClientMessageDispatcher { |
| + public: |
| + // Construct a message dispatcher. |
| + ClientMessageDispatcher(); |
| + virtual ~ClientMessageDispatcher(); |
| + |
| + // Initialize the message dispatcher with the given connection and |
| + // message handlers. |
| + // Return true if initalization was successful. |
| + bool Initialize(protocol::Session* session, ClientStub* client_stub); |
| + |
| + private: |
| + // This method is called by |control_channel_reader_| when a control |
|
awong
2010/12/23 01:15:10
This comment says exactly what the function name s
Alpha Left Google
2010/12/23 02:17:58
Done.
|
| + // message is received. |
| + void OnControlMessageReceived(ControlMessage* message); |
| + |
| + // MessageReader that runs on the control channel. It runs a loop |
| + // that parses data on the channel and then delegates the message to this |
|
awong
2010/12/23 01:15:10
"then delegates the message to this class" -> "the
Alpha Left Google
2010/12/23 02:17:58
Done.
|
| + // class. |
| + scoped_ptr<MessageReader> control_message_reader_; |
| + |
| + // Stubs for client and input. These objects are not owned. |
| + // They are called on the thread there data is received, i.e. jingle thread. |
| + ClientStub* client_stub_; |
|
awong
2010/12/23 01:15:10
DISALLOW_COPY_AND_ASSIGN?
Alpha Left Google
2010/12/23 02:17:58
Done.
|
| +}; |
| + |
| +} // namespace protocol |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_PROTOCOL_CLIENT_MESSAGE_DISPATCHER_H_ |