OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
12 #include <wtypes.h> | 12 #include <wtypes.h> |
13 #endif | 13 #endif |
14 | 14 |
| 15 #include "base/callback.h" |
15 #include "ui/base/keycodes/keyboard_codes.h" | 16 #include "ui/base/keycodes/keyboard_codes.h" |
16 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/gfx/point.h" | 18 #include "ui/gfx/point.h" |
18 | 19 |
19 #if defined(TOOLKIT_VIEWS) | 20 #if defined(TOOLKIT_VIEWS) |
20 namespace views { | 21 namespace views { |
21 class View; | 22 class View; |
22 } | 23 } |
23 #endif | 24 #endif |
24 | 25 |
(...skipping 25 matching lines...) Expand all Loading... |
50 bool control, | 51 bool control, |
51 bool shift, | 52 bool shift, |
52 bool alt, | 53 bool alt, |
53 bool command); | 54 bool command); |
54 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, | 55 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, |
55 ui::KeyboardCode key, | 56 ui::KeyboardCode key, |
56 bool control, | 57 bool control, |
57 bool shift, | 58 bool shift, |
58 bool alt, | 59 bool alt, |
59 bool command, | 60 bool command, |
60 Task* task); | 61 const base::Closure& task); |
61 | 62 |
62 // Simulate a mouse move. (x,y) are absolute screen coordinates. | 63 // Simulate a mouse move. (x,y) are absolute screen coordinates. |
63 bool SendMouseMove(long x, long y); | 64 bool SendMouseMove(long x, long y); |
64 bool SendMouseMoveNotifyWhenDone(long x, long y, Task* task); | 65 bool SendMouseMoveNotifyWhenDone(long x, long y, const base::Closure& task); |
65 | 66 |
66 enum MouseButton { | 67 enum MouseButton { |
67 LEFT = 0, | 68 LEFT = 0, |
68 MIDDLE, | 69 MIDDLE, |
69 RIGHT, | 70 RIGHT, |
70 }; | 71 }; |
71 | 72 |
72 // Used to indicate the state of the button when generating events. | 73 // Used to indicate the state of the button when generating events. |
73 enum MouseButtonState { | 74 enum MouseButtonState { |
74 UP = 1, | 75 UP = 1, |
75 DOWN = 2 | 76 DOWN = 2 |
76 }; | 77 }; |
77 | 78 |
78 // Sends a mouse down and/or up message. The click will be sent to wherever | 79 // Sends a mouse down and/or up message. The click will be sent to wherever |
79 // the cursor currently is, so be sure to move the cursor before calling this | 80 // the cursor currently is, so be sure to move the cursor before calling this |
80 // (and be sure the cursor has arrived!). | 81 // (and be sure the cursor has arrived!). |
81 bool SendMouseEvents(MouseButton type, int state); | 82 bool SendMouseEvents(MouseButton type, int state); |
82 bool SendMouseEventsNotifyWhenDone(MouseButton type, int state, Task* task); | 83 bool SendMouseEventsNotifyWhenDone(MouseButton type, int state, |
| 84 const base::Closure& task); |
83 // Same as SendMouseEvents with UP | DOWN. | 85 // Same as SendMouseEvents with UP | DOWN. |
84 bool SendMouseClick(MouseButton type); | 86 bool SendMouseClick(MouseButton type); |
85 | 87 |
86 // A combination of SendMouseMove to the middle of the view followed by | 88 // A combination of SendMouseMove to the middle of the view followed by |
87 // SendMouseEvents. | 89 // SendMouseEvents. |
88 void MoveMouseToCenterAndPress( | 90 void MoveMouseToCenterAndPress( |
89 #if defined(TOOLKIT_VIEWS) | 91 #if defined(TOOLKIT_VIEWS) |
90 views::View* view, | 92 views::View* view, |
91 #elif defined(TOOLKIT_GTK) | 93 #elif defined(TOOLKIT_GTK) |
92 GtkWidget* widget, | 94 GtkWidget* widget, |
93 #elif defined(OS_MACOSX) | 95 #elif defined(OS_MACOSX) |
94 NSView* view, | 96 NSView* view, |
95 #endif | 97 #endif |
96 MouseButton button, | 98 MouseButton button, |
97 int state, | 99 int state, |
98 Task* task); | 100 const base::Closure& task); |
99 | 101 |
100 } // ui_controls | 102 } // ui_controls |
101 | 103 |
102 #endif // CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ | 104 #endif // CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ |
OLD | NEW |