Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: webkit/tools/pepper_test_plugin/main.cc

Issue 524051: Revert 35649 - Make Pepper plugins work on Linux.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 16 matching lines...) Expand all
27 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERV ICES; LOSS 27 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERV ICES; LOSS
28 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, 28 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
29 REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER C AUSED AND 29 REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER C AUSED AND
30 WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR 30 WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
31 OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34 #include <stdlib.h> 34 #include <stdlib.h>
35 #include <stdio.h> 35 #include <stdio.h>
36 36
37 #if defined(INDEPENDENT_PLUGIN)
38 #include <iostream>
39 #define LOG(x) std::cerr
40 #else
41 #include "base/logging.h" 37 #include "base/logging.h"
42 #include "base/string_util.h" 38 #include "base/string_util.h"
43 #endif
44 #include "webkit/glue/plugins/nphostapi.h"
45 #include "webkit/tools/pepper_test_plugin/plugin_object.h" 39 #include "webkit/tools/pepper_test_plugin/plugin_object.h"
46 #include "webkit/tools/pepper_test_plugin/event_handler.h" 40 #include "webkit/tools/pepper_test_plugin/event_handler.h"
47 41
48 #if __GNUC__ >= 4 42 #ifdef WIN32
49 #define EXPORT __attribute__ ((visibility("default"))) 43 #define NPAPI WINAPI
50 #elif defined(_MSC_VER) 44 #else
51 #define EXPORT __declspec(dllexport) 45 #define NPAPI
52 #endif 46 #endif
53 47
54 namespace { 48 namespace {
55 49
56 void Log(NPP instance, const char* format, ...) { 50 void Log(NPP instance, const char* format, ...) {
57 va_list args; 51 va_list args;
58 va_start(args, format); 52 va_start(args, format);
59 std::string message("PLUGIN: "); 53 std::string message("PLUGIN: ");
60 #if defined(INDEPENDENT_PLUGIN)
61 {
62 char msgbuf[100];
63 vsnprintf(msgbuf, 100, format, args);
64 }
65 #else
66 StringAppendV(&message, format, args); 54 StringAppendV(&message, format, args);
67 #endif
68 va_end(args); 55 va_end(args);
69 56
70 NPObject* window_object = 0; 57 NPObject* window_object = 0;
71 NPError error = browser->getvalue(instance, NPNVWindowNPObject, 58 NPError error = browser->getvalue(instance, NPNVWindowNPObject,
72 &window_object); 59 &window_object);
73 if (error != NPERR_NO_ERROR) { 60 if (error != NPERR_NO_ERROR) {
74 LOG(ERROR) << "Failed to retrieve window object while logging: " 61 LOG(ERROR) << "Failed to retrieve window object while logging: "
75 << message; 62 << message;
76 return; 63 return;
77 } 64 }
(...skipping 27 matching lines...) Expand all
105 browser->releasevariantvalue(&result); 92 browser->releasevariantvalue(&result);
106 browser->releaseobject(console_object); 93 browser->releaseobject(console_object);
107 browser->releaseobject(window_object); 94 browser->releaseobject(window_object);
108 } 95 }
109 96
110 } // namespace 97 } // namespace
111 98
112 // Plugin entry points 99 // Plugin entry points
113 extern "C" { 100 extern "C" {
114 101
115 EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs 102 #if defined(OS_WIN)
103 //__declspec(dllexport)
104 #endif
105 NPError NPAPI NP_Initialize(NPNetscapeFuncs* browser_funcs
116 #if defined(OS_LINUX) 106 #if defined(OS_LINUX)
117 , NPPluginFuncs* plugin_funcs 107 , NPPluginFuncs* plugin_funcs
118 #endif 108 #endif
119 ); 109 );
120 EXPORT NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* plugin_funcs); 110 #if defined(OS_WIN)
111 //__declspec(dllexport)
112 #endif
113 NPError NPAPI NP_GetEntryPoints(NPPluginFuncs* plugin_funcs);
121 114
122 EXPORT void API_CALL NP_Shutdown() { 115 #if defined(OS_WIN)
116 //__declspec(dllexport)
117 #endif
118 void NPAPI NP_Shutdown() {
123 } 119 }
124 120
125 #if defined(OS_LINUX) 121 #if defined(OS_LINUX)
126 EXPORT NPError API_CALL NP_GetValue(NPP instance, NPPVariable variable, void* va lue); 122 NPError NP_GetValue(NPP instance, NPPVariable variable, void* value);
127 EXPORT const char* API_CALL NP_GetMIMEDescription(); 123 const char* NP_GetMIMEDescription();
128 #endif 124 #endif
129 125
130 } // extern "C" 126 } // extern "C"
131 127
132 // Plugin entry points 128 // Plugin entry points
133 EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs 129 NPError NPAPI NP_Initialize(NPNetscapeFuncs* browser_funcs
134 #if defined(OS_LINUX) 130 #if defined(OS_LINUX)
135 , NPPluginFuncs* plugin_funcs 131 , NPPluginFuncs* plugin_funcs
136 #endif 132 #endif
137 ) { 133 ) {
138 browser = browser_funcs; 134 browser = browser_funcs;
139 #if defined(OS_LINUX) 135 #if defined(OS_LINUX)
140 return NP_GetEntryPoints(plugin_funcs); 136 return NP_GetEntryPoints(plugin_funcs);
141 #else 137 #else
142 return NPERR_NO_ERROR; 138 return NPERR_NO_ERROR;
143 #endif 139 #endif
144 } 140 }
145 141
146 // Entrypoints ----------------------------------------------------------------- 142 // Entrypoints -----------------------------------------------------------------
147 143
148 NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) { 144 NPError NPAPI NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) {
149 plugin_funcs->version = 11; 145 plugin_funcs->version = 11;
150 plugin_funcs->size = sizeof(plugin_funcs); 146 plugin_funcs->size = sizeof(plugin_funcs);
151 plugin_funcs->newp = NPP_New; 147 plugin_funcs->newp = NPP_New;
152 plugin_funcs->destroy = NPP_Destroy; 148 plugin_funcs->destroy = NPP_Destroy;
153 plugin_funcs->setwindow = NPP_SetWindow; 149 plugin_funcs->setwindow = NPP_SetWindow;
154 plugin_funcs->newstream = NPP_NewStream; 150 plugin_funcs->newstream = NPP_NewStream;
155 plugin_funcs->destroystream = NPP_DestroyStream; 151 plugin_funcs->destroystream = NPP_DestroyStream;
156 plugin_funcs->asfile = NPP_StreamAsFile; 152 plugin_funcs->asfile = NPP_StreamAsFile;
157 plugin_funcs->writeready = NPP_WriteReady; 153 plugin_funcs->writeready = NPP_WriteReady;
158 plugin_funcs->write = (NPP_WriteProcPtr)NPP_Write; 154 plugin_funcs->write = (NPP_WriteProcPtr)NPP_Write;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 } 264 }
269 265
270 return err; 266 return err;
271 } 267 }
272 268
273 NPError NPP_SetValue(NPP instance, NPNVariable variable, void* value) { 269 NPError NPP_SetValue(NPP instance, NPNVariable variable, void* value) {
274 return NPERR_GENERIC_ERROR; 270 return NPERR_GENERIC_ERROR;
275 } 271 }
276 272
277 #if defined(OS_LINUX) 273 #if defined(OS_LINUX)
278 NPError API_CALL NP_GetValue(NPP instance, NPPVariable variable, void* value) { 274 NPError NP_GetValue(NPP instance, NPPVariable variable, void* value) {
279 return NPP_GetValue(instance, variable, value); 275 return NPP_GetValue(instance, variable, value);
280 } 276 }
281 277
282 const char* API_CALL NP_GetMIMEDescription() { 278 const char* NP_GetMIMEDescription() {
283 return "pepper-application/x-pepper-test-plugin::Pepper Test"; 279 return "pepper-application/x-pepper-test-plugin pepper test;";
284 } 280 }
285 #endif 281 #endif
OLDNEW
« no previous file with comments | « webkit/tools/pepper_test_plugin/event_handler.cc ('k') | webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698