| 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_KEYCODE_TEXT_CONVERSION_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_KEYCODE_TEXT_CONVERSION_H_ |
| 6 #define CHROME_TEST_CHROMEDRIVER_KEYCODE_TEXT_CONVERSION_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_KEYCODE_TEXT_CONVERSION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "build/build_config.h" |
| 11 #include "ui/events/keycodes/keyboard_codes.h" | 12 #include "ui/events/keycodes/keyboard_codes.h" |
| 12 | 13 |
| 13 // These functions only support conversion of characters in the BMP | 14 // These functions only support conversion of characters in the BMP |
| 14 // (Basic Multilingual Plane). | 15 // (Basic Multilingual Plane). |
| 15 | 16 |
| 16 // Coverts a key code and modifiers to the UTF8 text that would be produced | 17 // Coverts a key code and modifiers to the UTF8 text that would be produced |
| 17 // with the current keyboard layout, or "" if no character would be produced. | 18 // with the current keyboard layout, or "" if no character would be produced. |
| 18 // Returns "" if the produced text contains characters outside the BMP. If an | 19 // Returns "" if the produced text contains characters outside the BMP. If an |
| 19 // error occurs |error_msg| will be set to the error message and will return | 20 // error occurs |error_msg| will be set to the error message and will return |
| 20 // false. | 21 // false. |
| 21 bool ConvertKeyCodeToText(ui::KeyboardCode key_code, | 22 bool ConvertKeyCodeToText(ui::KeyboardCode key_code, |
| 22 int modifiers, | 23 int modifiers, |
| 23 std::string* text, | 24 std::string* text, |
| 24 std::string* error_msg); | 25 std::string* error_msg); |
| 25 | 26 |
| 26 // Converts a character to the key code and modifiers that would produce | 27 // Converts a character to the key code and modifiers that would produce |
| 27 // the character using the current keyboard layout. Returns true on success. | 28 // the character using the current keyboard layout. Returns true on success. |
| 28 // If an error occurs |error_msg| will be set to the error message, otherwise | 29 // If an error occurs |error_msg| will be set to the error message, otherwise |
| 29 // it will be set to the empty string. | 30 // it will be set to the empty string. |
| 30 bool ConvertCharToKeyCode(base::char16 key, | 31 bool ConvertCharToKeyCode(base::char16 key, |
| 31 ui::KeyboardCode* key_code, | 32 ui::KeyboardCode* key_code, |
| 32 int *necessary_modifiers, | 33 int *necessary_modifiers, |
| 33 std::string* error_msg); | 34 std::string* error_msg); |
| 34 | 35 |
| 35 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
| 36 bool SwitchToUSKeyboardLayout(); | 37 bool SwitchToUSKeyboardLayout(); |
| 37 #endif | 38 #endif |
| 38 | 39 |
| 39 #endif // CHROME_TEST_CHROMEDRIVER_KEYCODE_TEXT_CONVERSION_H_ | 40 #endif // CHROME_TEST_CHROMEDRIVER_KEYCODE_TEXT_CONVERSION_H_ |
| OLD | NEW |