NPAPI Support

Native Client modules can communicate with the browser using either NPAPI or simple RPC (SRPC). This document lists the NPAPI functions that Native Client modules can and cannot use.

See also: Mozilla Plugins documentation and Gecko Plugin API Reference

Contents

Native Client only: nacl_npapi.h

For information on these functions and on other API defined in nacl/nacl_npapi.h, see the nacl_npapi.h reference doc.

int NaClNP_Init(int* argc, char* argv[]);
int NaClNP_MainLoop(unsigned flags);
NPObject* NaClNPN_CreateArray(NPP npp);
NPError NaClNPN_OpenURL(NPP npp, const char* url, void* notify_data,
                        void (*notify)(const char* url, void* notify_data,
                                       int handle));
NPVARIANT_IS_HANDLE(_v)
NPVARIANT_TO_HANDLE(_v)
HANDLE_TO_NPVARIANT(_val, _v)

npapi.h

API defined in the file nacl/nacl_npapi.h.

Implemented

NPError NPN_GetValue(NPP instance, NPNVariable variable, void *value);
void*   NPN_MemAlloc(uint32_t size);
void    NPN_MemFree(void* ptr);
void    NPN_Status(NPP instance, const char* message);
void    NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
void    NPN_ForceRedraw(NPP instance);

Not implemented

void    NPN_Version(int* plugin_major, int* plugin_minor,
NPError NPN_GetURLNotify(NPP instance, const char* url,
NPError NPN_GetURL(NPP instance, const char* url,
NPError NPN_PostURLNotify(NPP instance, const char* url,
NPError NPN_PostURL(NPP instance, const char* url,
NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
NPError NPN_NewStream(NPP instance, NPMIMEType type,
int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer);
NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
const char* NPN_UserAgent(NPP instance);
uint32_t NPN_MemFlush(uint32_t size);
void    NPN_ReloadPlugins(NPBool reloadPages);
JRIEnv* NPN_GetJavaEnv(void);
jref    NPN_GetJavaPeer(NPP instance);
NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value);
void    NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion);
void    NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
void    NPN_PopPopupsEnabledState(NPP instance);
void    NPN_PluginThreadAsyncCall(NPP instance,

npruntime.h

API defined in the file nacl/nacl_npruntime.h.

Implemented

NPObject *NPN_CreateObject(NPP npp, NPClass *aClass);
NPIdentifier NPN_GetIntIdentifier(int32_t intid);
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name);
void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
NPObject *NPN_RetainObject(NPObject *npobj);
NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier);
bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName);
bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool NPN_IdentifierIsString(NPIdentifier identifier);
bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName,
int32_t NPN_IntFromIdentifier(NPIdentifier identifier);
bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args,
void NPN_ReleaseObject(NPObject *npobj);
void NPN_ReleaseVariantValue(NPVariant *variant);
bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
void NPN_SetException(NPObject *npobj, const NPUTF8 *message);

Not implemented

bool NPN_Construct(NPP npp, NPObject *npobj, const NPVariant *args,
bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier,
bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script, [PENDING:...]

Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution 2.5 license.