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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 // This value is not defined. Give it the obvious name so that if it is ever | 48 // This value is not defined. Give it the obvious name so that if it is ever |
49 // added there will be a handy compilation error to remind us to remove this | 49 // added there will be a handy compilation error to remind us to remove this |
50 // definition. | 50 // definition. |
51 const int kVK_RightCommand = 0x36; | 51 const int kVK_RightCommand = 0x36; |
52 | 52 |
53 using protocol::ClipboardEvent; | 53 using protocol::ClipboardEvent; |
54 using protocol::KeyEvent; | 54 using protocol::KeyEvent; |
55 using protocol::TextEvent; | 55 using protocol::TextEvent; |
56 using protocol::MouseEvent; | 56 using protocol::MouseEvent; |
| 57 using protocol::TouchEvent; |
57 | 58 |
58 // A class to generate events on Mac. | 59 // A class to generate events on Mac. |
59 class InputInjectorMac : public InputInjector { | 60 class InputInjectorMac : public InputInjector { |
60 public: | 61 public: |
61 explicit InputInjectorMac( | 62 explicit InputInjectorMac( |
62 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 63 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
63 ~InputInjectorMac() override; | 64 ~InputInjectorMac() override; |
64 | 65 |
65 // ClipboardStub interface. | 66 // ClipboardStub interface. |
66 void InjectClipboardEvent(const ClipboardEvent& event) override; | 67 void InjectClipboardEvent(const ClipboardEvent& event) override; |
67 | 68 |
68 // InputStub interface. | 69 // InputStub interface. |
69 void InjectKeyEvent(const KeyEvent& event) override; | 70 void InjectKeyEvent(const KeyEvent& event) override; |
70 void InjectTextEvent(const TextEvent& event) override; | 71 void InjectTextEvent(const TextEvent& event) override; |
71 void InjectMouseEvent(const MouseEvent& event) override; | 72 void InjectMouseEvent(const MouseEvent& event) override; |
| 73 void InjectTouchEvent(const TouchEvent& event) override; |
72 | 74 |
73 // InputInjector interface. | 75 // InputInjector interface. |
74 void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override; | 76 void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override; |
75 | 77 |
76 private: | 78 private: |
77 // The actual implementation resides in InputInjectorMac::Core class. | 79 // The actual implementation resides in InputInjectorMac::Core class. |
78 class Core : public base::RefCountedThreadSafe<Core> { | 80 class Core : public base::RefCountedThreadSafe<Core> { |
79 public: | 81 public: |
80 explicit Core(scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 82 explicit Core(scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
81 | 83 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 131 } |
130 | 132 |
131 void InputInjectorMac::InjectTextEvent(const TextEvent& event) { | 133 void InputInjectorMac::InjectTextEvent(const TextEvent& event) { |
132 core_->InjectTextEvent(event); | 134 core_->InjectTextEvent(event); |
133 } | 135 } |
134 | 136 |
135 void InputInjectorMac::InjectMouseEvent(const MouseEvent& event) { | 137 void InputInjectorMac::InjectMouseEvent(const MouseEvent& event) { |
136 core_->InjectMouseEvent(event); | 138 core_->InjectMouseEvent(event); |
137 } | 139 } |
138 | 140 |
| 141 void InputInjectorMac::InjectTouchEvent(const TouchEvent& event) { |
| 142 NOTIMPLEMENTED() << "Raw touch event injection not implemented for Mac."; |
| 143 } |
| 144 |
139 void InputInjectorMac::Start( | 145 void InputInjectorMac::Start( |
140 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 146 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
141 core_->Start(client_clipboard.Pass()); | 147 core_->Start(client_clipboard.Pass()); |
142 } | 148 } |
143 | 149 |
144 InputInjectorMac::Core::Core( | 150 InputInjectorMac::Core::Core( |
145 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 151 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
146 : task_runner_(task_runner), | 152 : task_runner_(task_runner), |
147 mouse_button_state_(0), | 153 mouse_button_state_(0), |
148 clipboard_(Clipboard::Create()), | 154 clipboard_(Clipboard::Create()), |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 340 |
335 } // namespace | 341 } // namespace |
336 | 342 |
337 scoped_ptr<InputInjector> InputInjector::Create( | 343 scoped_ptr<InputInjector> InputInjector::Create( |
338 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 344 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
339 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 345 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
340 return make_scoped_ptr(new InputInjectorMac(main_task_runner)); | 346 return make_scoped_ptr(new InputInjectorMac(main_task_runner)); |
341 } | 347 } |
342 | 348 |
343 } // namespace remoting | 349 } // namespace remoting |
OLD | NEW |