OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/test/webdriver/keycode_text_conversion.h" | 5 #include "chrome/test/webdriver/keycode_text_conversion.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/common/automation_constants.h" | 11 #include "chrome/common/automation_constants.h" |
12 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" | 12 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" |
13 | 13 |
14 namespace webdriver { | 14 namespace webdriver { |
15 | 15 |
16 std::string ConvertKeyCodeToText(ui::KeyboardCode key_code, int modifiers) { | 16 std::string ConvertKeyCodeToText(ui::KeyboardCode key_code, int modifiers) { |
17 // |gdk_keyval_to_upper| does not convert some keys like '1' to '!', so | 17 // |gdk_keyval_to_upper| does not convert some keys like '1' to '!', so |
18 // provide |ui::GdkKeyCodeForWindowsKeyCode| with our shift state as well, | 18 // provide |ui::GdkKeyCodeForWindowsKeyCode| with our shift state as well, |
19 // which will do basic conversions like it for us. | 19 // which will do basic conversions like it for us. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 if (is_special_symbol || key_utf32 != g_unichar_tolower(key_utf32)) | 58 if (is_special_symbol || key_utf32 != g_unichar_tolower(key_utf32)) |
59 *necessary_modifiers = automation::kShiftKeyMask; | 59 *necessary_modifiers = automation::kShiftKeyMask; |
60 ui::KeyboardCode code = ui::WindowsKeyCodeForGdkKeyCode(gdk_key_code); | 60 ui::KeyboardCode code = ui::WindowsKeyCodeForGdkKeyCode(gdk_key_code); |
61 if (code != ui::VKEY_UNKNOWN) | 61 if (code != ui::VKEY_UNKNOWN) |
62 *key_code = code; | 62 *key_code = code; |
63 return code != ui::VKEY_UNKNOWN; | 63 return code != ui::VKEY_UNKNOWN; |
64 } | 64 } |
65 | 65 |
66 } // namespace webdriver | 66 } // namespace webdriver |
OLD | NEW |