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_FRAME_TEST_SIMULATE_INPUT_H_ | 5 #ifndef CHROME_FRAME_TEST_SIMULATE_INPUT_H_ |
6 #define CHROME_FRAME_TEST_SIMULATE_INPUT_H_ | 6 #define CHROME_FRAME_TEST_SIMULATE_INPUT_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // Helper function to set keyboard focus to a window. This is achieved by | 30 // Helper function to set keyboard focus to a window. This is achieved by |
31 // sending a mouse move followed by a mouse down/mouse up combination to the | 31 // sending a mouse move followed by a mouse down/mouse up combination to the |
32 // window. | 32 // window. |
33 void SetKeyboardFocusToWindow(HWND window); | 33 void SetKeyboardFocusToWindow(HWND window); |
34 | 34 |
35 // Sends a keystroke to the currently active application with optional | 35 // Sends a keystroke to the currently active application with optional |
36 // modifiers set. | 36 // modifiers set. |
37 void SendMnemonic(WORD mnemonic_char, Modifier modifiers, bool extended, | 37 void SendMnemonic(WORD mnemonic_char, Modifier modifiers, bool extended, |
38 bool unicode); | 38 bool unicode); |
39 | 39 |
40 // Sends a mouse click to the window passed in. | 40 // Sends a mouse click to the desktop. |
41 enum MouseButton { LEFT, RIGHT, MIDDLE, X }; | 41 enum MouseButton { LEFT, RIGHT, MIDDLE, X }; |
| 42 void SendMouseClick(int x, int y, MouseButton button); |
| 43 // Sends a mouse click to the window passed in, after ensuring that the window |
| 44 // is in the foreground. |
42 void SendMouseClick(HWND window, int x, int y, MouseButton button); | 45 void SendMouseClick(HWND window, int x, int y, MouseButton button); |
43 | 46 |
44 // Translates a single char to a virtual key. | 47 // Translates a single char to a virtual key. |
45 void SendScanCode(short scan_code, Modifier modifiers); | 48 void SendScanCode(short scan_code, Modifier modifiers); |
46 void SendCharA(char c, Modifier modifiers); | 49 void SendCharA(char c, Modifier modifiers); |
47 void SendCharW(wchar_t c, Modifier modifiers); | 50 void SendCharW(wchar_t c, Modifier modifiers); |
48 | 51 |
49 // Sends extended keystroke to the currently active application with optional | 52 // Sends extended keystroke to the currently active application with optional |
50 // modifiers set. | 53 // modifiers set. |
51 void SendExtendedKey(WORD key, Modifier modifiers); | 54 void SendExtendedKey(WORD key, Modifier modifiers); |
52 | 55 |
53 // Iterates through all the characters in the string and simulates | 56 // Iterates through all the characters in the string and simulates |
54 // keyboard input. The input goes to the currently active application. | 57 // keyboard input. The input goes to the currently active application. |
55 void SendStringW(const wchar_t* s); | 58 void SendStringW(const wchar_t* s); |
56 void SendStringA(const char* s); | 59 void SendStringA(const char* s); |
57 | 60 |
58 } // end namespace simulate_input | 61 } // end namespace simulate_input |
59 | 62 |
60 #endif // CHROME_FRAME_TEST_SIMULATE_INPUT_H_ | 63 #endif // CHROME_FRAME_TEST_SIMULATE_INPUT_H_ |
61 | 64 |
OLD | NEW |