| OLD | NEW |
| 1 /* | 1 /* |
| 2 IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Ap
ple") in | 2 IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Ap
ple") in |
| 3 consideration of your agreement to the following terms, and your use, installat
ion, | 3 consideration of your agreement to the following terms, and your use, installat
ion, |
| 4 modification or redistribution of this Apple software constitutes acceptance of
these | 4 modification or redistribution of this Apple software constitutes acceptance of
these |
| 5 terms. If you do not agree with these terms, please do not use, install, modif
y or | 5 terms. If you do not agree with these terms, please do not use, install, modif
y or |
| 6 redistribute this Apple software. | 6 redistribute this Apple software. |
| 7 | 7 |
| 8 In consideration of your agreement to abide by the following terms, and subject
to these | 8 In consideration of your agreement to abide by the following terms, and subject
to these |
| 9 terms, Apple grants you a personal, non-exclusive license, under Apple’s copyri
ghts in | 9 terms, Apple grants you a personal, non-exclusive license, under Apple’s copyri
ghts in |
| 10 this original Apple software (the "Apple Software"), to use, reproduce, modify
and | 10 this original Apple software (the "Apple Software"), to use, reproduce, modify
and |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include <wtf/Platform.h> | 36 #include <wtf/Platform.h> |
| 37 #include "PluginObject.h" | 37 #include "PluginObject.h" |
| 38 | 38 |
| 39 #ifdef WIN32 | 39 #ifdef WIN32 |
| 40 #define strcasecmp _stricmp | 40 #define strcasecmp _stricmp |
| 41 #define NPAPI WINAPI | 41 #define NPAPI WINAPI |
| 42 #else | 42 #else |
| 43 #define NPAPI | 43 #define NPAPI |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 #if defined(__GNUC__) && __GNUC__ >= 4 |
| 47 #define EXPORT __attribute__((visibility ("default"))) |
| 48 #else |
| 49 #define EXPORT |
| 50 #endif |
| 51 |
| 46 #if defined(OS_LINUX) | 52 #if defined(OS_LINUX) |
| 47 #include <X11/Xlib.h> | 53 #include <X11/Xlib.h> |
| 48 #endif | 54 #endif |
| 49 | 55 |
| 50 static void log(NPP instance, const char* format, ...) | 56 static void log(NPP instance, const char* format, ...) |
| 51 { | 57 { |
| 52 va_list args; | 58 va_list args; |
| 53 va_start(args, format); | 59 va_start(args, format); |
| 54 char message[2048] = "PLUGIN: "; | 60 char message[2048] = "PLUGIN: "; |
| 55 vsprintf(message + strlen(message), format, args); | 61 vsprintf(message + strlen(message), format, args); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 82 return; | 88 return; |
| 83 } | 89 } |
| 84 | 90 |
| 85 browser->releasevariantvalue(&result); | 91 browser->releasevariantvalue(&result); |
| 86 browser->releaseobject(consoleObject); | 92 browser->releaseobject(consoleObject); |
| 87 browser->releaseobject(windowObject); | 93 browser->releaseobject(windowObject); |
| 88 } | 94 } |
| 89 | 95 |
| 90 // Plugin entry points | 96 // Plugin entry points |
| 91 extern "C" { | 97 extern "C" { |
| 92 NPError NPAPI NP_Initialize(NPNetscapeFuncs *browserFuncs | 98 EXPORT NPError NPAPI NP_Initialize(NPNetscapeFuncs *browserFuncs |
| 93 #if defined(OS_LINUX) | 99 #if defined(OS_LINUX) |
| 94 , NPPluginFuncs *pluginFuncs | 100 , NPPluginFuncs *pluginFuncs |
| 95 #endif | 101 #endif |
| 96 ); | 102 ); |
| 97 NPError NPAPI NP_GetEntryPoints(NPPluginFuncs *pluginFuncs); | 103 EXPORT NPError NPAPI NP_GetEntryPoints(NPPluginFuncs *pluginFuncs); |
| 98 void NPAPI NP_Shutdown(void); | 104 EXPORT void NPAPI NP_Shutdown(void); |
| 99 | 105 |
| 100 #if defined(OS_LINUX) | 106 #if defined(OS_LINUX) |
| 101 NPError NP_GetValue(NPP instance, NPPVariable variable, void *value); | 107 EXPORT NPError NPAPI NP_GetValue(NPP instance, NPPVariable variable, void *v
alue); |
| 102 const char* NP_GetMIMEDescription(void); | 108 EXPORT const char* NPAPI NP_GetMIMEDescription(void); |
| 103 #endif | 109 #endif |
| 104 } | 110 } |
| 105 | 111 |
| 106 // Plugin entry points | 112 // Plugin entry points |
| 107 NPError NPAPI NP_Initialize(NPNetscapeFuncs *browserFuncs | 113 EXPORT NPError NPAPI NP_Initialize(NPNetscapeFuncs *browserFuncs |
| 108 #if defined(OS_LINUX) | 114 #if defined(OS_LINUX) |
| 109 , NPPluginFuncs *pluginFuncs | 115 , NPPluginFuncs *pluginFuncs |
| 110 #endif | 116 #endif |
| 111 ) | 117 ) |
| 112 { | 118 { |
| 113 browser = browserFuncs; | 119 browser = browserFuncs; |
| 114 #if defined(OS_LINUX) | 120 #if defined(OS_LINUX) |
| 115 return NP_GetEntryPoints(pluginFuncs); | 121 return NP_GetEntryPoints(pluginFuncs); |
| 116 #else | 122 #else |
| 117 return NPERR_NO_ERROR; | 123 return NPERR_NO_ERROR; |
| 118 #endif | 124 #endif |
| 119 } | 125 } |
| 120 | 126 |
| 121 NPError NPAPI NP_GetEntryPoints(NPPluginFuncs *pluginFuncs) | 127 EXPORT NPError NPAPI NP_GetEntryPoints(NPPluginFuncs *pluginFuncs) |
| 122 { | 128 { |
| 123 pluginFuncs->version = 11; | 129 pluginFuncs->version = 11; |
| 124 pluginFuncs->size = sizeof(pluginFuncs); | 130 pluginFuncs->size = sizeof(pluginFuncs); |
| 125 pluginFuncs->newp = NPP_New; | 131 pluginFuncs->newp = NPP_New; |
| 126 pluginFuncs->destroy = NPP_Destroy; | 132 pluginFuncs->destroy = NPP_Destroy; |
| 127 pluginFuncs->setwindow = NPP_SetWindow; | 133 pluginFuncs->setwindow = NPP_SetWindow; |
| 128 pluginFuncs->newstream = NPP_NewStream; | 134 pluginFuncs->newstream = NPP_NewStream; |
| 129 pluginFuncs->destroystream = NPP_DestroyStream; | 135 pluginFuncs->destroystream = NPP_DestroyStream; |
| 130 pluginFuncs->asfile = NPP_StreamAsFile; | 136 pluginFuncs->asfile = NPP_StreamAsFile; |
| 131 pluginFuncs->writeready = NPP_WriteReady; | 137 pluginFuncs->writeready = NPP_WriteReady; |
| 132 pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write; | 138 pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write; |
| 133 pluginFuncs->print = NPP_Print; | 139 pluginFuncs->print = NPP_Print; |
| 134 pluginFuncs->event = NPP_HandleEvent; | 140 pluginFuncs->event = NPP_HandleEvent; |
| 135 pluginFuncs->urlnotify = NPP_URLNotify; | 141 pluginFuncs->urlnotify = NPP_URLNotify; |
| 136 pluginFuncs->getvalue = NPP_GetValue; | 142 pluginFuncs->getvalue = NPP_GetValue; |
| 137 pluginFuncs->setvalue = NPP_SetValue; | 143 pluginFuncs->setvalue = NPP_SetValue; |
| 138 | 144 |
| 139 return NPERR_NO_ERROR; | 145 return NPERR_NO_ERROR; |
| 140 } | 146 } |
| 141 | 147 |
| 142 void NPAPI NP_Shutdown(void) | 148 EXPORT void NPAPI NP_Shutdown(void) |
| 143 { | 149 { |
| 144 } | 150 } |
| 145 | 151 |
| 146 static void executeScript(const PluginObject* obj, const char* script); | 152 static void executeScript(const PluginObject* obj, const char* script); |
| 147 | 153 |
| 148 NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
ar *argn[], char *argv[], NPSavedData *saved) | 154 NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
ar *argn[], char *argv[], NPSavedData *saved) |
| 149 { | 155 { |
| 150 if (browser->version >= 14) { | 156 if (browser->version >= 14) { |
| 151 PluginObject* obj = (PluginObject*)browser->createobject(instance, getPl
uginClass()); | 157 PluginObject* obj = (PluginObject*)browser->createobject(instance, getPl
uginClass()); |
| 152 | 158 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 497 |
| 492 return err; | 498 return err; |
| 493 } | 499 } |
| 494 | 500 |
| 495 NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) | 501 NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) |
| 496 { | 502 { |
| 497 return NPERR_GENERIC_ERROR; | 503 return NPERR_GENERIC_ERROR; |
| 498 } | 504 } |
| 499 | 505 |
| 500 #if defined(OS_LINUX) | 506 #if defined(OS_LINUX) |
| 501 NPError NP_GetValue(NPP instance, NPPVariable variable, void *value) | 507 EXPORT NPError NPAPI NP_GetValue(NPP instance, NPPVariable variable, void *value
) |
| 502 { | 508 { |
| 503 return NPP_GetValue(instance, variable, value); | 509 return NPP_GetValue(instance, variable, value); |
| 504 } | 510 } |
| 505 | 511 |
| 506 const char* NP_GetMIMEDescription(void) { | 512 EXPORT const char* NPAPI NP_GetMIMEDescription(void) { |
| 507 // The layout test LayoutTests/fast/js/navigator-mimeTypes-length.html | 513 // The layout test LayoutTests/fast/js/navigator-mimeTypes-length.html |
| 508 // asserts that the number of mimetypes handled by plugins should be | 514 // asserts that the number of mimetypes handled by plugins should be |
| 509 // greater than the number of plugins. This isn't true if we're | 515 // greater than the number of plugins. This isn't true if we're |
| 510 // the only plugin and we only handle one mimetype, so specify | 516 // the only plugin and we only handle one mimetype, so specify |
| 511 // multiple mimetypes here. | 517 // multiple mimetypes here. |
| 512 return "application/x-webkit-test-netscape:testnetscape:test netscape conten
t;" | 518 return "application/x-webkit-test-netscape:testnetscape:test netscape conten
t;" |
| 513 "application/x-webkit-test-netscape2:testnetscape2:test netscape cont
ent2"; | 519 "application/x-webkit-test-netscape2:testnetscape2:test netscape cont
ent2"; |
| 514 } | 520 } |
| 515 #endif | 521 #endif |
| OLD | NEW |