OLD | NEW |
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::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 scoped_ptr<protocol::ConnectionToClient> connection, |
31 protocol::HostEventStub* host_event_stub, | 31 protocol::HostEventStub* host_event_stub, |
32 Capturer* capturer) | 32 Capturer* capturer) |
33 : event_handler_(event_handler), | 33 : event_handler_(event_handler), |
34 connection_(connection), | 34 connection_(connection.Pass()), |
35 client_jid_(connection->session()->jid()), | 35 client_jid_(connection_->session()->jid()), |
36 host_event_stub_(host_event_stub), | 36 host_event_stub_(host_event_stub), |
37 capturer_(capturer), | 37 capturer_(capturer), |
38 authenticated_(false), | 38 authenticated_(false), |
39 awaiting_continue_approval_(false), | 39 awaiting_continue_approval_(false), |
40 remote_mouse_button_state_(0) { | 40 remote_mouse_button_state_(0) { |
41 connection_->SetEventHandler(this); | 41 connection_->SetEventHandler(this); |
42 | 42 |
43 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be | 43 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be |
44 // set before channels are connected. Make it possible to set stubs | 44 // set before channels are connected. Make it possible to set stubs |
45 // later and set them only when connection is authenticated. | 45 // later and set them only when connection is authenticated. |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 mouse.set_y(remote_mouse_pos_.y()); | 265 mouse.set_y(remote_mouse_pos_.y()); |
266 mouse.set_button((MouseEvent::MouseButton)i); | 266 mouse.set_button((MouseEvent::MouseButton)i); |
267 mouse.set_button_down(false); | 267 mouse.set_button_down(false); |
268 host_event_stub_->InjectMouseEvent(mouse); | 268 host_event_stub_->InjectMouseEvent(mouse); |
269 } | 269 } |
270 } | 270 } |
271 remote_mouse_button_state_ = 0; | 271 remote_mouse_button_state_ = 0; |
272 } | 272 } |
273 | 273 |
274 } // namespace remoting | 274 } // namespace remoting |
OLD | NEW |