Re-land: C++ readability review
[chromium-blink-merge.git] / remoting / protocol / host_control_dispatcher.h
blob9e74889a22c0d6e1c3b776099833779b339c7fdc
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_CONTROL_DISPATCHER_H_
6 #define REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_
8 #include "remoting/protocol/channel_dispatcher_base.h"
9 #include "remoting/protocol/client_stub.h"
10 #include "remoting/protocol/clipboard_stub.h"
11 #include "remoting/protocol/cursor_shape_stub.h"
12 #include "remoting/protocol/protobuf_message_parser.h"
14 namespace net {
15 class StreamSocket;
16 } // namespace net
18 namespace remoting {
19 namespace protocol {
21 class ControlMessage;
22 class HostStub;
23 class PairingResponse;
24 class Session;
26 // HostControlDispatcher dispatches incoming messages on the control
27 // channel to HostStub or ClipboardStub, and also implements ClientStub and
28 // CursorShapeStub for outgoing messages.
29 class HostControlDispatcher : public ChannelDispatcherBase,
30 public ClientStub {
31 public:
32 HostControlDispatcher();
33 ~HostControlDispatcher() override;
35 // ClientStub implementation.
36 void SetCapabilities(const Capabilities& capabilities) override;
37 void SetPairingResponse(const PairingResponse& pairing_response) override;
38 void DeliverHostMessage(const ExtensionMessage& message) override;
40 // ClipboardStub implementation for sending clipboard data to client.
41 void InjectClipboardEvent(const ClipboardEvent& event) override;
43 // CursorShapeStub implementation for sending cursor shape to client.
44 void SetCursorShape(const CursorShapeInfo& cursor_shape) override;
46 // Sets the ClipboardStub that will be called for each incoming clipboard
47 // message. |clipboard_stub| must outlive this object.
48 void set_clipboard_stub(ClipboardStub* clipboard_stub) {
49 clipboard_stub_ = clipboard_stub;
52 // Sets the HostStub that will be called for each incoming control
53 // message. |host_stub| must outlive this object.
54 void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; }
56 private:
57 void OnMessageReceived(scoped_ptr<ControlMessage> message,
58 const base::Closure& done_task);
60 ClipboardStub* clipboard_stub_;
61 HostStub* host_stub_;
63 ProtobufMessageParser<ControlMessage> parser_;
65 DISALLOW_COPY_AND_ASSIGN(HostControlDispatcher);
68 } // namespace protocol
69 } // namespace remoting
71 #endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_