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

Side by Side Diff: ui/events/keycodes/keyboard_code_conversion.cc

Issue 1560293002: Rename KEY_ constants to avoid conflict with <linux/input.h> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments (Wez) Created 4 years, 11 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/events/keycodes/keyboard_code_conversion.h" 5 #include "ui/events/keycodes/keyboard_code_conversion.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "ui/events/event_constants.h" 10 #include "ui/events/event_constants.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 bool DomCodeToControlCharacter(DomCode dom_code, 64 bool DomCodeToControlCharacter(DomCode dom_code,
65 int flags, 65 int flags,
66 DomKey* dom_key, 66 DomKey* dom_key,
67 KeyboardCode* key_code) { 67 KeyboardCode* key_code) {
68 if ((flags & EF_CONTROL_DOWN) == 0) 68 if ((flags & EF_CONTROL_DOWN) == 0)
69 return false; 69 return false;
70 70
71 int code = static_cast<int>(dom_code); 71 int code = static_cast<int>(dom_code);
72 const int kKeyA = static_cast<int>(DomCode::KEY_A); 72 const int kKeyA = static_cast<int>(DomCode::US_A);
73 // Control-A - Control-Z map to 0x01 - 0x1A. 73 // Control-A - Control-Z map to 0x01 - 0x1A.
74 if (code >= kKeyA && code <= static_cast<int>(DomCode::KEY_Z)) { 74 if (code >= kKeyA && code <= static_cast<int>(DomCode::US_Z)) {
75 *dom_key = DomKey::FromCharacter(code - kKeyA + 1); 75 *dom_key = DomKey::FromCharacter(code - kKeyA + 1);
76 *key_code = static_cast<KeyboardCode>(code - kKeyA + VKEY_A); 76 *key_code = static_cast<KeyboardCode>(code - kKeyA + VKEY_A);
77 switch (dom_code) { 77 switch (dom_code) {
78 case DomCode::KEY_H: 78 case DomCode::US_H:
79 *key_code = VKEY_BACK; 79 *key_code = VKEY_BACK;
80 break; 80 break;
81 case DomCode::KEY_I: 81 case DomCode::US_I:
82 *key_code = VKEY_TAB; 82 *key_code = VKEY_TAB;
83 break; 83 break;
84 case DomCode::KEY_M: 84 case DomCode::US_M:
85 *key_code = VKEY_RETURN; 85 *key_code = VKEY_RETURN;
86 break; 86 break;
87 default: 87 default:
88 break; 88 break;
89 } 89 }
90 return true; 90 return true;
91 } 91 }
92 92
93 if (flags & EF_SHIFT_DOWN) { 93 if (flags & EF_SHIFT_DOWN) {
94 switch (dom_code) { 94 switch (dom_code) {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 return VKEY_UNKNOWN; 259 return VKEY_UNKNOWN;
260 } 260 }
261 261
262 KeyboardCode DomCodeToUsLayoutNonLocatedKeyboardCode(DomCode dom_code) { 262 KeyboardCode DomCodeToUsLayoutNonLocatedKeyboardCode(DomCode dom_code) {
263 return LocatedToNonLocatedKeyboardCode( 263 return LocatedToNonLocatedKeyboardCode(
264 DomCodeToUsLayoutKeyboardCode(dom_code)); 264 DomCodeToUsLayoutKeyboardCode(dom_code));
265 } 265 }
266 266
267 } // namespace ui 267 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/keycodes/dom_us_layout_data.h ('k') | ui/events/keycodes/keyboard_code_conversion_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698