Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: chrome/test/chromedriver/keycode_text_conversion_win.cc

Issue 12848005: [chromedriver] Separate stuff of chrome from chromedriver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments and fix compile error on mac. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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> 7 #include <windows.h>
8 8
9 #include <cctype> 9 #include <cctype>
10 10
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/test/chromedriver/ui_events.h" 12 #include "chrome/test/chromedriver/chrome/ui_events.h"
13 13
14 std::string ConvertKeyCodeToText(ui::KeyboardCode key_code, int modifiers) { 14 std::string ConvertKeyCodeToText(ui::KeyboardCode key_code, int modifiers) {
15 UINT scan_code = ::MapVirtualKeyW(key_code, MAPVK_VK_TO_VSC); 15 UINT scan_code = ::MapVirtualKeyW(key_code, MAPVK_VK_TO_VSC);
16 BYTE keyboard_state[256]; 16 BYTE keyboard_state[256];
17 memset(keyboard_state, 0, 256); 17 memset(keyboard_state, 0, 256);
18 if (modifiers & kShiftKeyModifierMask) 18 if (modifiers & kShiftKeyModifierMask)
19 keyboard_state[VK_SHIFT] |= 0x80; 19 keyboard_state[VK_SHIFT] |= 0x80;
20 if (modifiers & kControlKeyModifierMask) 20 if (modifiers & kControlKeyModifierMask)
21 keyboard_state[VK_CONTROL] |= 0x80; 21 keyboard_state[VK_CONTROL] |= 0x80;
22 if (modifiers & kAltKeyModifierMask) 22 if (modifiers & kAltKeyModifierMask)
(...skipping 25 matching lines...) Expand all
48 modifiers |= kShiftKeyModifierMask; 48 modifiers |= kShiftKeyModifierMask;
49 if (win_modifiers & 0x02) 49 if (win_modifiers & 0x02)
50 modifiers |= kControlKeyModifierMask; 50 modifiers |= kControlKeyModifierMask;
51 if (win_modifiers & 0x04) 51 if (win_modifiers & 0x04)
52 modifiers |= kAltKeyModifierMask; 52 modifiers |= kAltKeyModifierMask;
53 // Ignore bit 0x08: It is for Hankaku key. 53 // Ignore bit 0x08: It is for Hankaku key.
54 *necessary_modifiers = modifiers; 54 *necessary_modifiers = modifiers;
55 } 55 }
56 return translated; 56 return translated;
57 } 57 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/keycode_text_conversion_unittest.cc ('k') | chrome/test/chromedriver/keycode_text_conversion_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698