diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-08 00:37:53 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-08 00:37:53 +0000 |
commit | ba1100d658069bcc3ed69a736cd45a1f2b81c8f3 (patch) | |
tree | c5e6f7f853ebf45ff037eefb9c69cdf1ebffa8f4 | |
parent | 2c60e7ec4964310acea2c9e57425647d7499cce1 (diff) | |
download | chromium_src-ba1100d658069bcc3ed69a736cd45a1f2b81c8f3.zip chromium_src-ba1100d658069bcc3ed69a736cd45a1f2b81c8f3.tar.gz chromium_src-ba1100d658069bcc3ed69a736cd45a1f2b81c8f3.tar.bz2 |
Stub out NPN_Construct.
Review URL: http://codereview.chromium.org/16564
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7707 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | third_party/npapi/bindings/npruntime.h | 12 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_host.cc | 9 | ||||
-rw-r--r-- | webkit/port/bindings/v8/np_v8object.cpp | 18 | ||||
-rw-r--r-- | webkit/tools/npapi_layout_test_plugin/PluginObject.cpp | 14 |
4 files changed, 40 insertions, 13 deletions
diff --git a/third_party/npapi/bindings/npruntime.h b/third_party/npapi/bindings/npruntime.h index 74840ba..eac3727 100644 --- a/third_party/npapi/bindings/npruntime.h +++ b/third_party/npapi/bindings/npruntime.h @@ -262,6 +262,7 @@ typedef bool (*NPGetPropertyFunctionPtr)(NPObject *obj, NPIdentifier name, NPVar typedef bool (*NPSetPropertyFunctionPtr)(NPObject *obj, NPIdentifier name, const NPVariant *value); typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj, NPIdentifier name); typedef bool (*NPEnumerationFunctionPtr)(NPObject *npobj, NPIdentifier **value, uint32_t *count); +typedef bool (*NPConstructFunctionPtr)(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); /* NPObjects returned by create have a reference count of one. It is the caller's responsibility @@ -298,12 +299,17 @@ struct NPClass NPSetPropertyFunctionPtr setProperty; NPRemovePropertyFunctionPtr removeProperty; NPEnumerationFunctionPtr enumerate; + NPConstructFunctionPtr construct; }; -#define NP_CLASS_STRUCT_VERSION 2 -#define NP_CLASS_STRUCT_VERSION_ENUM 2 +#define NP_CLASS_STRUCT_VERSION 3 +#define NP_CLASS_STRUCT_VERSION_ENUM 2 +#define NP_CLASS_STRUCT_VERSION_CTOR 3 + #define NP_CLASS_STRUCT_VERSION_HAS_ENUM(npclass) \ ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_ENUM) +#define NP_CLASS_STRUCT_VERSION_HAS_CTOR(npclass) \ + ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR) struct NPObject { NPClass *_class; @@ -351,6 +357,7 @@ bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName); bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName); bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName); bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count); +bool NPN_Construct(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); // Helper function for evaluating a script in the scope of the NPObject passed in. // Parameters @@ -375,7 +382,6 @@ void* NPP_GetJavaClass(void); void* NPN_GetJavaEnv(void); void* NPN_GetJavaPeer(NPP instance); void NPN_PluginThreadAsyncCall(NPP id, void (*func)(void *), void *userData); -bool NPN_Construct(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); // END GOOGLE MODIFICATIONS diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc index 60b2b91..1181caa 100644 --- a/webkit/glue/plugins/plugin_host.cc +++ b/webkit/glue/plugins/plugin_host.cc @@ -861,14 +861,5 @@ void NPN_PluginThreadAsyncCall(NPP id, } } -bool NPN_Construct(NPP npp, - NPObject* obj, - const NPVariant *args, - uint32_t argCount, - NPVariant *result) { - NOTREACHED(); - return false; -} - } // extern "C" diff --git a/webkit/port/bindings/v8/np_v8object.cpp b/webkit/port/bindings/v8/np_v8object.cpp index 6828733..917771a 100644 --- a/webkit/port/bindings/v8/np_v8object.cpp +++ b/webkit/port/bindings/v8/np_v8object.cpp @@ -491,3 +491,21 @@ bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier, return false; } + +bool NPN_Construct(NPP npp, NPObject* npobj, const NPVariant* args, + uint32_t argCount, NPVariant* result) { + if (npobj == NULL) return false; + + // TODO(estade): implement this case. + if (npobj->_class == NPScriptObjectClass) { + VOID_TO_NPVARIANT(*result); + return false; + } + + if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npobj->_class) && + npobj->_class->construct) { + return npobj->_class->construct(npobj, args, argCount, result); + } + + return false; +} diff --git a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp index a828879..df8b40c 100644 --- a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp +++ b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp @@ -106,7 +106,8 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = { #define ID_TEST_IDENTIFIER_TO_INT 18 #define ID_TEST_POSTURL_FILE 19 #define ID_TEST_CALLBACK_AND_GET_VALUE 20 -#define NUM_METHOD_IDENTIFIERS 21 +#define ID_TEST_CONSTRUCT 21 +#define NUM_METHOD_IDENTIFIERS 22 static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS]; static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = { @@ -132,6 +133,7 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = { "testPostURLFile", // Chrome bug http://code.google.com/p/chromium/issues/detail?id=4270 "testCallbackAndGetValue", + "testConstruct", }; static NPUTF8* createCStringFromNPVariant(const NPVariant* variant) @@ -568,6 +570,14 @@ static bool testPostURLFile(PluginObject* obj, const NPVariant* args, uint32_t a return true; } +static bool testConstruct(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result) +{ + if (!argCount || !NPVARIANT_IS_OBJECT(args[0])) + return false; + + return browser->construct(obj->npp, NPVARIANT_TO_OBJECT(args[0]), args + 1, argCount - 1, result); +} + static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result) { PluginObject* plugin = reinterpret_cast<PluginObject*>(header); @@ -725,6 +735,8 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a } } else if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_AND_GET_VALUE]) { return testCallbackAndGetValue(plugin, args, argCount, result); + } else if (name == pluginMethodIdentifiers[ID_TEST_CONSTRUCT]) { + return testConstruct(plugin, args, argCount, result); } return false; |