OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_ |
7 | 7 |
8 #include "ppapi/c/pp_stdint.h" | 8 #include "ppapi/c/pp_stdint.h" |
9 | 9 |
10 namespace WebKit { | 10 namespace WebKit { |
11 class WebKeyboardEvent; | 11 class WebKeyboardEvent; |
12 } // namespace WebKit | 12 } // namespace WebKit |
13 | 13 |
14 namespace webkit { | 14 namespace webkit { |
15 namespace ppapi { | 15 namespace ppapi { |
16 | 16 |
17 // Returns a 32-bit "USB Key Code" for the key identifier by the supplied | 17 // Returns a 32-bit "USB Key Code" for the key identifier by the supplied |
18 // WebKeyboardEvent. The supplied event must be a KeyDown or KeyUp. | 18 // WebKeyboardEvent. The supplied event must be a KeyDown or KeyUp. |
19 // The code consists of the USB Page (in the high-order 16-bit word) and | 19 // The code consists of the USB Page (in the high-order 16-bit word) and |
20 // USB Usage Id of the key. If no translation can be performed then zero | 20 // USB Usage Id of the key. If no translation can be performed then zero |
21 // is returned. | 21 // is returned. |
22 uint32_t UsbKeyCodeForKeyboardEvent(const WebKit::WebKeyboardEvent& key_event); | 22 uint32_t UsbKeyCodeForKeyboardEvent(const WebKit::WebKeyboardEvent& key_event); |
23 | 23 |
24 // Compile time check to verify that the given array (of type CTYPENAME) has | |
25 // exactly SIZE elements. | |
26 #define COMPILE_ASSERT_ARRAY_SIZE(NAME, CTYPENAME, SIZE) \ | |
27 struct Dummy_Struct_For_##NAME { \ | |
28 char _COMPILE_ASSERT_FAILED_The_array_named_ \ | |
29 ## NAME ## _does_not_have_ ## SIZE ## \ | |
30 _elements[(sizeof(NAME) == (SIZE * sizeof(CTYPENAME))) ? 1 : -1]; } | |
Wez
2012/03/07 23:25:18
PPAPI headers already use macros of this sort; can
dmichael (off chromium)
2012/03/07 23:45:07
since here we're free to use things in base, it wo
garykac
2012/03/14 13:47:47
Done.
| |
31 | |
24 } // namespace ppapi | 32 } // namespace ppapi |
25 } // namespace webkit | 33 } // namespace webkit |
26 | 34 |
27 #endif // WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_ | 35 #endif // WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_ |
OLD | NEW |