| 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" |
| 31 #include "base/logging.h" | 32 #include "base/logging.h" |
| 32 #include "base/string_util.h" | 33 #include "base/string_util.h" |
| 33 #include "webkit/tools/pepper_test_plugin/plugin_object.h" | 34 #include "webkit/tools/pepper_test_plugin/plugin_object.h" |
| 34 | 35 |
| 35 EventHandler* event_handler = NULL; | 36 EventHandler* event_handler = NULL; |
| 36 | 37 |
| 37 // EventHandler ---------------------------------------------------------------- | 38 // EventHandler ---------------------------------------------------------------- |
| 38 | 39 |
| 39 EventHandler::EventHandler(NPP npp) | 40 EventHandler::EventHandler(NPP npp) |
| 40 : npp_(npp), | 41 : npp_(npp), |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 case NPEventType_KeyDown: | 121 case NPEventType_KeyDown: |
| 121 case NPEventType_KeyUp: | 122 case NPEventType_KeyUp: |
| 122 str += StringPrintf(": mod %x, key: %x", | 123 str += StringPrintf(": mod %x, key: %x", |
| 123 npevent->u.key.modifier, | 124 npevent->u.key.modifier, |
| 124 npevent->u.key.normalizedKeyCode); | 125 npevent->u.key.normalizedKeyCode); |
| 125 break; | 126 break; |
| 126 case NPEventType_Char: | 127 case NPEventType_Char: |
| 127 str += StringPrintf(": mod %x, text: ", | 128 str += StringPrintf(": mod %x, text: ", |
| 128 npevent->u.character.modifier); | 129 npevent->u.character.modifier); |
| 129 size_t i; | 130 size_t i; |
| 130 for (i = 0; i < ARRAYSIZE(npevent->u.character.text); ++i) { | 131 for (i = 0; i < arraysize(npevent->u.character.text); ++i) { |
| 131 str += StringPrintf("%x ", npevent->u.character.text[i]); | 132 str += StringPrintf("%x ", npevent->u.character.text[i]); |
| 132 } | 133 } |
| 133 str += ", unmod: "; | 134 str += ", unmod: "; |
| 134 for (i = 0; i < ARRAYSIZE(npevent->u.character.unmodifiedText); ++i) { | 135 for (i = 0; i < arraysize(npevent->u.character.unmodifiedText); ++i) { |
| 135 str += StringPrintf("%x ", npevent->u.character.unmodifiedText[i]); | 136 str += StringPrintf("%x ", npevent->u.character.unmodifiedText[i]); |
| 136 } | 137 } |
| 137 break; | 138 break; |
| 138 case NPEventType_Minimize: | 139 case NPEventType_Minimize: |
| 139 case NPEventType_Focus: | 140 case NPEventType_Focus: |
| 140 case NPEventType_Device: | 141 case NPEventType_Device: |
| 141 break; | 142 break; |
| 142 case NPEventType_Undefined: | 143 case NPEventType_Undefined: |
| 143 default: | 144 default: |
| 144 break; | 145 break; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 173 return; | 174 return; |
| 174 } | 175 } |
| 175 size_t len; | 176 size_t len; |
| 176 char* name = string_duplicate(cstr, &len); | 177 char* name = string_duplicate(cstr, &len); |
| 177 if (NULL == name) { | 178 if (NULL == name) { |
| 178 STRINGN_TO_NPVARIANT(NULL, 0, *var); | 179 STRINGN_TO_NPVARIANT(NULL, 0, *var); |
| 179 return; | 180 return; |
| 180 } | 181 } |
| 181 STRINGN_TO_NPVARIANT(name, len, *var); | 182 STRINGN_TO_NPVARIANT(name, len, *var); |
| 182 } | 183 } |
| OLD | NEW |