OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "webkit/tools/pepper_test_plugin/event_handler.h" | 26 #include "webkit/tools/pepper_test_plugin/event_handler.h" |
27 | 27 |
28 #include <stdio.h> | 28 #include <stdio.h> |
29 #include <string> | 29 #include <string> |
30 | 30 |
31 #include "base/basictypes.h" | |
32 #include "base/logging.h" | 31 #include "base/logging.h" |
33 #include "base/string_util.h" | 32 #include "base/string_util.h" |
34 #include "webkit/tools/pepper_test_plugin/plugin_object.h" | 33 #include "webkit/tools/pepper_test_plugin/plugin_object.h" |
35 | 34 |
36 EventHandler* event_handler = NULL; | 35 EventHandler* event_handler = NULL; |
37 | 36 |
38 // EventHandler ---------------------------------------------------------------- | 37 // EventHandler ---------------------------------------------------------------- |
39 | 38 |
40 EventHandler::EventHandler(NPP npp) | 39 EventHandler::EventHandler(NPP npp) |
41 : npp_(npp), | 40 : npp_(npp), |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 case NPEventType_KeyDown: | 120 case NPEventType_KeyDown: |
122 case NPEventType_KeyUp: | 121 case NPEventType_KeyUp: |
123 str += StringPrintf(": mod %x, key: %x", | 122 str += StringPrintf(": mod %x, key: %x", |
124 npevent->u.key.modifier, | 123 npevent->u.key.modifier, |
125 npevent->u.key.normalizedKeyCode); | 124 npevent->u.key.normalizedKeyCode); |
126 break; | 125 break; |
127 case NPEventType_Char: | 126 case NPEventType_Char: |
128 str += StringPrintf(": mod %x, text: ", | 127 str += StringPrintf(": mod %x, text: ", |
129 npevent->u.character.modifier); | 128 npevent->u.character.modifier); |
130 size_t i; | 129 size_t i; |
131 for (i = 0; i < arraysize(npevent->u.character.text); ++i) { | 130 for (i = 0; i < ARRAYSIZE(npevent->u.character.text); ++i) { |
132 str += StringPrintf("%x ", npevent->u.character.text[i]); | 131 str += StringPrintf("%x ", npevent->u.character.text[i]); |
133 } | 132 } |
134 str += ", unmod: "; | 133 str += ", unmod: "; |
135 for (i = 0; i < arraysize(npevent->u.character.unmodifiedText); ++i) { | 134 for (i = 0; i < ARRAYSIZE(npevent->u.character.unmodifiedText); ++i) { |
136 str += StringPrintf("%x ", npevent->u.character.unmodifiedText[i]); | 135 str += StringPrintf("%x ", npevent->u.character.unmodifiedText[i]); |
137 } | 136 } |
138 break; | 137 break; |
139 case NPEventType_Minimize: | 138 case NPEventType_Minimize: |
140 case NPEventType_Focus: | 139 case NPEventType_Focus: |
141 case NPEventType_Device: | 140 case NPEventType_Device: |
142 break; | 141 break; |
143 case NPEventType_Undefined: | 142 case NPEventType_Undefined: |
144 default: | 143 default: |
145 break; | 144 break; |
(...skipping 28 matching lines...) Expand all Loading... |
174 return; | 173 return; |
175 } | 174 } |
176 size_t len; | 175 size_t len; |
177 char* name = string_duplicate(cstr, &len); | 176 char* name = string_duplicate(cstr, &len); |
178 if (NULL == name) { | 177 if (NULL == name) { |
179 STRINGN_TO_NPVARIANT(NULL, 0, *var); | 178 STRINGN_TO_NPVARIANT(NULL, 0, *var); |
180 return; | 179 return; |
181 } | 180 } |
182 STRINGN_TO_NPVARIANT(name, len, *var); | 181 STRINGN_TO_NPVARIANT(name, len, *var); |
183 } | 182 } |
OLD | NEW |