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 <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 if (SendInput(1, &input, sizeof(INPUT)) == 0) | 46 if (SendInput(1, &input, sizeof(INPUT)) == 0) |
47 PLOG(ERROR) << "Failed to inject a key event"; | 47 PLOG(ERROR) << "Failed to inject a key event"; |
48 } | 48 } |
49 | 49 |
50 using protocol::ClipboardEvent; | 50 using protocol::ClipboardEvent; |
51 using protocol::KeyEvent; | 51 using protocol::KeyEvent; |
52 using protocol::TextEvent; | 52 using protocol::TextEvent; |
53 using protocol::MouseEvent; | 53 using protocol::MouseEvent; |
| 54 using protocol::TouchEvent; |
54 | 55 |
55 // A class to generate events on Windows. | 56 // A class to generate events on Windows. |
56 class InputInjectorWin : public InputInjector { | 57 class InputInjectorWin : public InputInjector { |
57 public: | 58 public: |
58 InputInjectorWin(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 59 InputInjectorWin(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
59 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | 60 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
60 virtual ~InputInjectorWin(); | 61 virtual ~InputInjectorWin(); |
61 | 62 |
62 // ClipboardStub interface. | 63 // ClipboardStub interface. |
63 virtual void InjectClipboardEvent(const ClipboardEvent& event) override; | 64 virtual void InjectClipboardEvent(const ClipboardEvent& event) override; |
64 | 65 |
65 // InputStub interface. | 66 // InputStub interface. |
66 virtual void InjectKeyEvent(const KeyEvent& event) override; | 67 virtual void InjectKeyEvent(const KeyEvent& event) override; |
67 virtual void InjectTextEvent(const TextEvent& event) override; | 68 virtual void InjectTextEvent(const TextEvent& event) override; |
68 virtual void InjectMouseEvent(const MouseEvent& event) override; | 69 virtual void InjectMouseEvent(const MouseEvent& event) override; |
| 70 virtual void InjectTouchEvent(const TouchEvent& event) override; |
69 | 71 |
70 // InputInjector interface. | 72 // InputInjector interface. |
71 virtual void Start( | 73 virtual void Start( |
72 scoped_ptr<protocol::ClipboardStub> client_clipboard) override; | 74 scoped_ptr<protocol::ClipboardStub> client_clipboard) override; |
73 | 75 |
74 private: | 76 private: |
75 // The actual implementation resides in InputInjectorWin::Core class. | 77 // The actual implementation resides in InputInjectorWin::Core class. |
76 class Core : public base::RefCountedThreadSafe<Core> { | 78 class Core : public base::RefCountedThreadSafe<Core> { |
77 public: | 79 public: |
78 Core(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 80 Core(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 132 } |
131 | 133 |
132 void InputInjectorWin::InjectTextEvent(const TextEvent& event) { | 134 void InputInjectorWin::InjectTextEvent(const TextEvent& event) { |
133 core_->InjectTextEvent(event); | 135 core_->InjectTextEvent(event); |
134 } | 136 } |
135 | 137 |
136 void InputInjectorWin::InjectMouseEvent(const MouseEvent& event) { | 138 void InputInjectorWin::InjectMouseEvent(const MouseEvent& event) { |
137 core_->InjectMouseEvent(event); | 139 core_->InjectMouseEvent(event); |
138 } | 140 } |
139 | 141 |
| 142 void InputInjectorWin::InjectTouchEvent(const TouchEvent& event) { |
| 143 NOTIMPLEMENTED() << "Raw touch event injection not implemented for Windows."; |
| 144 } |
| 145 |
140 void InputInjectorWin::Start( | 146 void InputInjectorWin::Start( |
141 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 147 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
142 core_->Start(client_clipboard.Pass()); | 148 core_->Start(client_clipboard.Pass()); |
143 } | 149 } |
144 | 150 |
145 InputInjectorWin::Core::Core( | 151 InputInjectorWin::Core::Core( |
146 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 152 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
147 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) | 153 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) |
148 : main_task_runner_(main_task_runner), | 154 : main_task_runner_(main_task_runner), |
149 ui_task_runner_(ui_task_runner), | 155 ui_task_runner_(ui_task_runner), |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } // namespace | 329 } // namespace |
324 | 330 |
325 scoped_ptr<InputInjector> InputInjector::Create( | 331 scoped_ptr<InputInjector> InputInjector::Create( |
326 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 332 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
327 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 333 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
328 return make_scoped_ptr( | 334 return make_scoped_ptr( |
329 new InputInjectorWin(main_task_runner, ui_task_runner)); | 335 new InputInjectorWin(main_task_runner, ui_task_runner)); |
330 } | 336 } |
331 | 337 |
332 } // namespace remoting | 338 } // namespace remoting |
OLD | NEW |