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 #include "chrome/test/chromedriver/keycode_text_conversion.h" | 5 #include "chrome/test/chromedriver/keycode_text_conversion.h" |
6 | 6 |
| 7 #include <windows.h> |
| 8 #include <stdlib.h> |
| 9 #include <string.h> |
7 #include <VersionHelpers.h> | 10 #include <VersionHelpers.h> |
8 #include <stdlib.h> | |
9 #include <windows.h> | |
10 | 11 |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/test/chromedriver/chrome/ui_events.h" | 14 #include "chrome/test/chromedriver/chrome/ui_events.h" |
14 | 15 |
15 bool ConvertKeyCodeToText( | 16 bool ConvertKeyCodeToText( |
16 ui::KeyboardCode key_code, int modifiers, std::string* text, | 17 ui::KeyboardCode key_code, int modifiers, std::string* text, |
17 std::string* error_msg) { | 18 std::string* error_msg) { |
18 UINT scan_code = ::MapVirtualKeyW(key_code, MAPVK_VK_TO_VSC); | 19 UINT scan_code = ::MapVirtualKeyW(key_code, MAPVK_VK_TO_VSC); |
19 BYTE keyboard_state[256]; | 20 BYTE keyboard_state[256]; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 KLF_SETFORPROCESS); | 86 KLF_SETFORPROCESS); |
86 ::GetKeyboardLayoutName(active_keyboard); | 87 ::GetKeyboardLayoutName(active_keyboard); |
87 if (wcscmp(active_keyboard, kUsKeyboardLayout) == 0) | 88 if (wcscmp(active_keyboard, kUsKeyboardLayout) == 0) |
88 return true; | 89 return true; |
89 } | 90 } |
90 return false; | 91 return false; |
91 } else { | 92 } else { |
92 return ::LoadKeyboardLayout(kUsKeyboardLayout, KLF_ACTIVATE) != NULL; | 93 return ::LoadKeyboardLayout(kUsKeyboardLayout, KLF_ACTIVATE) != NULL; |
93 } | 94 } |
94 } | 95 } |
OLD | NEW |