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/win/session_input_injector.h" | 5 #include "remoting/host/win/session_input_injector.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
| 11 #include <utility> |
11 | 12 |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "base/callback.h" | 14 #include "base/callback.h" |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/location.h" | 16 #include "base/location.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
18 #include "base/win/windows_version.h" | 19 #include "base/win/windows_version.h" |
19 #include "remoting/host/sas_injector.h" | 20 #include "remoting/host/sas_injector.h" |
20 #include "remoting/proto/event.pb.h" | 21 #include "remoting/proto/event.pb.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 94 |
94 DISALLOW_COPY_AND_ASSIGN(Core); | 95 DISALLOW_COPY_AND_ASSIGN(Core); |
95 }; | 96 }; |
96 | 97 |
97 SessionInputInjectorWin::Core::Core( | 98 SessionInputInjectorWin::Core::Core( |
98 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 99 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
99 scoped_ptr<InputInjector> nested_executor, | 100 scoped_ptr<InputInjector> nested_executor, |
100 scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner, | 101 scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner, |
101 const base::Closure& inject_sas) | 102 const base::Closure& inject_sas) |
102 : input_task_runner_(input_task_runner), | 103 : input_task_runner_(input_task_runner), |
103 nested_executor_(nested_executor.Pass()), | 104 nested_executor_(std::move(nested_executor)), |
104 inject_sas_task_runner_(inject_sas_task_runner), | 105 inject_sas_task_runner_(inject_sas_task_runner), |
105 inject_sas_(inject_sas) { | 106 inject_sas_(inject_sas) {} |
106 } | |
107 | 107 |
108 void SessionInputInjectorWin::Core::Start( | 108 void SessionInputInjectorWin::Core::Start( |
109 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 109 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
110 if (!input_task_runner_->BelongsToCurrentThread()) { | 110 if (!input_task_runner_->BelongsToCurrentThread()) { |
111 input_task_runner_->PostTask( | 111 input_task_runner_->PostTask( |
112 FROM_HERE, | 112 FROM_HERE, |
113 base::Bind(&Core::Start, this, base::Passed(&client_clipboard))); | 113 base::Bind(&Core::Start, this, base::Passed(&client_clipboard))); |
114 return; | 114 return; |
115 } | 115 } |
116 | 116 |
117 nested_executor_->Start(client_clipboard.Pass()); | 117 nested_executor_->Start(std::move(client_clipboard)); |
118 } | 118 } |
119 | 119 |
120 void SessionInputInjectorWin::Core::InjectClipboardEvent( | 120 void SessionInputInjectorWin::Core::InjectClipboardEvent( |
121 const ClipboardEvent& event) { | 121 const ClipboardEvent& event) { |
122 if (!input_task_runner_->BelongsToCurrentThread()) { | 122 if (!input_task_runner_->BelongsToCurrentThread()) { |
123 input_task_runner_->PostTask( | 123 input_task_runner_->PostTask( |
124 FROM_HERE, base::Bind(&Core::InjectClipboardEvent, this, event)); | 124 FROM_HERE, base::Bind(&Core::InjectClipboardEvent, this, event)); |
125 return; | 125 return; |
126 } | 126 } |
127 | 127 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // So we can continue capture screen bits, just from a diffected desktop. | 212 // So we can continue capture screen bits, just from a diffected desktop. |
213 desktop_.SetThreadDesktop(input_desktop.release()); | 213 desktop_.SetThreadDesktop(input_desktop.release()); |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 SessionInputInjectorWin::SessionInputInjectorWin( | 217 SessionInputInjectorWin::SessionInputInjectorWin( |
218 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 218 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
219 scoped_ptr<InputInjector> nested_executor, | 219 scoped_ptr<InputInjector> nested_executor, |
220 scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner, | 220 scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner, |
221 const base::Closure& inject_sas) { | 221 const base::Closure& inject_sas) { |
222 core_ = new Core(input_task_runner, nested_executor.Pass(), | 222 core_ = new Core(input_task_runner, std::move(nested_executor), |
223 inject_sas_task_runner, inject_sas); | 223 inject_sas_task_runner, inject_sas); |
224 } | 224 } |
225 | 225 |
226 SessionInputInjectorWin::~SessionInputInjectorWin() { | 226 SessionInputInjectorWin::~SessionInputInjectorWin() { |
227 } | 227 } |
228 | 228 |
229 void SessionInputInjectorWin::Start( | 229 void SessionInputInjectorWin::Start( |
230 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 230 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
231 core_->Start(client_clipboard.Pass()); | 231 core_->Start(std::move(client_clipboard)); |
232 } | 232 } |
233 | 233 |
234 void SessionInputInjectorWin::InjectClipboardEvent( | 234 void SessionInputInjectorWin::InjectClipboardEvent( |
235 const protocol::ClipboardEvent& event) { | 235 const protocol::ClipboardEvent& event) { |
236 core_->InjectClipboardEvent(event); | 236 core_->InjectClipboardEvent(event); |
237 } | 237 } |
238 | 238 |
239 void SessionInputInjectorWin::InjectKeyEvent(const protocol::KeyEvent& event) { | 239 void SessionInputInjectorWin::InjectKeyEvent(const protocol::KeyEvent& event) { |
240 core_->InjectKeyEvent(event); | 240 core_->InjectKeyEvent(event); |
241 } | 241 } |
242 | 242 |
243 void SessionInputInjectorWin::InjectTextEvent( | 243 void SessionInputInjectorWin::InjectTextEvent( |
244 const protocol::TextEvent& event) { | 244 const protocol::TextEvent& event) { |
245 core_->InjectTextEvent(event); | 245 core_->InjectTextEvent(event); |
246 } | 246 } |
247 | 247 |
248 void SessionInputInjectorWin::InjectMouseEvent( | 248 void SessionInputInjectorWin::InjectMouseEvent( |
249 const protocol::MouseEvent& event) { | 249 const protocol::MouseEvent& event) { |
250 core_->InjectMouseEvent(event); | 250 core_->InjectMouseEvent(event); |
251 } | 251 } |
252 | 252 |
253 void SessionInputInjectorWin::InjectTouchEvent( | 253 void SessionInputInjectorWin::InjectTouchEvent( |
254 const protocol::TouchEvent& event) { | 254 const protocol::TouchEvent& event) { |
255 core_->InjectTouchEvent(event); | 255 core_->InjectTouchEvent(event); |
256 } | 256 } |
257 | 257 |
258 } // namespace remoting | 258 } // namespace remoting |
OLD | NEW |