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

Side by Side Diff: webkit/glue/plugins/test/npapi_test.cc

Issue 3129005: Added linux-specific NP_Initialize function so that the plugin is properly in... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // 5 //
6 // npapitest 6 // npapitest
7 // 7 //
8 // This is a NPAPI Plugin Program which is used to test the Browser's NPAPI 8 // This is a NPAPI Plugin Program which is used to test the Browser's NPAPI
9 // host implementation. It is used in conjunction with the npapi_unittest. 9 // host implementation. It is used in conjunction with the npapi_unittest.
10 // 10 //
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 BOOL API_CALL DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved) { 59 BOOL API_CALL DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved) {
60 return TRUE; 60 return TRUE;
61 } 61 }
62 #endif 62 #endif
63 63
64 extern "C" { 64 extern "C" {
65 EXPORT NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* pFuncs) { 65 EXPORT NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* pFuncs) {
66 return NPAPIClient::PluginClient::GetEntryPoints(pFuncs); 66 return NPAPIClient::PluginClient::GetEntryPoints(pFuncs);
67 } 67 }
68 68
69 EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* pFuncs) {
70 return NPAPIClient::PluginClient::Initialize(pFuncs);
71 }
72
73 EXPORT NPError API_CALL NP_Shutdown() { 69 EXPORT NPError API_CALL NP_Shutdown() {
74 return NPAPIClient::PluginClient::Shutdown(); 70 return NPAPIClient::PluginClient::Shutdown();
75 } 71 }
76 72
77 #if defined(OS_POSIX) && !defined(OS_MACOSX) 73 #if defined(OS_WIN) || defined(OS_MACOSX)
74 EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnFuncs) {
75 return NPAPIClient::PluginClient::Initialize(npnFuncs);
76 }
77 #elif defined(OS_POSIX)
78 EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnFuncs,
79 NPPluginFuncs* nppFuncs) {
80 NPError error = NPAPIClient::PluginClient::Initialize(npnFuncs);
81 if (error == NPERR_NO_ERROR) {
82 error = NP_GetEntryPoints(nppFuncs);
83 }
84 return error;
85 }
86
87 EXPORT NPError API_CALL NP_GetValue(NPP instance, NPPVariable variable,
88 void* value) {
89 NPError err = NPERR_NO_ERROR;
90
91 switch (variable) {
92 case NPPVpluginNameString:
93 *(static_cast<const char**>(value)) = "NPAPI Test Plugin";
94 break;
95 case NPPVpluginDescriptionString:
96 *(static_cast<const char**>(value)) =
97 "Simple NPAPI plug-in for Chromium unit tests";
98 break;
99 case NPPVpluginNeedsXEmbed:
100 *(static_cast<NPBool*>(value)) = true;
101 break;
102 default:
103 err = NPERR_GENERIC_ERROR;
104 break;
105 }
106
107 return err;
108 }
109
78 EXPORT const char* API_CALL NP_GetMIMEDescription(void) { 110 EXPORT const char* API_CALL NP_GetMIMEDescription(void) {
79 // The layout test LayoutTests/fast/js/navigator-mimeTypes-length.html 111 // The layout test LayoutTests/fast/js/navigator-mimeTypes-length.html
80 // asserts that the number of mimetypes handled by plugins should be 112 // asserts that the number of mimetypes handled by plugins should be
81 // greater than the number of plugins. We specify a mimetype here so 113 // greater than the number of plugins. We specify a mimetype here so
82 // this plugin has at least one. 114 // this plugin has at least one.
83 return "application/x-npapi-test-netscape:npapitestnetscape:" 115 return "application/vnd.npapi-test:npapitest:test npapi";
84 "npapi test netscape content";
85 } 116 }
86 #endif 117 #endif // OS_POSIX
87 } // extern "C" 118 } // extern "C"
88 119
89 namespace WebCore { 120 namespace WebCore {
90 const char* currentTextBreakLocaleID() { return "en_us"; } 121 const char* currentTextBreakLocaleID() { return "en_us"; }
91 } 122 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698