OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 | 8 |
9 #include "KeyboardCodes.h" | 9 #include "KeyboardCodes.h" |
10 #include "StringImpl.h" // This is so that the KJS build works | 10 #include "StringImpl.h" // This is so that the KJS build works |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 default: | 144 default: |
145 ASSERT_NOT_REACHED(); | 145 ASSERT_NOT_REACHED(); |
146 } | 146 } |
147 return PlatformKeyboardEvent::KeyDown; | 147 return PlatformKeyboardEvent::KeyDown; |
148 } | 148 } |
149 | 149 |
150 static inline String ToSingleCharacterString(UChar c) { | 150 static inline String ToSingleCharacterString(UChar c) { |
151 return String(&c, 1); | 151 return String(&c, 1); |
152 } | 152 } |
153 | 153 |
| 154 #if !defined(OS_MACOSX) |
| 155 // This function is not used on Mac OS X, and gcc complains. |
154 static String GetKeyIdentifierForWindowsKeyCode(unsigned short keyCode) { | 156 static String GetKeyIdentifierForWindowsKeyCode(unsigned short keyCode) { |
155 switch (keyCode) { | 157 switch (keyCode) { |
156 case VKEY_MENU: | 158 case VKEY_MENU: |
157 return "Alt"; | 159 return "Alt"; |
158 case VKEY_CONTROL: | 160 case VKEY_CONTROL: |
159 return "Control"; | 161 return "Control"; |
160 case VKEY_SHIFT: | 162 case VKEY_SHIFT: |
161 return "Shift"; | 163 return "Shift"; |
162 case VKEY_CAPITAL: | 164 case VKEY_CAPITAL: |
163 return "CapsLock"; | 165 return "CapsLock"; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 return "Select"; | 248 return "Select"; |
247 case VKEY_UP: | 249 case VKEY_UP: |
248 return "Up"; | 250 return "Up"; |
249 // Standard says that DEL becomes U+007F. | 251 // Standard says that DEL becomes U+007F. |
250 case VKEY_DELETE: | 252 case VKEY_DELETE: |
251 return "U+007F"; | 253 return "U+007F"; |
252 default: | 254 default: |
253 return String::format("U+%04X", toupper(keyCode)); | 255 return String::format("U+%04X", toupper(keyCode)); |
254 } | 256 } |
255 } | 257 } |
| 258 #endif // !defined(OS_MACOSX) |
256 | 259 |
257 MakePlatformKeyboardEvent::MakePlatformKeyboardEvent(const WebKeyboardEvent& e) | 260 MakePlatformKeyboardEvent::MakePlatformKeyboardEvent(const WebKeyboardEvent& e) |
258 { | 261 { |
259 m_type = ToPlatformKeyboardEventType(e.type); | 262 m_type = ToPlatformKeyboardEventType(e.type); |
260 if (m_type == Char || m_type == KeyDown) { | 263 if (m_type == Char || m_type == KeyDown) { |
261 #if defined(OS_MACOSX) | 264 #if defined(OS_MACOSX) |
262 m_text = &e.text[0]; | 265 m_text = &e.text[0]; |
263 m_unmodifiedText = &e.unmodified_text[0]; | 266 m_unmodifiedText = &e.unmodified_text[0]; |
264 m_keyIdentifier = &e.key_identifier[0]; | 267 m_keyIdentifier = &e.key_identifier[0]; |
265 | 268 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 switch (windowsVirtualKeyCode()) { | 342 switch (windowsVirtualKeyCode()) { |
340 case VKEY_BACK: | 343 case VKEY_BACK: |
341 case VKEY_ESCAPE: | 344 case VKEY_ESCAPE: |
342 return false; | 345 return false; |
343 | 346 |
344 default: | 347 default: |
345 break; | 348 break; |
346 } | 349 } |
347 return true; | 350 return true; |
348 } | 351 } |
OLD | NEW |