| 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 <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
| 8 #include <Carbon/Carbon.h> | 8 #include <Carbon/Carbon.h> |
| 9 #include <IOKit/pwr_mgt/IOPMLib.h> | 9 #include <IOKit/pwr_mgt/IOPMLib.h> |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 void InputInjectorMac::InjectMouseEvent(const MouseEvent& event) { | 146 void InputInjectorMac::InjectMouseEvent(const MouseEvent& event) { |
| 147 core_->InjectMouseEvent(event); | 147 core_->InjectMouseEvent(event); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void InputInjectorMac::InjectTouchEvent(const TouchEvent& event) { | 150 void InputInjectorMac::InjectTouchEvent(const TouchEvent& event) { |
| 151 NOTIMPLEMENTED() << "Raw touch event injection not implemented for Mac."; | 151 NOTIMPLEMENTED() << "Raw touch event injection not implemented for Mac."; |
| 152 } | 152 } |
| 153 | 153 |
| 154 void InputInjectorMac::Start( | 154 void InputInjectorMac::Start( |
| 155 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 155 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
| 156 core_->Start(client_clipboard.Pass()); | 156 core_->Start(std::move(client_clipboard)); |
| 157 } | 157 } |
| 158 | 158 |
| 159 InputInjectorMac::Core::Core( | 159 InputInjectorMac::Core::Core( |
| 160 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 160 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 161 : task_runner_(task_runner), | 161 : task_runner_(task_runner), |
| 162 mouse_button_state_(0), | 162 mouse_button_state_(0), |
| 163 clipboard_(Clipboard::Create()), | 163 clipboard_(Clipboard::Create()), |
| 164 left_modifiers_(0), | 164 left_modifiers_(0), |
| 165 right_modifiers_(0) { | 165 right_modifiers_(0) { |
| 166 // Ensure that local hardware events are not suppressed after injecting | 166 // Ensure that local hardware events are not suppressed after injecting |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 333 |
| 334 void InputInjectorMac::Core::Start( | 334 void InputInjectorMac::Core::Start( |
| 335 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 335 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
| 336 if (!task_runner_->BelongsToCurrentThread()) { | 336 if (!task_runner_->BelongsToCurrentThread()) { |
| 337 task_runner_->PostTask( | 337 task_runner_->PostTask( |
| 338 FROM_HERE, | 338 FROM_HERE, |
| 339 base::Bind(&Core::Start, this, base::Passed(&client_clipboard))); | 339 base::Bind(&Core::Start, this, base::Passed(&client_clipboard))); |
| 340 return; | 340 return; |
| 341 } | 341 } |
| 342 | 342 |
| 343 clipboard_->Start(client_clipboard.Pass()); | 343 clipboard_->Start(std::move(client_clipboard)); |
| 344 } | 344 } |
| 345 | 345 |
| 346 void InputInjectorMac::Core::Stop() { | 346 void InputInjectorMac::Core::Stop() { |
| 347 if (!task_runner_->BelongsToCurrentThread()) { | 347 if (!task_runner_->BelongsToCurrentThread()) { |
| 348 task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this)); | 348 task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this)); |
| 349 return; | 349 return; |
| 350 } | 350 } |
| 351 | 351 |
| 352 clipboard_.reset(); | 352 clipboard_.reset(); |
| 353 } | 353 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 390 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
| 391 return make_scoped_ptr(new InputInjectorMac(main_task_runner)); | 391 return make_scoped_ptr(new InputInjectorMac(main_task_runner)); |
| 392 } | 392 } |
| 393 | 393 |
| 394 // static | 394 // static |
| 395 bool InputInjector::SupportsTouchEvents() { | 395 bool InputInjector::SupportsTouchEvents() { |
| 396 return false; | 396 return false; |
| 397 } | 397 } |
| 398 | 398 |
| 399 } // namespace remoting | 399 } // namespace remoting |
| OLD | NEW |