Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: remoting/protocol/input_sender.h

Issue 8574025: Refactor client channel dispatchers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/host_control_sender.cc ('k') | remoting/protocol/input_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 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.
4
5 // Implementation of InputStub using sockets created from jingle connection.
6 // It sends messages through the socket after serializing it.
7 //
8 // Object of this class can only be created by ConnectionToHost.
9 //
10 // This class can be used on any thread. An object of socket is given to this
11 // class, its lifetime is strictly greater than this object.
12
13 #ifndef REMOTING_PROTOCOL_INPUT_SENDER_H_
14 #define REMOTING_PROTOCOL_INPUT_SENDER_H_
15
16 #include "base/basictypes.h"
17 #include "base/memory/ref_counted.h"
18 #include "remoting/protocol/input_stub.h"
19
20 class Task;
21
22 namespace base {
23 class MessageLoopProxy;
24 } // namespace base
25
26 namespace net {
27 class Socket;
28 } // namespace net
29
30 namespace remoting {
31 namespace protocol {
32
33 class BufferedSocketWriter;
34
35 // Implementation of InputStub that sends messages on a socket. Must
36 // be created and closed on the network thread, but can be used on any
37 // other thread.
38 class InputSender : public InputStub {
39 public:
40 // Create a stub using a socket.
41 explicit InputSender(base::MessageLoopProxy* message_loop,
42 net::Socket* socket);
43 virtual ~InputSender();
44
45 // InputStub implementation.
46 virtual void InjectKeyEvent(const KeyEvent& event);
47 virtual void InjectMouseEvent(const MouseEvent& event);
48
49 // Stop writing. Must be called on the network thread when the
50 // underlying socket is being destroyed.
51 void Close();
52
53 private:
54 // Helper method to run the task and delete it afterwards.
55 void RunTask(Task* done);
56
57 // Buffered socket writer holds the serialized message and sends it on the
58 // right thread.
59 scoped_refptr<BufferedSocketWriter> buffered_writer_;
60
61 DISALLOW_COPY_AND_ASSIGN(InputSender);
62 };
63
64 } // namespace protocol
65 } // namespace remoting
66
67 #endif // REMOTING_PROTOCOL_INPUT_SENDER_H_
OLDNEW
« no previous file with comments | « remoting/protocol/host_control_sender.cc ('k') | remoting/protocol/input_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698