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/video_frame_capturer.h" | 10 #include "remoting/host/video_frame_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 #include "remoting/protocol/client_stub.h" |
14 #include "remoting/protocol/clipboard_thread_proxy.h" | 14 #include "remoting/protocol/clipboard_thread_proxy.h" |
15 | 15 |
16 namespace remoting { | 16 namespace remoting { |
17 | 17 |
18 ClientSession::ClientSession( | 18 ClientSession::ClientSession( |
19 EventHandler* event_handler, | 19 EventHandler* event_handler, |
20 scoped_ptr<protocol::ConnectionToClient> connection, | 20 scoped_ptr<protocol::ConnectionToClient> connection, |
21 protocol::HostEventStub* host_event_stub, | 21 protocol::ClipboardStub* host_clipboard_stub, |
| 22 protocol::InputStub* host_input_stub, |
22 VideoFrameCapturer* capturer, | 23 VideoFrameCapturer* capturer, |
23 const base::TimeDelta& max_duration) | 24 const base::TimeDelta& max_duration) |
24 : event_handler_(event_handler), | 25 : event_handler_(event_handler), |
25 connection_(connection.Pass()), | 26 connection_(connection.Pass()), |
26 client_jid_(connection_->session()->jid()), | 27 client_jid_(connection_->session()->jid()), |
27 is_authenticated_(false), | 28 is_authenticated_(false), |
28 host_event_stub_(host_event_stub), | 29 host_clipboard_stub_(host_clipboard_stub), |
29 input_tracker_(host_event_stub_), | 30 host_input_stub_(host_input_stub), |
| 31 input_tracker_(host_input_stub_), |
30 remote_input_filter_(&input_tracker_), | 32 remote_input_filter_(&input_tracker_), |
31 mouse_input_filter_(&remote_input_filter_), | 33 mouse_input_filter_(&remote_input_filter_), |
32 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), | 34 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), |
33 capturer_(capturer), | 35 capturer_(capturer), |
34 max_duration_(max_duration) { | 36 max_duration_(max_duration) { |
35 connection_->SetEventHandler(this); | 37 connection_->SetEventHandler(this); |
36 | 38 |
37 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be | 39 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be |
38 // set before channels are connected. Make it possible to set stubs | 40 // set before channels are connected. Make it possible to set stubs |
39 // later and set them only when connection is authenticated. | 41 // later and set them only when connection is authenticated. |
40 connection_->set_clipboard_stub(this); | 42 connection_->set_clipboard_stub(this); |
41 connection_->set_host_stub(this); | 43 connection_->set_host_stub(this); |
42 connection_->set_input_stub(this); | 44 connection_->set_input_stub(this); |
43 clipboard_echo_filter_.set_host_stub(host_event_stub_); | 45 clipboard_echo_filter_.set_host_stub(host_clipboard_stub_); |
44 } | 46 } |
45 | 47 |
46 ClientSession::~ClientSession() { | 48 ClientSession::~ClientSession() { |
47 } | 49 } |
48 | 50 |
49 void ClientSession::InjectClipboardEvent( | 51 void ClientSession::InjectClipboardEvent( |
50 const protocol::ClipboardEvent& event) { | 52 const protocol::ClipboardEvent& event) { |
51 DCHECK(CalledOnValidThread()); | 53 DCHECK(CalledOnValidThread()); |
52 | 54 |
53 // TODO(wez): Disable clipboard in both directions on local activity, and | 55 // TODO(wez): Disable clipboard in both directions on local activity, and |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { | 180 scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { |
179 DCHECK(CalledOnValidThread()); | 181 DCHECK(CalledOnValidThread()); |
180 | 182 |
181 return scoped_ptr<protocol::ClipboardStub>( | 183 return scoped_ptr<protocol::ClipboardStub>( |
182 new protocol::ClipboardThreadProxy( | 184 new protocol::ClipboardThreadProxy( |
183 client_clipboard_factory_.GetWeakPtr(), | 185 client_clipboard_factory_.GetWeakPtr(), |
184 base::MessageLoopProxy::current())); | 186 base::MessageLoopProxy::current())); |
185 } | 187 } |
186 | 188 |
187 } // namespace remoting | 189 } // namespace remoting |
OLD | NEW |