16c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
28e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
36c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen * Copyright (c) 2004, Apple Computer, Inc. and The Mozilla Foundation.
48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * All rights reserved.
58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Redistribution and use in source and binary forms, with or without
78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modification, are permitted provided that the following conditions are
88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * met:
98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1. Redistributions of source code must retain the above copyright
118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer.
128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright
138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer in the
148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * documentation and/or other materials provided with the distribution.
158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla
168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Foundation ("Mozilla") nor the names of their contributors may be used
178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * to endorse or promote products derived from this software without
188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * specific prior written permission.
198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS
218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR
248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */
338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifndef _NP_RUNTIME_H_
348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define _NP_RUNTIME_H_
358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#include "npapi.h"
3765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifdef __cplusplus
398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectextern "C" {
408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif
418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    This API is used to facilitate binding code written in C to script
448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    objects.  The API in this header does not assume the presence of a
458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    user agent.  That is, it can be used to bind C code to scripting
468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    environments outside of the context of a user agent.
478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    However, the normal use of the this API is in the context of a
498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    scripting environment running in a browser or other user agent.
508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    In particular it is used to support the extended Netscape
518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    script-ability API for plugins (NP-SAP).  NP-SAP is an extension
528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    of the Netscape plugin API.  As such we have adopted the use of
538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    the "NP" prefix for this API.
548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    The following NP{N|P}Variables were added to the Netscape plugin
568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    API (in npapi.h):
578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPNVWindowNPObject
598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPNVPluginElementNPObject
608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPPVpluginScriptableNPObject
618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    These variables are exposed through NPN_GetValue() and
638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPP_GetValue() (respectively) and are used to establish the
648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    initial binding between the user agent and native code.  The DOM
658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    objects in the user agent can be examined and manipulated using
668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    the NPN_ functions that operate on NPObjects described in this
678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    header.
688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    To the extent possible the assumptions about the scripting
708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    language used by the scripting environment have been minimized.
718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
736c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen#define NP_BEGIN_MACRO  do {
746c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen#define NP_END_MACRO    } while (0)
758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    Objects (non-primitive data) passed between 'C' and script is
788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    always wrapped in an NPObject.  The 'interface' of an NPObject is
798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    described by an NPClass.
808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef struct NPObject NPObject;
828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef struct NPClass NPClass;
838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef char NPUTF8;
858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef struct _NPString {
868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    const NPUTF8 *UTF8Characters;
878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    uint32_t UTF8Length;
888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} NPString;
896c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef enum {
918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPVariantType_Void,
928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPVariantType_Null,
938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPVariantType_Bool,
948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPVariantType_Int32,
958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPVariantType_Double,
968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPVariantType_String,
978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPVariantType_Object
988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} NPVariantType;
998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef struct _NPVariant {
1018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPVariantType type;
1028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    union {
1038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        bool boolValue;
1048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        int32_t intValue;
1058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        double doubleValue;
1068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        NPString stringValue;
1078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        NPObject *objectValue;
1088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    } value;
1098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} NPVariant;
1108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
1126c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    NPN_ReleaseVariantValue is called on all 'out' parameters
1136c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    references.  Specifically it is to be called on variants that own
1146c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    their value, as is the case with all non-const NPVariant*
1156c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    arguments after a successful call to any methods (except this one)
1166c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    in this API.
1176c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
1186c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    After calling NPN_ReleaseVariantValue, the type of the variant
1196c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    will be NPVariantType_Void.
1208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
1216c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenvoid NPN_ReleaseVariantValue(NPVariant *variant);
1228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NPVARIANT_IS_VOID(_v)    ((_v).type == NPVariantType_Void)
1248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NPVARIANT_IS_NULL(_v)    ((_v).type == NPVariantType_Null)
1258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool)
1268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NPVARIANT_IS_INT32(_v)   ((_v).type == NPVariantType_Int32)
1278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NPVARIANT_IS_DOUBLE(_v)  ((_v).type == NPVariantType_Double)
1288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NPVARIANT_IS_STRING(_v)  ((_v).type == NPVariantType_String)
1298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NPVARIANT_IS_OBJECT(_v)  ((_v).type == NPVariantType_Object)
1308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue)
1328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NPVARIANT_TO_INT32(_v)   ((_v).value.intValue)
1338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NPVARIANT_TO_DOUBLE(_v)  ((_v).value.doubleValue)
1348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NPVARIANT_TO_STRING(_v)  ((_v).value.stringValue)
1358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NPVARIANT_TO_OBJECT(_v)  ((_v).value.objectValue)
1368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1376c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen#define VOID_TO_NPVARIANT(_v)                                                 \
1386c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_BEGIN_MACRO                                                                \
1396c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).type = NPVariantType_Void;                                           \
1406c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).value.objectValue = NULL;                                            \
1416c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_END_MACRO
1426c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
1436c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen#define NULL_TO_NPVARIANT(_v)                                                 \
1446c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_BEGIN_MACRO                                                                \
1456c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).type = NPVariantType_Null;                                           \
1466c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).value.objectValue = NULL;                                            \
1476c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_END_MACRO
1486c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
1496c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen#define BOOLEAN_TO_NPVARIANT(_val, _v)                                        \
1506c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_BEGIN_MACRO                                                                \
1516c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).type = NPVariantType_Bool;                                           \
1526c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).value.boolValue = !!(_val);                                          \
1536c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_END_MACRO
1546c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
1556c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen#define INT32_TO_NPVARIANT(_val, _v)                                          \
1566c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_BEGIN_MACRO                                                                \
1576c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).type = NPVariantType_Int32;                                          \
1586c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).value.intValue = _val;                                               \
1596c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_END_MACRO
1606c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
1616c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen#define DOUBLE_TO_NPVARIANT(_val, _v)                                         \
1626c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_BEGIN_MACRO                                                                \
1636c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).type = NPVariantType_Double;                                         \
1646c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).value.doubleValue = _val;                                            \
1656c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_END_MACRO
1666c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
1676c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen#define STRINGZ_TO_NPVARIANT(_val, _v)                                        \
1686c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_BEGIN_MACRO                                                                \
1696c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).type = NPVariantType_String;                                         \
1706c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    NPString str = { _val, uint32_t(strlen(_val)) };                          \
1716c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).value.stringValue = str;                                             \
1726c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_END_MACRO
1736c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
1746c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen#define STRINGN_TO_NPVARIANT(_val, _len, _v)                                  \
1756c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_BEGIN_MACRO                                                                \
1766c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).type = NPVariantType_String;                                         \
1776c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    NPString str = { _val, uint32_t(_len) };                                  \
1786c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).value.stringValue = str;                                             \
1796c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_END_MACRO
1806c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
1816c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen#define OBJECT_TO_NPVARIANT(_val, _v)                                         \
1826c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_BEGIN_MACRO                                                                \
1836c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).type = NPVariantType_Object;                                         \
1846c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    (_v).value.objectValue = _val;                                            \
1856c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNP_END_MACRO
1868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
1896c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  Type mappings (JavaScript types have been used for illustration
1908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    purposes):
1918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1926c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  JavaScript       to             C (NPVariant with type:)
1936c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  undefined                       NPVariantType_Void
1946c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  null                            NPVariantType_Null
1956c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  Boolean                         NPVariantType_Bool
1966c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  Number                          NPVariantType_Double or NPVariantType_Int32
1976c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  String                          NPVariantType_String
1986c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  Object                          NPVariantType_Object
1996c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
2006c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  C (NPVariant with type:)   to   JavaScript
2016c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  NPVariantType_Void              undefined
2026c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  NPVariantType_Null              null
2036c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  NPVariantType_Bool              Boolean
2046c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  NPVariantType_Int32             Number
2056c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  NPVariantType_Double            Number
2066c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  NPVariantType_String            String
2076c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen  NPVariantType_Object            Object
2088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
2098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef void *NPIdentifier;
2118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
2138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPObjects have methods and properties.  Methods and properties are
2148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    identified with NPIdentifiers.  These identifiers may be reflected
2158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    in script.  NPIdentifiers can be either strings or integers, IOW,
2168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    methods and properties can be identified by either strings or
2178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be
2188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    compared using ==.  In case of any errors, the requested
2196c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    NPIdentifier(s) will be NULL. NPIdentifier lifetime is controlled
2206c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    by the browser. Plugins do not need to worry about memory management
2216c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    with regards to NPIdentifiers.
2228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
2238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectNPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name);
2246c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenvoid NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
2256c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                              NPIdentifier *identifiers);
2268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectNPIdentifier NPN_GetIntIdentifier(int32_t intid);
2278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectbool NPN_IdentifierIsString(NPIdentifier identifier);
2288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
2308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed.
2318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
2328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectNPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier);
2338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
2358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    Get the integer represented by identifier. If identifier is not an
2368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    integer identifier, the behaviour is undefined.
2378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
2388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectint32_t NPN_IntFromIdentifier(NPIdentifier identifier);
2398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
2418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPObject behavior is implemented using the following set of
2428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    callback functions.
2438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    The NPVariant *result argument of these functions (where
2458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    applicable) should be released using NPN_ReleaseVariantValue().
2468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
2478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass);
2486c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsentypedef void (*NPDeallocateFunctionPtr)(NPObject *npobj);
2496c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsentypedef void (*NPInvalidateFunctionPtr)(NPObject *npobj);
2506c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsentypedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name);
2516c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsentypedef bool (*NPInvokeFunctionPtr)(NPObject *npobj, NPIdentifier name,
2526c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                                    const NPVariant *args, uint32_t argCount,
2536c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                                    NPVariant *result);
2546c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsentypedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj,
2556c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                                           const NPVariant *args,
2566c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                                           uint32_t argCount,
2576c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                                           NPVariant *result);
2586c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsentypedef bool (*NPHasPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name);
2596c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsentypedef bool (*NPGetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
2606c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                                         NPVariant *result);
2616c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsentypedef bool (*NPSetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
2626c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                                         const NPVariant *value);
2636c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsentypedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj,
2646c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                                            NPIdentifier name);
2656c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsentypedef bool (*NPEnumerationFunctionPtr)(NPObject *npobj, NPIdentifier **value,
2666c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                                         uint32_t *count);
2676c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsentypedef bool (*NPConstructFunctionPtr)(NPObject *npobj,
2686c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                                       const NPVariant *args,
2696c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                                       uint32_t argCount,
2706c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                                       NPVariant *result);
2718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
2736c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    NPObjects returned by create, retain, invoke, and getProperty pass
2746c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    a reference count to the caller.  That is, the callee adds a
2756c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    reference count which passes to the caller.  It is the caller's
2766c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    responsibility to release the returned object.
2776c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
2786c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    NPInvokeFunctionPtr function may return 0 to indicate a void
2796c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    result.
2806c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
2816c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    NPInvalidateFunctionPtr is called by the scripting environment
2826c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    when the native code is shutdown.  Any attempt to message a
2836c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    NPObject instance after the invalidate callback has been
2846c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    called will result in undefined behavior, even if the native code
2856c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    is still retaining those NPObject instances.  (The runtime
2866c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    will typically return immediately, with 0 or NULL, from an attempt
2876c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    to dispatch to a NPObject, but this behavior should not be
2886c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    depended upon.)
2896c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
2906c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    The NPEnumerationFunctionPtr function may pass an array of
2916c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    NPIdentifiers back to the caller. The callee allocs the memory of
2926c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    the array using NPN_MemAlloc(), and it's the caller's responsibility
2936c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    to release it using NPN_MemFree().
2948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
2958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectstruct NPClass
2968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
2978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    uint32_t structVersion;
2988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPAllocateFunctionPtr allocate;
2998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPDeallocateFunctionPtr deallocate;
3008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPInvalidateFunctionPtr invalidate;
3018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPHasMethodFunctionPtr hasMethod;
3028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPInvokeFunctionPtr invoke;
3038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPInvokeDefaultFunctionPtr invokeDefault;
3048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPHasPropertyFunctionPtr hasProperty;
3058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPGetPropertyFunctionPtr getProperty;
3068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPSetPropertyFunctionPtr setProperty;
3078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPRemovePropertyFunctionPtr removeProperty;
3088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPEnumerationFunctionPtr enumerate;
3098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPConstructFunctionPtr construct;
3108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project};
3118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NP_CLASS_STRUCT_VERSION      3
3136c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
3148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NP_CLASS_STRUCT_VERSION_ENUM 2
3158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NP_CLASS_STRUCT_VERSION_CTOR 3
3168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NP_CLASS_STRUCT_VERSION_HAS_ENUM(npclass)   \
3186c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen        ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_ENUM)
3196c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
3208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define NP_CLASS_STRUCT_VERSION_HAS_CTOR(npclass)   \
3216c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen        ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR)
3228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectstruct NPObject {
3248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NPClass *_class;
3258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    uint32_t referenceCount;
3266c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    /*
3276c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen     * Additional space may be allocated here by types of NPObjects
3286c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen     */
3298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project};
3308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
3326c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    If the class has an allocate function, NPN_CreateObject invokes
3336c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    that function, otherwise a NPObject is allocated and
3346c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    returned. This method will initialize the referenceCount member of
3356c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    the NPObject to 1.
3368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
3378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectNPObject *NPN_CreateObject(NPP npp, NPClass *aClass);
3388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
3408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    Increment the NPObject's reference count.
3418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
3426c2af9490927c3c5959b5cb07461b646f8b32f6cKristian MonsenNPObject *NPN_RetainObject(NPObject *npobj);
3438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
3458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    Decremented the NPObject's reference count.  If the reference
3468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    count goes to zero, the class's destroy function is invoke if
3478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    specified, otherwise the object is freed directly.
3488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
3496c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenvoid NPN_ReleaseObject(NPObject *npobj);
3508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
3528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    Functions to access script objects represented by NPObject.
3538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    Calls to script objects are synchronous.  If a function returns a
3558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    value, it will be supplied via the result NPVariant
3568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    argument. Successful calls will return true, false will be
3578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    returned in case of an error.
3588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    Calls made from plugin code to script must be made from the thread
3608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    on which the plugin was initialized.
3618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
3626c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
3636c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenbool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName,
3646c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                const NPVariant *args, uint32_t argCount, NPVariant *result);
3656c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenbool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args,
3666c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                       uint32_t argCount, NPVariant *result);
3676c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenbool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script,
3686c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                  NPVariant *result);
3696c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenbool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
3706c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                     NPVariant *result);
3716c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenbool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
3726c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                     const NPVariant *value);
3738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectbool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
3748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectbool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
3758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectbool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName);
3766c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenbool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier,
3776c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                   uint32_t *count);
3786c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenbool NPN_Construct(NPP npp, NPObject *npobj, const NPVariant *args,
3796c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen                   uint32_t argCount, NPVariant *result);
3808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
3826c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    NPN_SetException may be called to trigger a script exception upon
3836c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    return from entry points into NPObjects.  Typical usage:
3846c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
3856c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    NPN_SetException (npobj, message);
3868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/
3876c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsenvoid NPN_SetException(NPObject *npobj, const NPUTF8 *message);
3888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifdef __cplusplus
3908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
3918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif
3928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif
394