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

Side by Side Diff: remoting/host/client_session.cc

Issue 9646013: Add the plumbing that will carry a clipboard item from a chromoting client to a host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move clipboard events to the control channel. Created 8 years, 9 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/client_session.h" 5 #include "remoting/host/client_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "remoting/host/capturer.h" 10 #include "remoting/host/capturer.h"
11 #include "remoting/proto/event.pb.h" 11 #include "remoting/proto/event.pb.h"
12 12
13 // The number of remote mouse events to record for the purpose of eliminating 13 // The number of remote mouse events to record for the purpose of eliminating
14 // "echoes" detected by the local input detector. The value should be large 14 // "echoes" detected by the local input detector. The value should be large
15 // enough to cope with the fact that multiple events might be injected before 15 // enough to cope with the fact that multiple events might be injected before
16 // any echoes are detected. 16 // any echoes are detected.
17 static const unsigned int kNumRemoteMousePositions = 50; 17 static const unsigned int kNumRemoteMousePositions = 50;
18 18
19 // The number of milliseconds for which to block remote input when local input 19 // The number of milliseconds for which to block remote input when local input
20 // is received. 20 // is received.
21 static const int64 kRemoteBlockTimeoutMillis = 2000; 21 static const int64 kRemoteBlockTimeoutMillis = 2000;
22 22
23 namespace remoting { 23 namespace remoting {
24 24
25 using protocol::ClipboardEvent;
Sergey Ulanov 2012/03/14 20:27:07 There is only one place when this is used, so mayb
simonmorris 2012/03/14 21:20:21 Done.
25 using protocol::KeyEvent; 26 using protocol::KeyEvent;
26 using protocol::MouseEvent; 27 using protocol::MouseEvent;
27 28
28 ClientSession::ClientSession( 29 ClientSession::ClientSession(
29 EventHandler* event_handler, 30 EventHandler* event_handler,
30 protocol::ConnectionToClient* connection, 31 protocol::ConnectionToClient* connection,
32 protocol::ClipboardStub* clipboard_stub,
31 protocol::InputStub* input_stub, 33 protocol::InputStub* input_stub,
32 Capturer* capturer) 34 Capturer* capturer)
33 : event_handler_(event_handler), 35 : event_handler_(event_handler),
34 connection_(connection), 36 connection_(connection),
35 client_jid_(connection->session()->jid()), 37 client_jid_(connection->session()->jid()),
38 clipboard_stub_(clipboard_stub),
36 input_stub_(input_stub), 39 input_stub_(input_stub),
37 capturer_(capturer), 40 capturer_(capturer),
38 authenticated_(false), 41 authenticated_(false),
39 awaiting_continue_approval_(false), 42 awaiting_continue_approval_(false),
40 remote_mouse_button_state_(0) { 43 remote_mouse_button_state_(0) {
41 connection_->SetEventHandler(this); 44 connection_->SetEventHandler(this);
42 45
43 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be 46 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be
44 // set before channels are connected. Make it possible to set stubs 47 // set before channels are connected. Make it possible to set stubs
45 // later and set them only when connection is authenticated. 48 // later and set them only when connection is authenticated.
49 connection_->set_clipboard_stub(this);
46 connection_->set_host_stub(this); 50 connection_->set_host_stub(this);
47 connection_->set_input_stub(this); 51 connection_->set_input_stub(this);
48 } 52 }
49 53
50 ClientSession::~ClientSession() { 54 ClientSession::~ClientSession() {
51 } 55 }
52 56
57 void ClientSession::InjectClipboardEvent(const ClipboardEvent& event) {
58 DCHECK(CalledOnValidThread());
59
60 if (authenticated_) {
61 clipboard_stub_->InjectClipboardEvent(event);
62 }
63 }
64
53 void ClientSession::InjectKeyEvent(const KeyEvent& event) { 65 void ClientSession::InjectKeyEvent(const KeyEvent& event) {
54 DCHECK(CalledOnValidThread()); 66 DCHECK(CalledOnValidThread());
55 67
56 if (authenticated_ && !ShouldIgnoreRemoteKeyboardInput(event)) { 68 if (authenticated_ && !ShouldIgnoreRemoteKeyboardInput(event)) {
57 RecordKeyEvent(event); 69 RecordKeyEvent(event);
58 input_stub_->InjectKeyEvent(event); 70 input_stub_->InjectKeyEvent(event);
59 } 71 }
60 } 72 }
61 73
62 void ClientSession::InjectMouseEvent(const MouseEvent& event) { 74 void ClientSession::InjectMouseEvent(const MouseEvent& event) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 mouse.set_y(remote_mouse_pos_.y()); 267 mouse.set_y(remote_mouse_pos_.y());
256 mouse.set_button((MouseEvent::MouseButton)i); 268 mouse.set_button((MouseEvent::MouseButton)i);
257 mouse.set_button_down(false); 269 mouse.set_button_down(false);
258 input_stub_->InjectMouseEvent(mouse); 270 input_stub_->InjectMouseEvent(mouse);
259 } 271 }
260 } 272 }
261 remote_mouse_button_state_ = 0; 273 remote_mouse_button_state_ = 0;
262 } 274 }
263 275
264 } // namespace remoting 276 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698