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

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

Issue 10829409: Add MouseClampingFilter and update ClientSession to use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/video_frame_capturer.h" 10 #include "remoting/host/video_frame_capturer.h"
(...skipping 12 matching lines...) Expand all
23 VideoFrameCapturer* capturer, 23 VideoFrameCapturer* capturer,
24 const base::TimeDelta& max_duration) 24 const base::TimeDelta& max_duration)
25 : event_handler_(event_handler), 25 : event_handler_(event_handler),
26 connection_(connection.Pass()), 26 connection_(connection.Pass()),
27 client_jid_(connection_->session()->jid()), 27 client_jid_(connection_->session()->jid()),
28 is_authenticated_(false), 28 is_authenticated_(false),
29 host_clipboard_stub_(host_clipboard_stub), 29 host_clipboard_stub_(host_clipboard_stub),
30 host_input_stub_(host_input_stub), 30 host_input_stub_(host_input_stub),
31 input_tracker_(host_input_stub_), 31 input_tracker_(host_input_stub_),
32 remote_input_filter_(&input_tracker_), 32 remote_input_filter_(&input_tracker_),
33 mouse_input_filter_(&remote_input_filter_), 33 mouse_clamping_filter_(capturer, &remote_input_filter_),
34 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), 34 client_clipboard_factory_(clipboard_echo_filter_.client_filter()),
35 capturer_(capturer), 35 capturer_(capturer),
36 max_duration_(max_duration) { 36 max_duration_(max_duration) {
37 connection_->SetEventHandler(this); 37 connection_->SetEventHandler(this);
38 38
39 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be 39 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be
40 // set before channels are connected. Make it possible to set stubs 40 // set before channels are connected. Make it possible to set stubs
41 // later and set them only when connection is authenticated. 41 // later and set them only when connection is authenticated.
42 connection_->set_clipboard_stub(&auth_clipboard_filter_); 42 connection_->set_clipboard_stub(&auth_clipboard_filter_);
43 connection_->set_host_stub(this); 43 connection_->set_host_stub(this);
44 connection_->set_input_stub(this); 44 connection_->set_input_stub(&auth_input_filter_);
45 clipboard_echo_filter_.set_host_stub(host_clipboard_stub_); 45 clipboard_echo_filter_.set_host_stub(host_clipboard_stub_);
46 } 46 }
47 47
48 ClientSession::~ClientSession() { 48 ClientSession::~ClientSession() {
49 } 49 }
50 50
51 void ClientSession::InjectKeyEvent(const protocol::KeyEvent& event) {
52 DCHECK(CalledOnValidThread());
53 auth_input_filter_.InjectKeyEvent(event);
54 }
55
56 void ClientSession::InjectMouseEvent(const protocol::MouseEvent& event) {
57 DCHECK(CalledOnValidThread());
58
59 // Ensure that the MouseInputFilter is clamping to the current dimensions.
60 mouse_input_filter_.set_output_size(capturer_->size_most_recent());
61 mouse_input_filter_.set_input_size(capturer_->size_most_recent());
62
63 auth_input_filter_.InjectMouseEvent(event);
64 }
65
66 void ClientSession::NotifyClientDimensions( 51 void ClientSession::NotifyClientDimensions(
67 const protocol::ClientDimensions& dimensions) { 52 const protocol::ClientDimensions& dimensions) {
68 // TODO(wez): Use the dimensions, e.g. to resize the host desktop to match. 53 // TODO(wez): Use the dimensions, e.g. to resize the host desktop to match.
69 if (dimensions.has_width() && dimensions.has_height()) { 54 if (dimensions.has_width() && dimensions.has_height()) {
70 VLOG(1) << "Received ClientDimensions (width=" 55 VLOG(1) << "Received ClientDimensions (width="
71 << dimensions.width() << ", height=" << dimensions.height() << ")"; 56 << dimensions.width() << ", height=" << dimensions.height() << ")";
72 } 57 }
73 } 58 }
74 59
75 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { 60 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 144 }
160 145
161 void ClientSession::SetDisableInputs(bool disable_inputs) { 146 void ClientSession::SetDisableInputs(bool disable_inputs) {
162 DCHECK(CalledOnValidThread()); 147 DCHECK(CalledOnValidThread());
163 148
164 if (disable_inputs) { 149 if (disable_inputs) {
165 disable_input_filter_.set_input_stub(NULL); 150 disable_input_filter_.set_input_stub(NULL);
166 disable_clipboard_filter_.set_clipboard_stub(NULL); 151 disable_clipboard_filter_.set_clipboard_stub(NULL);
167 input_tracker_.ReleaseAll(); 152 input_tracker_.ReleaseAll();
168 } else { 153 } else {
169 disable_input_filter_.set_input_stub(&mouse_input_filter_); 154 disable_input_filter_.set_input_stub(&mouse_clamping_filter_);
170 disable_clipboard_filter_.set_clipboard_stub( 155 disable_clipboard_filter_.set_clipboard_stub(
171 clipboard_echo_filter_.host_filter()); 156 clipboard_echo_filter_.host_filter());
172 } 157 }
173 } 158 }
174 159
175 scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { 160 scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() {
176 DCHECK(CalledOnValidThread()); 161 DCHECK(CalledOnValidThread());
177 162
178 return scoped_ptr<protocol::ClipboardStub>( 163 return scoped_ptr<protocol::ClipboardStub>(
179 new protocol::ClipboardThreadProxy( 164 new protocol::ClipboardThreadProxy(
180 client_clipboard_factory_.GetWeakPtr(), 165 client_clipboard_factory_.GetWeakPtr(),
181 base::MessageLoopProxy::current())); 166 base::MessageLoopProxy::current()));
182 } 167 }
183 168
184 } // namespace remoting 169 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698