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 <stdint.h> | 10 #include <stdint.h> |
| 11 |
11 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <utility> |
12 | 14 |
13 #include "base/bind.h" | 15 #include "base/bind.h" |
14 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
15 #include "base/location.h" | 17 #include "base/location.h" |
16 #include "base/mac/scoped_cftyperef.h" | 18 #include "base/mac/scoped_cftyperef.h" |
17 #include "base/macros.h" | 19 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
19 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
20 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
21 #include "base/time/time.h" | 23 #include "base/time/time.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 void InputInjectorMac::InjectMouseEvent(const MouseEvent& event) { | 149 void InputInjectorMac::InjectMouseEvent(const MouseEvent& event) { |
148 core_->InjectMouseEvent(event); | 150 core_->InjectMouseEvent(event); |
149 } | 151 } |
150 | 152 |
151 void InputInjectorMac::InjectTouchEvent(const TouchEvent& event) { | 153 void InputInjectorMac::InjectTouchEvent(const TouchEvent& event) { |
152 NOTIMPLEMENTED() << "Raw touch event injection not implemented for Mac."; | 154 NOTIMPLEMENTED() << "Raw touch event injection not implemented for Mac."; |
153 } | 155 } |
154 | 156 |
155 void InputInjectorMac::Start( | 157 void InputInjectorMac::Start( |
156 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 158 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
157 core_->Start(client_clipboard.Pass()); | 159 core_->Start(std::move(client_clipboard)); |
158 } | 160 } |
159 | 161 |
160 InputInjectorMac::Core::Core( | 162 InputInjectorMac::Core::Core( |
161 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 163 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
162 : task_runner_(task_runner), | 164 : task_runner_(task_runner), |
163 mouse_button_state_(0), | 165 mouse_button_state_(0), |
164 clipboard_(Clipboard::Create()), | 166 clipboard_(Clipboard::Create()), |
165 left_modifiers_(0), | 167 left_modifiers_(0), |
166 right_modifiers_(0) { | 168 right_modifiers_(0) { |
167 // Ensure that local hardware events are not suppressed after injecting | 169 // Ensure that local hardware events are not suppressed after injecting |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 336 |
335 void InputInjectorMac::Core::Start( | 337 void InputInjectorMac::Core::Start( |
336 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 338 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
337 if (!task_runner_->BelongsToCurrentThread()) { | 339 if (!task_runner_->BelongsToCurrentThread()) { |
338 task_runner_->PostTask( | 340 task_runner_->PostTask( |
339 FROM_HERE, | 341 FROM_HERE, |
340 base::Bind(&Core::Start, this, base::Passed(&client_clipboard))); | 342 base::Bind(&Core::Start, this, base::Passed(&client_clipboard))); |
341 return; | 343 return; |
342 } | 344 } |
343 | 345 |
344 clipboard_->Start(client_clipboard.Pass()); | 346 clipboard_->Start(std::move(client_clipboard)); |
345 } | 347 } |
346 | 348 |
347 void InputInjectorMac::Core::Stop() { | 349 void InputInjectorMac::Core::Stop() { |
348 if (!task_runner_->BelongsToCurrentThread()) { | 350 if (!task_runner_->BelongsToCurrentThread()) { |
349 task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this)); | 351 task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this)); |
350 return; | 352 return; |
351 } | 353 } |
352 | 354 |
353 clipboard_.reset(); | 355 clipboard_.reset(); |
354 } | 356 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 393 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
392 return make_scoped_ptr(new InputInjectorMac(main_task_runner)); | 394 return make_scoped_ptr(new InputInjectorMac(main_task_runner)); |
393 } | 395 } |
394 | 396 |
395 // static | 397 // static |
396 bool InputInjector::SupportsTouchEvents() { | 398 bool InputInjector::SupportsTouchEvents() { |
397 return false; | 399 return false; |
398 } | 400 } |
399 | 401 |
400 } // namespace remoting | 402 } // namespace remoting |
OLD | NEW |