OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_TEST_CHROMEDRIVER_KEY_CONVERTER_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_KEY_CONVERTER_H_ |
6 #define CHROME_TEST_CHROMEDRIVER_KEY_CONVERTER_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_KEY_CONVERTER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "ui/base/keycodes/keyboard_codes.h" | 12 #include "ui/base/keycodes/keyboard_codes.h" |
13 | 13 |
14 struct KeyEvent; | 14 struct KeyEvent; |
15 class Status; | 15 class Status; |
16 | 16 |
17 // Convenience functions for creating |KeyEvent|s. Used by unittests. | 17 // Convenience functions for creating |KeyEvent|s. Used by unittests. |
18 KeyEvent CreateKeyDownEvent(ui::KeyboardCode key_code, int modifiers); | 18 KeyEvent CreateKeyDownEvent(ui::KeyboardCode key_code, int modifiers); |
19 KeyEvent CreateKeyUpEvent(ui::KeyboardCode key_code, int modifiers); | 19 KeyEvent CreateKeyUpEvent(ui::KeyboardCode key_code, int modifiers); |
20 KeyEvent CreateCharEvent(const std::string& unmodified_text, | 20 KeyEvent CreateCharEvent(const std::string& unmodified_text, |
21 const std::string& modified_text, | 21 const std::string& modified_text, |
22 int modifiers); | 22 int modifiers); |
23 | 23 |
24 // Converts keys into appropriate |KeyEvent|s. This will do a best effort | 24 // Converts keys into appropriate |KeyEvent|s. This will do a best effort |
25 // conversion. However, if the input is invalid it will return a status with | 25 // conversion. However, if the input is invalid it will return a status with |
26 // an error message. If |release_modifiers| is true, all modifiers would be | 26 // an error message. If |release_modifiers| is true, all modifiers would be |
27 // depressed. |modifiers| acts both an input and an output, however, only when | 27 // depressed. |modifiers| acts both an input and an output, however, only when |
28 // the conversion process is successful will |modifiers| be changed. | 28 // the conversion process is successful will |modifiers| be changed. |
29 Status ConvertKeysToKeyEvents(const string16& keys, | 29 Status ConvertKeysToKeyEvents(const string16& keys, |
30 bool release_modifiers, | 30 bool release_modifiers, |
31 int* modifiers, | 31 int* modifiers, |
32 std::list<KeyEvent>* key_events); | 32 std::list<KeyEvent>* key_events); |
33 | 33 |
34 #endif // CHROME_TEST_CHROMEDRIVER_KEY_CONVERTER_H_ | 34 #endif // CHROME_TEST_CHROMEDRIVER_KEY_CONVERTER_H_ |
OLD | NEW |