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 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 | 16 |
17 ClientSession::ClientSession( | 17 ClientSession::ClientSession( |
18 EventHandler* event_handler, | 18 EventHandler* event_handler, |
19 scoped_ptr<protocol::ConnectionToClient> connection, | 19 scoped_ptr<protocol::ConnectionToClient> connection, |
20 protocol::HostEventStub* host_event_stub, | 20 protocol::HostEventStub* host_event_stub, |
21 Capturer* capturer) | 21 Capturer* capturer) |
22 : event_handler_(event_handler), | 22 : event_handler_(event_handler), |
23 connection_(connection.Pass()), | 23 connection_(connection.Pass()), |
24 client_jid_(connection_->session()->jid()), | 24 client_jid_(connection_->session()->jid()), |
25 is_authenticated_(false), | 25 is_authenticated_(false), |
26 host_event_stub_(host_event_stub), | 26 host_event_stub_(host_event_stub), |
27 input_tracker_(host_event_stub_), | 27 input_tracker_(host_event_stub_), |
28 remote_input_filter_(&input_tracker_), | 28 remote_input_filter_(&input_tracker_), |
29 mouse_input_filter_(&remote_input_filter_), | 29 mouse_input_filter_(&remote_input_filter_), |
30 client_clipboard_(clipboard_echo_filter_.client_filter()), | |
30 capturer_(capturer) { | 31 capturer_(capturer) { |
31 connection_->SetEventHandler(this); | 32 connection_->SetEventHandler(this); |
32 | 33 |
33 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be | 34 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be |
34 // set before channels are connected. Make it possible to set stubs | 35 // set before channels are connected. Make it possible to set stubs |
35 // later and set them only when connection is authenticated. | 36 // later and set them only when connection is authenticated. |
36 connection_->set_clipboard_stub(this); | 37 connection_->set_clipboard_stub(this); |
37 connection_->set_host_stub(this); | 38 connection_->set_host_stub(this); |
38 connection_->set_input_stub(this); | 39 connection_->set_input_stub(this); |
39 clipboard_echo_filter_.set_host_stub(host_event_stub_); | 40 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()); | 158 DCHECK(CalledOnValidThread()); |
158 | 159 |
159 if (disable_inputs) { | 160 if (disable_inputs) { |
160 disable_input_filter_.set_input_stub(NULL); | 161 disable_input_filter_.set_input_stub(NULL); |
161 input_tracker_.ReleaseAll(); | 162 input_tracker_.ReleaseAll(); |
162 } else { | 163 } else { |
163 disable_input_filter_.set_input_stub(&mouse_input_filter_); | 164 disable_input_filter_.set_input_stub(&mouse_input_filter_); |
164 } | 165 } |
165 } | 166 } |
166 | 167 |
168 scoped_refptr<protocol::ClipboardProxy> ClientSession::ClientClipboard() { | |
169 DCHECK(CalledOnValidThread()); | |
170 | |
171 scoped_refptr<protocol::ClipboardProxy> client_clipboard = | |
172 new protocol::ClipboardProxy(base::MessageLoopProxy::current()); | |
173 client_clipboard->Attach(client_clipboard_.AsWeakPtr()); | |
174 return client_clipboard; | |
Wez
2012/05/30 01:15:43
Since you're creating a new ClipboardProxy every t
simonmorris
2012/05/30 16:54:06
I want ClipboardThreadProxy to be refcounted so th
Wez
2012/05/30 17:07:47
You can do that if instead of storing a WeakPtr to
simonmorris
2012/05/30 23:18:26
As discussed offline, ClipboardThreadProxy does ne
| |
175 } | |
176 | |
167 } // namespace remoting | 177 } // namespace remoting |
OLD | NEW |