MD Downloads: prevent search text from overlapping with the cancel search (X)
[chromium-blink-merge.git] / remoting / protocol / client_control_dispatcher.h
blob176a20da4b9fdbcff5187a15676dd4e0dd0bfeec
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_CLIENT_CONTROL_DISPATCHER_H_
6 #define REMOTING_PROTOCOL_CLIENT_CONTROL_DISPATCHER_H_
8 #include "base/memory/ref_counted.h"
9 #include "remoting/protocol/channel_dispatcher_base.h"
10 #include "remoting/protocol/clipboard_stub.h"
11 #include "remoting/protocol/cursor_shape_stub.h"
12 #include "remoting/protocol/host_stub.h"
13 #include "remoting/protocol/protobuf_message_parser.h"
15 namespace remoting {
16 namespace protocol {
18 class ClientStub;
19 class ControlMessage;
20 class Session;
22 // ClientControlDispatcher dispatches incoming messages on the control
23 // channel to ClientStub, ClipboardStub or CursorShapeStub.
24 // It also implements ClipboardStub and HostStub for outgoing messages.
25 class ClientControlDispatcher : public ChannelDispatcherBase,
26 public ClipboardStub,
27 public HostStub {
28 public:
29 ClientControlDispatcher();
30 ~ClientControlDispatcher() override;
32 // ClipboardStub implementation.
33 void InjectClipboardEvent(const ClipboardEvent& event) override;
35 // HostStub implementation.
36 void NotifyClientResolution(const ClientResolution& resolution) override;
37 void ControlVideo(const VideoControl& video_control) override;
38 void ControlAudio(const AudioControl& audio_control) override;
39 void SetCapabilities(const Capabilities& capabilities) override;
40 void RequestPairing(const PairingRequest& pairing_request) override;
41 void DeliverClientMessage(const ExtensionMessage& message) override;
43 // Sets the ClientStub that will be called for each incoming control
44 // message. |client_stub| must outlive this object.
45 void set_client_stub(ClientStub* client_stub) { client_stub_ = client_stub; }
47 // Sets the ClipboardStub that will be called for each incoming clipboard
48 // message. |clipboard_stub| must outlive this object.
49 void set_clipboard_stub(ClipboardStub* clipboard_stub) {
50 clipboard_stub_ = clipboard_stub;
53 private:
54 void OnMessageReceived(scoped_ptr<ControlMessage> message,
55 const base::Closure& done_task);
57 ClientStub* client_stub_;
58 ClipboardStub* clipboard_stub_;
60 ProtobufMessageParser<ControlMessage> parser_;
62 DISALLOW_COPY_AND_ASSIGN(ClientControlDispatcher);
65 } // namespace protocol
66 } // namespace remoting
68 #endif // REMOTING_PROTOCOL_CLIENT_CONTROL_DISPATCHER_H_