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 <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void InjectClipboardEvent(const ClipboardEvent& event) override; | 67 void InjectClipboardEvent(const ClipboardEvent& event) override; |
68 | 68 |
69 // InputStub interface. | 69 // InputStub interface. |
70 void InjectKeyEvent(const KeyEvent& event) override; | 70 void InjectKeyEvent(const KeyEvent& event) override; |
71 void InjectTextEvent(const TextEvent& event) override; | 71 void InjectTextEvent(const TextEvent& event) override; |
72 void InjectMouseEvent(const MouseEvent& event) override; | 72 void InjectMouseEvent(const MouseEvent& event) override; |
73 void InjectTouchEvent(const TouchEvent& event) override; | 73 void InjectTouchEvent(const TouchEvent& event) override; |
74 | 74 |
75 // InputInjector interface. | 75 // InputInjector interface. |
76 void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override; | 76 void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override; |
| 77 bool CanInjectTouch() override; |
77 | 78 |
78 private: | 79 private: |
79 // The actual implementation resides in InputInjectorMac::Core class. | 80 // The actual implementation resides in InputInjectorMac::Core class. |
80 class Core : public base::RefCountedThreadSafe<Core> { | 81 class Core : public base::RefCountedThreadSafe<Core> { |
81 public: | 82 public: |
82 explicit Core(scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 83 explicit Core(scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
83 | 84 |
84 // Mirrors the ClipboardStub interface. | 85 // Mirrors the ClipboardStub interface. |
85 void InjectClipboardEvent(const ClipboardEvent& event); | 86 void InjectClipboardEvent(const ClipboardEvent& event); |
86 | 87 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 141 |
141 void InputInjectorMac::InjectTouchEvent(const TouchEvent& event) { | 142 void InputInjectorMac::InjectTouchEvent(const TouchEvent& event) { |
142 NOTIMPLEMENTED() << "Raw touch event injection not implemented for Mac."; | 143 NOTIMPLEMENTED() << "Raw touch event injection not implemented for Mac."; |
143 } | 144 } |
144 | 145 |
145 void InputInjectorMac::Start( | 146 void InputInjectorMac::Start( |
146 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 147 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
147 core_->Start(client_clipboard.Pass()); | 148 core_->Start(client_clipboard.Pass()); |
148 } | 149 } |
149 | 150 |
| 151 bool InputInjectorMac::CanInjectTouch() { |
| 152 return InputInjector::DefaultCanInjectTouch(); |
| 153 } |
| 154 |
150 InputInjectorMac::Core::Core( | 155 InputInjectorMac::Core::Core( |
151 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 156 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
152 : task_runner_(task_runner), | 157 : task_runner_(task_runner), |
153 mouse_button_state_(0), | 158 mouse_button_state_(0), |
154 clipboard_(Clipboard::Create()), | 159 clipboard_(Clipboard::Create()), |
155 left_modifiers_(0), | 160 left_modifiers_(0), |
156 right_modifiers_(0) { | 161 right_modifiers_(0) { |
157 // Ensure that local hardware events are not suppressed after injecting | 162 // Ensure that local hardware events are not suppressed after injecting |
158 // input events. This allows LocalInputMonitor to detect if the local mouse | 163 // input events. This allows LocalInputMonitor to detect if the local mouse |
159 // is being moved whilst a remote user is connected. | 164 // is being moved whilst a remote user is connected. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 return; | 338 return; |
334 } | 339 } |
335 | 340 |
336 clipboard_.reset(); | 341 clipboard_.reset(); |
337 } | 342 } |
338 | 343 |
339 InputInjectorMac::Core::~Core() {} | 344 InputInjectorMac::Core::~Core() {} |
340 | 345 |
341 } // namespace | 346 } // namespace |
342 | 347 |
| 348 // static |
343 scoped_ptr<InputInjector> InputInjector::Create( | 349 scoped_ptr<InputInjector> InputInjector::Create( |
344 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 350 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
345 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 351 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
346 return make_scoped_ptr(new InputInjectorMac(main_task_runner)); | 352 return make_scoped_ptr(new InputInjectorMac(main_task_runner)); |
347 } | 353 } |
348 | 354 |
| 355 // static |
| 356 bool InputInjector::DefaultCanInjectTouch() { |
| 357 return false; |
| 358 } |
| 359 |
349 } // namespace remoting | 360 } // namespace remoting |
OLD | NEW |