Index: content/test/plugin/plugin_client.cc |
diff --git a/content/test/plugin/plugin_client.cc b/content/test/plugin/plugin_client.cc |
index e5d0f8c40b70117c9d3c403b6b4cf1f0e3b6f505..f2f4e68428ffe2b869df459cbd862776f59081d1 100644 |
--- a/content/test/plugin/plugin_client.cc |
+++ b/content/test/plugin/plugin_client.cc |
@@ -11,6 +11,52 @@ |
namespace NPAPIClient { |
+class NPWithProperty : public NPObject { |
+ public: |
+ NPWithProperty() : NPObject() {} |
+ |
+ static NPObject* Allocate(NPP npp, NPClass* npclass) { |
+ return new NPWithProperty(); |
+ } |
+ |
+ static void Deallocate(NPObject* npobject) { |
+ delete static_cast<NPWithProperty*>(npobject); |
+ } |
+ |
+ static bool HasProperty(NPObject* npobject, NPIdentifier name) { |
+ return (name == PluginClient::HostFunctions()-> |
+ getstringidentifier("loadedProperty")); |
+ } |
+ |
+ static bool GetProperty(NPObject* npobject, |
+ NPIdentifier name, |
+ NPVariant* result) { |
+ if (name == PluginClient::HostFunctions()-> |
+ getstringidentifier("loadedProperty")) { |
+ BOOLEAN_TO_NPVARIANT(true, *result); |
+ return true; |
+ } |
+ return false; |
+ } |
+}; |
+ |
+static NPClass* GetNPClass() { |
+ static NPClass plugin_class = { |
+ NP_CLASS_STRUCT_VERSION, |
+ NPWithProperty::Allocate, |
+ NPWithProperty::Deallocate, |
+ NULL, // Invalidate |
+ NULL, // HasMethod |
+ NULL, // Invoke |
+ NULL, // InvokeDefault |
+ NPWithProperty::HasProperty, |
+ NPWithProperty::GetProperty, |
+ NULL, // SetProperty |
+ NULL, // RemoveProperty |
+ }; |
+ return &plugin_class; |
+} |
+ |
NPNetscapeFuncs* PluginClient::host_functions_; |
NPError PluginClient::GetEntryPoints(NPPluginFuncs* pFuncs) { |
@@ -230,6 +276,13 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) { |
return NPERR_NO_ERROR; |
} |
+ if (variable == NPPVpluginScriptableNPObject) { |
+ *(NPObject**)value = |
+ NPAPIClient::PluginClient::HostFunctions()->createobject( |
+ instance, NPAPIClient::GetNPClass()); |
+ return NPERR_NO_ERROR; |
+ } |
+ |
// XXXMB - do work here. |
return NPERR_GENERIC_ERROR; |
} |