Introduced IDR_SIGNIN_INTERNALS_INDEX_* strings to grit_whitelist.txt
[chromium-blink-merge.git] / remoting / protocol / client_control_dispatcher.h
blob556ce72190d2444143546b2520cfe3f5a4f1fe8c
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/buffered_socket_writer.h"
10 #include "remoting/protocol/channel_dispatcher_base.h"
11 #include "remoting/protocol/clipboard_stub.h"
12 #include "remoting/protocol/cursor_shape_stub.h"
13 #include "remoting/protocol/host_stub.h"
14 #include "remoting/protocol/message_reader.h"
16 namespace remoting {
17 namespace protocol {
19 class ClientStub;
20 class ControlMessage;
21 class Session;
23 // ClientControlDispatcher dispatches incoming messages on the control
24 // channel to ClientStub, ClipboardStub or CursorShapeStub.
25 // It also implements ClipboardStub and HostStub for outgoing messages.
26 class ClientControlDispatcher : public ChannelDispatcherBase,
27 public ClipboardStub,
28 public HostStub {
29 public:
30 ClientControlDispatcher();
31 virtual ~ClientControlDispatcher();
33 // ClipboardStub implementation.
34 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE;
36 // HostStub implementation.
37 virtual void NotifyClientResolution(
38 const ClientResolution& resolution) OVERRIDE;
39 virtual void ControlVideo(const VideoControl& video_control) OVERRIDE;
40 virtual void ControlAudio(const AudioControl& audio_control) OVERRIDE;
41 virtual void SetCapabilities(const Capabilities& capabilities) OVERRIDE;
42 virtual void RequestPairing(const PairingRequest& pairing_request) OVERRIDE;
43 virtual void DeliverClientMessage(const ExtensionMessage& message) OVERRIDE;
45 // Sets the ClientStub that will be called for each incoming control
46 // message. |client_stub| must outlive this object.
47 void set_client_stub(ClientStub* client_stub) { client_stub_ = client_stub; }
49 // Sets the ClipboardStub that will be called for each incoming clipboard
50 // message. |clipboard_stub| must outlive this object.
51 void set_clipboard_stub(ClipboardStub* clipboard_stub) {
52 clipboard_stub_ = clipboard_stub;
55 protected:
56 // ChannelDispatcherBase overrides.
57 virtual void OnInitialized() OVERRIDE;
59 private:
60 void OnMessageReceived(scoped_ptr<ControlMessage> message,
61 const base::Closure& done_task);
63 ClientStub* client_stub_;
64 ClipboardStub* clipboard_stub_;
66 ProtobufMessageReader<ControlMessage> reader_;
67 BufferedSocketWriter writer_;
69 DISALLOW_COPY_AND_ASSIGN(ClientControlDispatcher);
72 } // namespace protocol
73 } // namespace remoting
75 #endif // REMOTING_PROTOCOL_CLIENT_CONTROL_DISPATCHER_H_