OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_chromeos.h" | 5 #include "remoting/host/input_injector_chromeos.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "remoting/host/chromeos/point_transformer.h" | 12 #include "remoting/host/chromeos/point_transformer.h" |
13 #include "remoting/host/clipboard.h" | 13 #include "remoting/host/clipboard.h" |
14 #include "remoting/proto/internal.pb.h" | 14 #include "remoting/proto/internal.pb.h" |
15 #include "ui/events/keycodes/dom3/dom_code.h" | 15 #include "ui/events/keycodes/dom3/dom_code.h" |
16 #include "ui/events/keycodes/dom4/keycode_converter.h" | 16 #include "ui/events/keycodes/dom4/keycode_converter.h" |
17 #include "ui/ozone/public/input_controller.h" | 17 #include "ui/ozone/public/input_controller.h" |
18 #include "ui/ozone/public/ozone_platform.h" | 18 #include "ui/ozone/public/ozone_platform.h" |
19 #include "ui/ozone/public/system_input_injector.h" | 19 #include "ui/ozone/public/system_input_injector.h" |
20 | 20 |
21 namespace remoting { | 21 namespace remoting { |
22 | 22 |
23 using protocol::ClipboardEvent; | 23 using protocol::ClipboardEvent; |
24 using protocol::KeyEvent; | 24 using protocol::KeyEvent; |
25 using protocol::MouseEvent; | 25 using protocol::MouseEvent; |
26 using protocol::TextEvent; | 26 using protocol::TextEvent; |
| 27 using protocol::TouchEvent; |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 ui::EventFlags MouseButtonToUIFlags(MouseEvent::MouseButton button) { | 31 ui::EventFlags MouseButtonToUIFlags(MouseEvent::MouseButton button) { |
31 switch (button) { | 32 switch (button) { |
32 case MouseEvent::BUTTON_LEFT: | 33 case MouseEvent::BUTTON_LEFT: |
33 return ui::EF_LEFT_MOUSE_BUTTON; | 34 return ui::EF_LEFT_MOUSE_BUTTON; |
34 case MouseEvent::BUTTON_RIGHT: | 35 case MouseEvent::BUTTON_RIGHT: |
35 return ui::EF_RIGHT_MOUSE_BUTTON; | 36 return ui::EF_RIGHT_MOUSE_BUTTON; |
36 case MouseEvent::BUTTON_MIDDLE: | 37 case MouseEvent::BUTTON_MIDDLE: |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 FROM_HERE, | 189 FROM_HERE, |
189 base::Bind(&Core::InjectTextEvent, base::Unretained(core_.get()), event)); | 190 base::Bind(&Core::InjectTextEvent, base::Unretained(core_.get()), event)); |
190 } | 191 } |
191 | 192 |
192 void InputInjectorChromeos::InjectMouseEvent(const MouseEvent& event) { | 193 void InputInjectorChromeos::InjectMouseEvent(const MouseEvent& event) { |
193 input_task_runner_->PostTask( | 194 input_task_runner_->PostTask( |
194 FROM_HERE, base::Bind(&Core::InjectMouseEvent, | 195 FROM_HERE, base::Bind(&Core::InjectMouseEvent, |
195 base::Unretained(core_.get()), event)); | 196 base::Unretained(core_.get()), event)); |
196 } | 197 } |
197 | 198 |
| 199 void InputInjectorChromeos::InjectTouchEvent(const TouchEvent& event) { |
| 200 NOTIMPLEMENTED() << "Raw touch event injection not implemented for ChromeOS."; |
| 201 } |
| 202 |
198 void InputInjectorChromeos::Start( | 203 void InputInjectorChromeos::Start( |
199 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 204 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
200 input_task_runner_->PostTask( | 205 input_task_runner_->PostTask( |
201 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()), | 206 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()), |
202 base::Passed(&client_clipboard))); | 207 base::Passed(&client_clipboard))); |
203 } | 208 } |
204 | 209 |
205 // static | 210 // static |
206 scoped_ptr<InputInjector> InputInjector::Create( | 211 scoped_ptr<InputInjector> InputInjector::Create( |
207 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 212 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
208 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 213 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
209 // The Ozone input injector must be called on the UI task runner of the | 214 // The Ozone input injector must be called on the UI task runner of the |
210 // browser process. | 215 // browser process. |
211 return make_scoped_ptr(new InputInjectorChromeos(ui_task_runner)); | 216 return make_scoped_ptr(new InputInjectorChromeos(ui_task_runner)); |
212 } | 217 } |
213 | 218 |
214 } // namespace remoting | 219 } // namespace remoting |
OLD | NEW |