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
3 // found in the LICENSE file.
5 #ifndef REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_
6 #define REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_
8 #include "remoting/protocol/channel_dispatcher_base.h"
9 #include "remoting/protocol/protobuf_message_parser.h"
17 // HostEventDispatcher dispatches incoming messages on the event
18 // channel to InputStub.
19 class HostEventDispatcher
: public ChannelDispatcherBase
{
21 typedef base::Callback
<void(int64
)> EventTimestampCallback
;
23 HostEventDispatcher();
24 ~HostEventDispatcher() override
;
26 // Set InputStub that will be called for each incoming input
27 // message. Doesn't take ownership of |input_stub|. It must outlive
29 void set_input_stub(InputStub
* input_stub
) { input_stub_
= input_stub
; }
31 // Set callback to notify of each message's sequence number. The
32 // callback cannot tear down this object.
33 void set_event_timestamp_callback(const EventTimestampCallback
& value
) {
34 event_timestamp_callback_
= value
;
38 void OnMessageReceived(scoped_ptr
<EventMessage
> message
,
39 const base::Closure
& done_task
);
41 InputStub
* input_stub_
;
42 EventTimestampCallback event_timestamp_callback_
;
44 ProtobufMessageParser
<EventMessage
> parser_
;
46 DISALLOW_COPY_AND_ASSIGN(HostEventDispatcher
);
49 } // namespace protocol
50 } // namespace remoting
52 #endif // REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_