ui_controls_aura.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2013 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. #ifndef UI_BASE_TEST_UI_CONTROLS_AURA_H_
  5. #define UI_BASE_TEST_UI_CONTROLS_AURA_H_
  6. #include "base/callback_forward.h"
  7. #include "build/build_config.h"
  8. #include "build/chromeos_buildflags.h"
  9. #include "ui/base/test/ui_controls.h"
  10. #include "ui/events/keycodes/keyboard_codes.h"
  11. #include "ui/gfx/native_widget_types.h"
  12. namespace ui_controls {
  13. // An interface to provide Aura implementation of UI control.
  14. class UIControlsAura {
  15. public:
  16. UIControlsAura();
  17. virtual ~UIControlsAura();
  18. virtual bool SendKeyPress(gfx::NativeWindow window,
  19. ui::KeyboardCode key,
  20. bool control,
  21. bool shift,
  22. bool alt,
  23. bool command) = 0;
  24. virtual bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
  25. ui::KeyboardCode key,
  26. bool control,
  27. bool shift,
  28. bool alt,
  29. bool command,
  30. base::OnceClosure task) = 0;
  31. // Simulate a mouse move. (x,y) are absolute screen coordinates.
  32. virtual bool SendMouseMove(int x, int y) = 0;
  33. virtual bool SendMouseMoveNotifyWhenDone(int x,
  34. int y,
  35. base::OnceClosure task) = 0;
  36. // Sends a mouse down and/or up message. The click will be sent to wherever
  37. // the cursor currently is, so be sure to move the cursor before calling this
  38. // (and be sure the cursor has arrived!).
  39. virtual bool SendMouseEvents(MouseButton type,
  40. int button_state,
  41. int accelerator_state) = 0;
  42. virtual bool SendMouseEventsNotifyWhenDone(MouseButton type,
  43. int button_state,
  44. base::OnceClosure task,
  45. int accelerator_state) = 0;
  46. // Same as SendMouseEvents with BUTTON_UP | BUTTON_DOWN.
  47. virtual bool SendMouseClick(MouseButton type) = 0;
  48. #if BUILDFLAG(IS_WIN)
  49. virtual bool SendTouchEvents(int action, int num, int x, int y) = 0;
  50. #elif BUILDFLAG(IS_CHROMEOS)
  51. virtual bool SendTouchEvents(int action, int id, int x, int y) = 0;
  52. virtual bool SendTouchEventsNotifyWhenDone(int action,
  53. int id,
  54. int x,
  55. int y,
  56. base::OnceClosure task) = 0;
  57. #endif
  58. };
  59. } // namespace ui_controls
  60. #endif // UI_BASE_TEST_UI_CONTROLS_AURA_H_