OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ | 5 #ifndef CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ |
6 #define CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ | 6 #define CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ |
7 | 7 |
| 8 #include "build/build_config.h" |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
11 #include <wtypes.h> | 13 #include <wtypes.h> |
12 #endif | 14 #endif |
13 | 15 |
| 16 #include "base/gfx/native_widget_types.h" |
| 17 #include "base/gfx/point.h" |
| 18 |
14 namespace views { | 19 namespace views { |
15 class View; | 20 class View; |
16 } | 21 } |
17 | 22 |
18 class Task; | 23 class Task; |
19 | 24 |
20 namespace ui_controls { | 25 namespace ui_controls { |
21 | 26 |
22 // Many of the functions in this class include a variant that takes a Task. | 27 // Many of the functions in this class include a variant that takes a Task. |
23 // The version that takes a Task waits until the generated event is processed. | 28 // The version that takes a Task waits until the generated event is processed. |
24 // Once the generated event is processed the Task is Run (and deleted). | 29 // Once the generated event is processed the Task is Run (and deleted). |
25 | 30 |
26 // Send a key press with/without modifier keys. | 31 // Send a key press with/without modifier keys. |
27 bool SendKeyPress(wchar_t key, bool control, bool shift, bool alt); | 32 bool SendKeyPress(gfx::NativeWindow window, wchar_t key, bool control, |
| 33 bool shift, bool alt); |
28 bool SendKeyPressNotifyWhenDone(wchar_t key, bool control, bool shift, | 34 bool SendKeyPressNotifyWhenDone(wchar_t key, bool control, bool shift, |
29 bool alt, Task* task); | 35 bool alt, Task* task); |
30 | 36 |
31 // Send a key down event. Use VK_CONTROL for ctrl key, | 37 // Send a key down event. Use VK_CONTROL for ctrl key, |
32 // VK_MENU for alt key and VK_SHIFT for shift key. | 38 // VK_MENU for alt key and VK_SHIFT for shift key. |
33 // Refer MSDN for more virtual key codes. | 39 // Refer MSDN for more virtual key codes. |
34 bool SendKeyDown(wchar_t key); | 40 bool SendKeyDown(wchar_t key); |
35 bool SendKeyUp(wchar_t key); | 41 bool SendKeyUp(wchar_t key); |
36 | 42 |
37 // Simulate a mouse move. (x,y) are absolute screen coordinates. | 43 // Simulate a mouse move. (x,y) are absolute screen coordinates. |
(...skipping 10 matching lines...) Expand all Loading... |
48 enum MouseButtonState { | 54 enum MouseButtonState { |
49 UP = 1, | 55 UP = 1, |
50 DOWN = 2 | 56 DOWN = 2 |
51 }; | 57 }; |
52 | 58 |
53 // Sends a mouse down and or up message. | 59 // Sends a mouse down and or up message. |
54 bool SendMouseEvents(MouseButton type, int state); | 60 bool SendMouseEvents(MouseButton type, int state); |
55 void SendMouseEventsNotifyWhenDone(MouseButton type, int state, Task* task); | 61 void SendMouseEventsNotifyWhenDone(MouseButton type, int state, Task* task); |
56 | 62 |
57 // Simulate a single mouse click with given button type. | 63 // Simulate a single mouse click with given button type. |
58 bool SendMouseClick(MouseButton type); | 64 bool SendMouseClick(gfx::NativeWindow window, const gfx::Point& point, |
| 65 MouseButton type); |
59 | 66 |
60 // A combination of SendMouseMove to the middle of the view followed by | 67 // A combination of SendMouseMove to the middle of the view followed by |
61 // SendMouseEvents. | 68 // SendMouseEvents. |
62 void MoveMouseToCenterAndPress(views::View* view, | 69 void MoveMouseToCenterAndPress(views::View* view, |
63 MouseButton button, | 70 MouseButton button, |
64 int state, | 71 int state, |
65 Task* task); | 72 Task* task); |
66 | 73 |
67 } // ui_controls | 74 } // ui_controls |
68 | 75 |
69 #endif // CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ | 76 #endif // CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ |
OLD | NEW |