| 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/input_injector.h" | 5 #include "remoting/host/input_injector.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 7 #include <windows.h> | 8 #include <windows.h> |
| 8 #include <stdint.h> | 9 |
| 10 #include <utility> |
| 9 | 11 |
| 10 #include "base/bind.h" | 12 #include "base/bind.h" |
| 11 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 12 #include "base/location.h" | 14 #include "base/location.h" |
| 13 #include "base/macros.h" | 15 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 15 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 16 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 18 #include "remoting/base/util.h" | 20 #include "remoting/base/util.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 void InputInjectorWin::InjectMouseEvent(const MouseEvent& event) { | 146 void InputInjectorWin::InjectMouseEvent(const MouseEvent& event) { |
| 145 core_->InjectMouseEvent(event); | 147 core_->InjectMouseEvent(event); |
| 146 } | 148 } |
| 147 | 149 |
| 148 void InputInjectorWin::InjectTouchEvent(const TouchEvent& event) { | 150 void InputInjectorWin::InjectTouchEvent(const TouchEvent& event) { |
| 149 core_->InjectTouchEvent(event); | 151 core_->InjectTouchEvent(event); |
| 150 } | 152 } |
| 151 | 153 |
| 152 void InputInjectorWin::Start( | 154 void InputInjectorWin::Start( |
| 153 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 155 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
| 154 core_->Start(client_clipboard.Pass()); | 156 core_->Start(std::move(client_clipboard)); |
| 155 } | 157 } |
| 156 | 158 |
| 157 InputInjectorWin::Core::Core( | 159 InputInjectorWin::Core::Core( |
| 158 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 160 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 159 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) | 161 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) |
| 160 : main_task_runner_(main_task_runner), | 162 : main_task_runner_(main_task_runner), |
| 161 ui_task_runner_(ui_task_runner), | 163 ui_task_runner_(ui_task_runner), |
| 162 clipboard_(Clipboard::Create()) { | 164 clipboard_(Clipboard::Create()) { |
| 163 } | 165 } |
| 164 | 166 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 217 |
| 216 void InputInjectorWin::Core::Start( | 218 void InputInjectorWin::Core::Start( |
| 217 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 219 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
| 218 if (!ui_task_runner_->BelongsToCurrentThread()) { | 220 if (!ui_task_runner_->BelongsToCurrentThread()) { |
| 219 ui_task_runner_->PostTask( | 221 ui_task_runner_->PostTask( |
| 220 FROM_HERE, | 222 FROM_HERE, |
| 221 base::Bind(&Core::Start, this, base::Passed(&client_clipboard))); | 223 base::Bind(&Core::Start, this, base::Passed(&client_clipboard))); |
| 222 return; | 224 return; |
| 223 } | 225 } |
| 224 | 226 |
| 225 clipboard_->Start(client_clipboard.Pass()); | 227 clipboard_->Start(std::move(client_clipboard)); |
| 226 touch_injector_.Init(); | 228 touch_injector_.Init(); |
| 227 } | 229 } |
| 228 | 230 |
| 229 void InputInjectorWin::Core::Stop() { | 231 void InputInjectorWin::Core::Stop() { |
| 230 if (!ui_task_runner_->BelongsToCurrentThread()) { | 232 if (!ui_task_runner_->BelongsToCurrentThread()) { |
| 231 ui_task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this)); | 233 ui_task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this)); |
| 232 return; | 234 return; |
| 233 } | 235 } |
| 234 | 236 |
| 235 clipboard_.reset(); | 237 clipboard_.reset(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 return make_scoped_ptr( | 359 return make_scoped_ptr( |
| 358 new InputInjectorWin(main_task_runner, ui_task_runner)); | 360 new InputInjectorWin(main_task_runner, ui_task_runner)); |
| 359 } | 361 } |
| 360 | 362 |
| 361 // static | 363 // static |
| 362 bool InputInjector::SupportsTouchEvents() { | 364 bool InputInjector::SupportsTouchEvents() { |
| 363 return TouchInjectorWinDelegate::Create(); | 365 return TouchInjectorWinDelegate::Create(); |
| 364 } | 366 } |
| 365 | 367 |
| 366 } // namespace remoting | 368 } // namespace remoting |
| OLD | NEW |