OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/strings/string16.h" | 6 #include "base/strings/string16.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/test/chromedriver/chrome/ui_events.h" | 9 #include "chrome/test/chromedriver/chrome/ui_events.h" |
10 #include "chrome/test/chromedriver/keycode_text_conversion.h" | 10 #include "chrome/test/chromedriver/keycode_text_conversion.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // masks are ignored. Only handle alt, ctrl and shift. | 28 // masks are ignored. Only handle alt, ctrl and shift. |
29 if (modifiers & kAltKeyModifierMask) | 29 if (modifiers & kAltKeyModifierMask) |
30 event_flags |= ui::EF_ALT_DOWN; | 30 event_flags |= ui::EF_ALT_DOWN; |
31 if (modifiers & kControlKeyModifierMask) | 31 if (modifiers & kControlKeyModifierMask) |
32 event_flags |= ui::EF_CONTROL_DOWN; | 32 event_flags |= ui::EF_CONTROL_DOWN; |
33 if (modifiers & kShiftKeyModifierMask) | 33 if (modifiers & kShiftKeyModifierMask) |
34 event_flags |= ui::EF_SHIFT_DOWN; | 34 event_flags |= ui::EF_SHIFT_DOWN; |
35 | 35 |
36 ui::DomKey dom_key; | 36 ui::DomKey dom_key; |
37 ui::KeyboardCode key_code_ignored; | 37 ui::KeyboardCode key_code_ignored; |
38 uint32 platform_keycode_ignored; | |
39 | 38 |
40 if (!keyboard_layout_engine->Lookup(dom_code, event_flags, &dom_key, | 39 if (!keyboard_layout_engine->Lookup(dom_code, event_flags, &dom_key, |
41 &key_code_ignored, | 40 &key_code_ignored)) { |
42 &platform_keycode_ignored)) { | |
43 // Key codes like ui::VKEY_UNKNOWN need to be mapped to the empty string, so | 41 // Key codes like ui::VKEY_UNKNOWN need to be mapped to the empty string, so |
44 // even if the lookup fails we still need to return true here. | 42 // even if the lookup fails we still need to return true here. |
45 *text = std::string(); | 43 *text = std::string(); |
46 return true; | 44 return true; |
47 } | 45 } |
48 | 46 |
49 if (!dom_key.IsCharacter()) { | 47 if (!dom_key.IsCharacter()) { |
50 *error_msg = base::StringPrintf( | 48 *error_msg = base::StringPrintf( |
51 "unicode conversion failed for keycode %d with modifiers 0x%x", | 49 "unicode conversion failed for keycode %d with modifiers 0x%x", |
52 key_code, modifiers); | 50 key_code, modifiers); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 *necessary_modifiers = kShiftKeyModifierMask; | 84 *necessary_modifiers = kShiftKeyModifierMask; |
87 found_code = true; | 85 found_code = true; |
88 } | 86 } |
89 if (found_code) { | 87 if (found_code) { |
90 *key_code = code; | 88 *key_code = code; |
91 break; | 89 break; |
92 } | 90 } |
93 } | 91 } |
94 return found_code; | 92 return found_code; |
95 } | 93 } |
OLD | NEW |