blob: 3b455ffc4cc6189b0c5f7219c32e996a80c22a69 [file] [log] [blame]
jat@google.com134be542009-08-03 15:30:11 +00001#ifndef _H_mozincludes
2#define _H_mozincludes
3
4// Defines private prototypes for copy constructor and assigment operator. Do
5// not implement these methods.
6#define DISALLOW_EVIL_CONSTRUCTORS(CLASS) \
7 private: \
8 CLASS(const CLASS&); \
9 CLASS& operator=(const CLASS&)
10
11#include "npapi/npapi.h"
12#include "npapi/nphostapi.h"
13#include "npapi/npruntime.h"
14
15void SetNPNFuncs(NPNetscapeFuncs* npnFuncs);
16const NPNetscapeFuncs& GetNPNFuncs();
17
18#include "NPObjectWrapper.h"
19
20inline const NPUTF8 *GetNPStringUTF8Characters(const NPString &npstr) {
21 return npstr.UTF8Characters;
22}
23
24inline uint32 GetNPStringUTF8Length(const NPString &npstr) {
25 return npstr.UTF8Length;
26}
27
28// Convenience wrappers to make an NPVariant from various string types.
29#define STDSTRING_TO_NPVARIANT(str, var) \
30 STRINGN_TO_NPVARIANT(str.data(), static_cast<uint32_t>(str.length()), var)
31
32#define NPSTRING_TO_NPVARIANT(npstr, var) \
33 STRINGN_TO_NPVARIANT(GetNPStringUTF8Characters(npstr), \
34 GetNPStringUTF8Length(npstr), var)
35
36#ifdef LINUX
37#define OSCALL /**/
38#define WINAPI /**/
39#define DLLEXP /**/
40#define NPINIT_ARG(argname) , NPPluginFuncs* argname
41#define NPINIT_GETS_ENTRYPOINTS
42#define NP_SHUTDOWN_RETURN_TYPE NPError
43#define NP_SHUTDOWN_RETURN(val) (val)
44#endif
45
46#ifdef _WINDOWS
47#define DLLEXP __declspec(dllexport)
48#define NPINIT_ARG(argname) /**/
49#define NP_SHUTDOWN_RETURN_TYPE NPError
50#define NP_SHUTDOWN_RETURN(val) (val)
51#endif
52
53#ifdef __mac
54#define OSCALL /**/
55#define WINAPI /**/
56#define DLLEXP /**/
57#define NPINIT_ARG(argname) /**/
58#define NP_SHUTDOWN_RETURN_TYPE void
59#define NP_SHUTDOWN_RETURN(val) /**/
60typedef void (* NP_LOADDS NPP_ShutdownUPP)(void); // from npupp.h
61#endif
62
63#endif