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/control.pb.h" | 11 #include "remoting/proto/control.pb.h" |
12 #include "remoting/proto/event.pb.h" | 12 #include "remoting/proto/event.pb.h" |
13 #include "remoting/protocol/client_stub.h" | |
13 | 14 |
14 namespace remoting { | 15 namespace remoting { |
15 | 16 |
16 ClientSession::ClientSession( | 17 ClientSession::ClientSession( |
17 EventHandler* event_handler, | 18 EventHandler* event_handler, |
18 scoped_ptr<protocol::ConnectionToClient> connection, | 19 scoped_ptr<protocol::ConnectionToClient> connection, |
19 protocol::HostEventStub* host_event_stub, | 20 protocol::HostEventStub* host_event_stub, |
20 Capturer* capturer) | 21 Capturer* capturer) |
21 : event_handler_(event_handler), | 22 : event_handler_(event_handler), |
22 connection_(connection.Pass()), | 23 connection_(connection.Pass()), |
23 client_jid_(connection_->session()->jid()), | 24 client_jid_(connection_->session()->jid()), |
24 host_event_stub_(host_event_stub), | 25 host_event_stub_(host_event_stub), |
25 input_tracker_(host_event_stub_), | 26 input_tracker_(host_event_stub_), |
26 remote_input_filter_(&input_tracker_), | 27 remote_input_filter_(&input_tracker_), |
27 mouse_input_filter_(&remote_input_filter_), | 28 mouse_input_filter_(&remote_input_filter_), |
28 capturer_(capturer) { | 29 capturer_(capturer) { |
29 connection_->SetEventHandler(this); | 30 connection_->SetEventHandler(this); |
30 | 31 |
31 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be | 32 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be |
32 // set before channels are connected. Make it possible to set stubs | 33 // set before channels are connected. Make it possible to set stubs |
33 // later and set them only when connection is authenticated. | 34 // later and set them only when connection is authenticated. |
34 connection_->set_clipboard_stub(this); | 35 connection_->set_clipboard_stub(this); |
35 connection_->set_host_stub(this); | 36 connection_->set_host_stub(this); |
36 connection_->set_input_stub(this); | 37 connection_->set_input_stub(this); |
38 clipboard_duplicate_filter_.set_to_host(host_event_stub_); | |
39 clipboard_duplicate_filter_.set_to_client(connection_->client_stub()); | |
Wez
2012/05/16 20:51:43
Is client_stub() actually valid at this point, or
simonmorris
2012/05/16 22:35:25
I've moved this line to OnConnectionAuthenticated(
| |
37 } | 40 } |
38 | 41 |
39 ClientSession::~ClientSession() { | 42 ClientSession::~ClientSession() { |
40 } | 43 } |
41 | 44 |
42 void ClientSession::InjectClipboardEvent( | 45 void ClientSession::InjectClipboardEvent( |
43 const protocol::ClipboardEvent& event) { | 46 const protocol::ClipboardEvent& event) { |
44 DCHECK(CalledOnValidThread()); | 47 DCHECK(CalledOnValidThread()); |
45 | 48 |
46 // TODO(wez): Disable clipboard in both directions on local activity, and | 49 // TODO(wez): Disable clipboard in both directions on local activity, and |
47 // replace these tests with a HostInputFilter (or ClipboardFilter). | 50 // replace these tests with a HostInputFilter (or ClipboardFilter). |
48 if (auth_input_filter_.input_stub() == NULL) | 51 if (auth_input_filter_.input_stub() == NULL) |
49 return; | 52 return; |
50 if (disable_input_filter_.input_stub() == NULL) | 53 if (disable_input_filter_.input_stub() == NULL) |
51 return; | 54 return; |
52 | 55 |
53 host_event_stub_->InjectClipboardEvent(event); | 56 clipboard_duplicate_filter_.get_filter_to_host()->InjectClipboardEvent(event); |
54 } | 57 } |
55 | 58 |
56 void ClientSession::InjectKeyEvent(const protocol::KeyEvent& event) { | 59 void ClientSession::InjectKeyEvent(const protocol::KeyEvent& event) { |
57 DCHECK(CalledOnValidThread()); | 60 DCHECK(CalledOnValidThread()); |
58 auth_input_filter_.InjectKeyEvent(event); | 61 auth_input_filter_.InjectKeyEvent(event); |
59 } | 62 } |
60 | 63 |
61 void ClientSession::InjectMouseEvent(const protocol::MouseEvent& event) { | 64 void ClientSession::InjectMouseEvent(const protocol::MouseEvent& event) { |
62 DCHECK(CalledOnValidThread()); | 65 DCHECK(CalledOnValidThread()); |
63 | 66 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 | 156 |
154 if (disable_inputs) { | 157 if (disable_inputs) { |
155 disable_input_filter_.set_input_stub(NULL); | 158 disable_input_filter_.set_input_stub(NULL); |
156 input_tracker_.ReleaseAll(); | 159 input_tracker_.ReleaseAll(); |
157 } else { | 160 } else { |
158 disable_input_filter_.set_input_stub(&mouse_input_filter_); | 161 disable_input_filter_.set_input_stub(&mouse_input_filter_); |
159 } | 162 } |
160 } | 163 } |
161 | 164 |
162 } // namespace remoting | 165 } // namespace remoting |
OLD | NEW |