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" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 MIDDLE, | 55 MIDDLE, |
56 RIGHT, | 56 RIGHT, |
57 }; | 57 }; |
58 | 58 |
59 // Used to indicate the state of the button when generating events. | 59 // Used to indicate the state of the button when generating events. |
60 enum MouseButtonState { | 60 enum MouseButtonState { |
61 UP = 1, | 61 UP = 1, |
62 DOWN = 2 | 62 DOWN = 2 |
63 }; | 63 }; |
64 | 64 |
65 // Sends a mouse down and or up message. | 65 // Sends a mouse down and/or up message. The click will be sent to wherever |
| 66 // the cursor currently is, so be sure to move the cursor before calling this |
| 67 // (and be sure the cursor has arrived!). |
66 bool SendMouseEvents(MouseButton type, int state); | 68 bool SendMouseEvents(MouseButton type, int state); |
67 void SendMouseEventsNotifyWhenDone(MouseButton type, int state, Task* task); | 69 bool SendMouseEventsNotifyWhenDone(MouseButton type, int state, Task* task); |
68 | 70 // Same as SendMouseEvents with UP | DOWN. |
69 // Simulate a single mouse click with given button type. | 71 bool SendMouseClick(MouseButton type); |
70 // The click will be sent to whichever window is under the cursor, so make sure | |
71 // the cursor is where you want it before calling this. | |
72 bool SendMouseClick(const gfx::Point& point, MouseButton type); | |
73 | 72 |
74 // A combination of SendMouseMove to the middle of the view followed by | 73 // A combination of SendMouseMove to the middle of the view followed by |
75 // SendMouseEvents. | 74 // SendMouseEvents. |
76 void MoveMouseToCenterAndPress(views::View* view, | 75 void MoveMouseToCenterAndPress( |
77 MouseButton button, | 76 #if defined(OS_WIN) |
78 int state, | 77 views::View* view, |
79 Task* task); | 78 #elif defined(OS_LINUX) |
| 79 GtkWidget* widget, |
| 80 #endif |
| 81 MouseButton button, |
| 82 int state, |
| 83 Task* task); |
80 | 84 |
81 } // ui_controls | 85 } // ui_controls |
82 | 86 |
83 #endif // CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ | 87 #endif // CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ |
OLD | NEW |