| 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 28 matching lines...) Expand all Loading... |
| 39 // Note: Windows does not currently do anything with the |window| argument for | 39 // Note: Windows does not currently do anything with the |window| argument for |
| 40 // these functions, so passing NULL is ok. | 40 // these functions, so passing NULL is ok. |
| 41 | 41 |
| 42 // Send a key press with/without modifier keys. | 42 // Send a key press with/without modifier keys. |
| 43 bool SendKeyPress(gfx::NativeWindow window, wchar_t key, bool control, | 43 bool SendKeyPress(gfx::NativeWindow window, wchar_t key, bool control, |
| 44 bool shift, bool alt); | 44 bool shift, bool alt); |
| 45 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, wchar_t key, | 45 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, wchar_t key, |
| 46 bool control, bool shift, | 46 bool control, bool shift, |
| 47 bool alt, Task* task); | 47 bool alt, Task* task); |
| 48 | 48 |
| 49 // Send a key down event. Use VK_CONTROL for ctrl key, | |
| 50 // VK_MENU for alt key and VK_SHIFT for shift key. | |
| 51 // Refer MSDN for more virtual key codes. | |
| 52 bool SendKeyDown(wchar_t key); | |
| 53 bool SendKeyUp(wchar_t key); | |
| 54 | |
| 55 // Simulate a mouse move. (x,y) are absolute screen coordinates. | 49 // Simulate a mouse move. (x,y) are absolute screen coordinates. |
| 56 bool SendMouseMove(long x, long y); | 50 bool SendMouseMove(long x, long y); |
| 57 void SendMouseMoveNotifyWhenDone(long x, long y, Task* task); | 51 bool SendMouseMoveNotifyWhenDone(long x, long y, Task* task); |
| 58 | 52 |
| 59 enum MouseButton { | 53 enum MouseButton { |
| 60 LEFT = 0, | 54 LEFT = 0, |
| 61 MIDDLE, | 55 MIDDLE, |
| 62 RIGHT, | 56 RIGHT, |
| 63 }; | 57 }; |
| 64 | 58 |
| 65 // Used to indicate the state of the button when generating events. | 59 // Used to indicate the state of the button when generating events. |
| 66 enum MouseButtonState { | 60 enum MouseButtonState { |
| 67 UP = 1, | 61 UP = 1, |
| 68 DOWN = 2 | 62 DOWN = 2 |
| 69 }; | 63 }; |
| 70 | 64 |
| 71 // Sends a mouse down and or up message. | 65 // Sends a mouse down and or up message. |
| 72 bool SendMouseEvents(MouseButton type, int state); | 66 bool SendMouseEvents(MouseButton type, int state); |
| 73 void SendMouseEventsNotifyWhenDone(MouseButton type, int state, Task* task); | 67 void SendMouseEventsNotifyWhenDone(MouseButton type, int state, Task* task); |
| 74 | 68 |
| 75 // Simulate a single mouse click with given button type. | 69 // Simulate a single mouse click with given button type. |
| 76 bool SendMouseClick(gfx::NativeWindow window, const gfx::Point& point, | 70 // The click will be sent to whichever window is under the cursor, so make sure |
| 77 MouseButton type); | 71 // the cursor is where you want it before calling this. |
| 72 bool SendMouseClick(const gfx::Point& point, MouseButton type); |
| 78 | 73 |
| 79 // A combination of SendMouseMove to the middle of the view followed by | 74 // A combination of SendMouseMove to the middle of the view followed by |
| 80 // SendMouseEvents. | 75 // SendMouseEvents. |
| 81 void MoveMouseToCenterAndPress(views::View* view, | 76 void MoveMouseToCenterAndPress(views::View* view, |
| 82 MouseButton button, | 77 MouseButton button, |
| 83 int state, | 78 int state, |
| 84 Task* task); | 79 Task* task); |
| 85 | 80 |
| 86 } // ui_controls | 81 } // ui_controls |
| 87 | 82 |
| 88 #endif // CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ | 83 #endif // CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ |
| OLD | NEW |