| 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 #include "remoting/protocol/client_stub.h" |
| 14 #include "remoting/protocol/clipboard_thread_proxy.h" |
| 14 | 15 |
| 15 namespace remoting { | 16 namespace remoting { |
| 16 | 17 |
| 17 ClientSession::ClientSession( | 18 ClientSession::ClientSession( |
| 18 EventHandler* event_handler, | 19 EventHandler* event_handler, |
| 19 scoped_ptr<protocol::ConnectionToClient> connection, | 20 scoped_ptr<protocol::ConnectionToClient> connection, |
| 20 protocol::HostEventStub* host_event_stub, | 21 protocol::HostEventStub* host_event_stub, |
| 21 Capturer* capturer) | 22 Capturer* capturer) |
| 22 : event_handler_(event_handler), | 23 : event_handler_(event_handler), |
| 23 connection_(connection.Pass()), | 24 connection_(connection.Pass()), |
| 24 client_jid_(connection_->session()->jid()), | 25 client_jid_(connection_->session()->jid()), |
| 25 is_authenticated_(false), | 26 is_authenticated_(false), |
| 26 host_event_stub_(host_event_stub), | 27 host_event_stub_(host_event_stub), |
| 27 input_tracker_(host_event_stub_), | 28 input_tracker_(host_event_stub_), |
| 28 remote_input_filter_(&input_tracker_), | 29 remote_input_filter_(&input_tracker_), |
| 29 mouse_input_filter_(&remote_input_filter_), | 30 mouse_input_filter_(&remote_input_filter_), |
| 31 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), |
| 30 capturer_(capturer) { | 32 capturer_(capturer) { |
| 31 connection_->SetEventHandler(this); | 33 connection_->SetEventHandler(this); |
| 32 | 34 |
| 33 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be | 35 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be |
| 34 // set before channels are connected. Make it possible to set stubs | 36 // set before channels are connected. Make it possible to set stubs |
| 35 // later and set them only when connection is authenticated. | 37 // later and set them only when connection is authenticated. |
| 36 connection_->set_clipboard_stub(this); | 38 connection_->set_clipboard_stub(this); |
| 37 connection_->set_host_stub(this); | 39 connection_->set_host_stub(this); |
| 38 connection_->set_input_stub(this); | 40 connection_->set_input_stub(this); |
| 39 clipboard_echo_filter_.set_host_stub(host_event_stub_); | 41 clipboard_echo_filter_.set_host_stub(host_event_stub_); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 DCHECK(CalledOnValidThread()); | 159 DCHECK(CalledOnValidThread()); |
| 158 | 160 |
| 159 if (disable_inputs) { | 161 if (disable_inputs) { |
| 160 disable_input_filter_.set_input_stub(NULL); | 162 disable_input_filter_.set_input_stub(NULL); |
| 161 input_tracker_.ReleaseAll(); | 163 input_tracker_.ReleaseAll(); |
| 162 } else { | 164 } else { |
| 163 disable_input_filter_.set_input_stub(&mouse_input_filter_); | 165 disable_input_filter_.set_input_stub(&mouse_input_filter_); |
| 164 } | 166 } |
| 165 } | 167 } |
| 166 | 168 |
| 169 scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { |
| 170 DCHECK(CalledOnValidThread()); |
| 171 |
| 172 return scoped_ptr<protocol::ClipboardStub>( |
| 173 new protocol::ClipboardThreadProxy( |
| 174 client_clipboard_factory_.GetWeakPtr(), |
| 175 base::MessageLoopProxy::current())); |
| 176 } |
| 177 |
| 167 } // namespace remoting | 178 } // namespace remoting |
| OLD | NEW |