Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_OZONE_PUBLIC_SYSTEM_INPUT_INJECTOR_H_ | |
| 6 #define UI_OZONE_PUBLIC_SYSTEM_INPUT_INJECTOR_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "ui/events/event.h" | |
| 10 #include "ui/events/keycodes/dom4/keycode_converter.h" | |
| 11 #include "ui/gfx/geometry/point_f.h" | |
| 12 #include "ui/ozone/ozone_export.h" | |
| 13 | |
| 14 namespace gfx { | |
| 15 class PointF; | |
| 16 } // namespace gfx | |
| 17 | |
| 18 namespace ui { | |
| 19 class Event; | |
| 20 | |
| 21 // Interface for converting input into ui::Events and injecting them to the | |
| 22 // Ozone platform. | |
| 23 class OZONE_EXPORT SystemInputInjector { | |
| 24 public: | |
| 25 SystemInputInjector() {}; | |
| 26 virtual ~SystemInputInjector() {}; | |
| 27 | |
| 28 // Moves the cursor on the screen and generates the corresponding MouseMove or | |
| 29 // MouseDragged event. |location| is in physical screen co-ordinates, | |
| 30 // independent of the scale factor and the display rotation settings. | |
| 31 virtual void MoveCursorTo(const gfx::PointF& location) = 0; | |
|
kelvinp
2014/11/25 04:43:08
Why separate injection functions instead of one Po
| |
| 32 | |
| 33 // Simulates a mouse button click. |button| must be one of | |
| 34 // EF_LEFT_MOUSE_BUTTON, EF_RIGHT_MOUSE_BUTTON or EF_MIDDLE_MOUSE_BUTTON. | |
| 35 // SystemInputInjector will apply the correct modifiers (shift, ctrl, etc). | |
| 36 virtual void InjectMouseButton(EventFlags button, bool down) = 0; | |
| 37 | |
| 38 // |delta_x| and |delta_y| are in physical pixels independent of the scale | |
| 39 // factor. | |
| 40 virtual void InjectMouseWheel(int delta_x, int delta_y) = 0; | |
| 41 | |
| 42 // Simulates a key press. SystemInputInjector maps |physical_key| to the | |
| 43 // correct logical key based on the current keyboard layout. | |
| 44 virtual void InjectKeyPress(DomKey physical_key, bool down) = 0; | |
|
kpschoedel
2014/11/25 15:39:24
ui::DomCode for physical keys.
ui/events/keycodes/
kelvinp
2014/11/25 21:16:49
Good idea. I will add the function
KeycodeConvert
| |
| 45 | |
| 46 private: | |
| 47 DISALLOW_COPY_AND_ASSIGN(SystemInputInjector); | |
| 48 }; | |
| 49 | |
| 50 } // namespace ui | |
| 51 | |
| 52 #endif // UI_OZONE_PUBLIC_SYSTEM_INPUT_INJECTOR_H_ | |
| OLD | NEW |