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

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: Refactor InputStub, ClipboardStub, and HostEventStub. 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"
(...skipping 10 matching lines...) Expand all
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::KeyEvent; 25 using protocol::KeyEvent;
26 using protocol::MouseEvent; 26 using protocol::MouseEvent;
27 27
28 ClientSession::ClientSession( 28 ClientSession::ClientSession(
29 EventHandler* event_handler, 29 EventHandler* event_handler,
30 protocol::ConnectionToClient* connection, 30 protocol::ConnectionToClient* connection,
31 protocol::ClipboardStub* clipboard_stub,
31 protocol::InputStub* input_stub, 32 protocol::InputStub* input_stub,
32 Capturer* capturer) 33 Capturer* capturer)
33 : event_handler_(event_handler), 34 : event_handler_(event_handler),
34 connection_(connection), 35 connection_(connection),
35 client_jid_(connection->session()->jid()), 36 client_jid_(connection->session()->jid()),
37 clipboard_stub_(clipboard_stub),
36 input_stub_(input_stub), 38 input_stub_(input_stub),
37 capturer_(capturer), 39 capturer_(capturer),
38 authenticated_(false), 40 authenticated_(false),
39 awaiting_continue_approval_(false), 41 awaiting_continue_approval_(false),
40 remote_mouse_button_state_(0) { 42 remote_mouse_button_state_(0) {
41 connection_->SetEventHandler(this); 43 connection_->SetEventHandler(this);
42 44
43 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be 45 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be
44 // set before channels are connected. Make it possible to set stubs 46 // set before channels are connected. Make it possible to set stubs
45 // later and set them only when connection is authenticated. 47 // later and set them only when connection is authenticated.
48 connection_->set_clipboard_stub(this);
46 connection_->set_host_stub(this); 49 connection_->set_host_stub(this);
47 connection_->set_input_stub(this); 50 connection_->set_input_stub(this);
48 } 51 }
49 52
50 ClientSession::~ClientSession() { 53 ClientSession::~ClientSession() {
51 } 54 }
52 55
56 void ClientSession::InjectClipboardEvent(
57 const protocol::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