diff options
author | Adam Domurad <[email protected]> | 2013-06-21 12:47:45 -0400 |
---|---|---|
committer | Adam Domurad <[email protected]> | 2013-06-21 12:47:45 -0400 |
commit | a14e2d60ae4b77609973d7e35959c1edb04280fc (patch) | |
tree | cc6b11c2f9d09438fc55056f1031ec83c2d2e2ff /plugin | |
parent | b30dceba4363f445d9febf52e1788d63cc440a08 (diff) |
Move 'get_scriptable_java_package_object' and 'get_scriptable_java_object' into their correct respective classes.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/icedteanp/IcedTeaNPPlugin.cc | 4 | ||||
-rw-r--r-- | plugin/icedteanp/IcedTeaPluginUtils.cc | 4 | ||||
-rw-r--r-- | plugin/icedteanp/IcedTeaScriptablePluginObject.cc | 24 | ||||
-rw-r--r-- | plugin/icedteanp/IcedTeaScriptablePluginObject.h | 11 |
4 files changed, 22 insertions, 21 deletions
diff --git a/plugin/icedteanp/IcedTeaNPPlugin.cc b/plugin/icedteanp/IcedTeaNPPlugin.cc index ac1efc8..b5d2a94 100644 --- a/plugin/icedteanp/IcedTeaNPPlugin.cc +++ b/plugin/icedteanp/IcedTeaNPPlugin.cc @@ -2175,11 +2175,11 @@ get_scriptable_object(NPP instance) applet_class_id.append(*(java_result->return_string)); - obj = IcedTeaScriptableJavaPackageObject::get_scriptable_java_object(instance, applet_class_id, instance_id, false); + obj = IcedTeaScriptableJavaObject::get_scriptable_java_object(instance, applet_class_id, instance_id, false); } else { - obj = IcedTeaScriptablePluginObject::get_scriptable_java_package_object(instance, ""); + obj = IcedTeaScriptableJavaPackageObject::get_scriptable_java_package_object(instance, ""); } return obj; diff --git a/plugin/icedteanp/IcedTeaPluginUtils.cc b/plugin/icedteanp/IcedTeaPluginUtils.cc index 8e690bd..204e258 100644 --- a/plugin/icedteanp/IcedTeaPluginUtils.cc +++ b/plugin/icedteanp/IcedTeaPluginUtils.cc @@ -822,11 +822,11 @@ javaObjectResultToNPVariant(NPP instance, const std::string& jobject_id, NPVaria NPObject* obj; if (jclass_id.at(0) == '[') // array { - obj = IcedTeaScriptableJavaPackageObject::get_scriptable_java_object(instance, jclass_id, + obj = IcedTeaScriptableJavaObject::get_scriptable_java_object(instance, jclass_id, jobject_id, true); } else { - obj = IcedTeaScriptableJavaPackageObject::get_scriptable_java_object(instance, jclass_id, + obj = IcedTeaScriptableJavaObject::get_scriptable_java_object(instance, jclass_id, jobject_id, false); } diff --git a/plugin/icedteanp/IcedTeaScriptablePluginObject.cc b/plugin/icedteanp/IcedTeaScriptablePluginObject.cc index 233a33e..c998ffd 100644 --- a/plugin/icedteanp/IcedTeaScriptablePluginObject.cc +++ b/plugin/icedteanp/IcedTeaScriptablePluginObject.cc @@ -94,7 +94,7 @@ IcedTeaScriptablePluginObject::getProperty(NPObject *npobj, NPIdentifier name, N // Package request? if (!strcmp(browser_functions.utf8fromidentifier(name), "java")) { - //NPObject* obj = IcedTeaScriptablePluginObject::get_scriptable_java_package_object(getInstanceFromMemberPtr(npobj), name); + //NPObject* obj = IcedTeaScriptableJavaPackageObject::get_scriptable_java_package_object(getInstanceFromMemberPtr(npobj), name); //OBJECT_TO_NPVARIANT(obj, *result); //printf ("Filling variant %p with object %p\n", result); @@ -159,7 +159,7 @@ scriptable_plugin_object_class() { } NPObject* -IcedTeaScriptablePluginObject::get_scriptable_java_package_object(NPP instance, const NPUTF8* name) +IcedTeaScriptableJavaPackageObject::get_scriptable_java_package_object(NPP instance, const NPUTF8* name) { /* Shared NPClass instance for IcedTeaScriptablePluginObject */ static NPClass np_class = scriptable_plugin_object_class(); @@ -308,14 +308,14 @@ IcedTeaScriptableJavaPackageObject::getProperty(NPObject *npobj, NPIdentifier na if (isPropertyClass) { PLUGIN_DEBUG("Returning package object\n"); - obj = IcedTeaScriptablePluginObject::get_scriptable_java_package_object( + obj = IcedTeaScriptableJavaPackageObject::get_scriptable_java_package_object( IcedTeaPluginUtilities::getInstanceFromMemberPtr(npobj), property_name.c_str()); } else { PLUGIN_DEBUG("Returning Java object\n"); - obj = IcedTeaScriptableJavaPackageObject::get_scriptable_java_object( + obj = IcedTeaScriptableJavaObject::get_scriptable_java_object( IcedTeaPluginUtilities::getInstanceFromMemberPtr(npobj), *(java_result->return_string), "0", false); } @@ -382,7 +382,7 @@ scriptable_java_package_object_class() { } NPObject* -IcedTeaScriptableJavaPackageObject::get_scriptable_java_object(NPP instance, +IcedTeaScriptableJavaObject::get_scriptable_java_object(NPP instance, std::string class_id, std::string instance_id, bool isArray) @@ -393,7 +393,7 @@ IcedTeaScriptableJavaPackageObject::get_scriptable_java_object(NPP instance, std::string obj_key = class_id + ":" + instance_id; PLUGIN_DEBUG("get_scriptable_java_object searching for %s...\n", obj_key.c_str()); - NPObject* scriptable_object = IcedTeaPluginUtilities::getNPObjectFromJavaKey(obj_key); + IcedTeaScriptableJavaObject* scriptable_object = (IcedTeaScriptableJavaObject*) IcedTeaPluginUtilities::getNPObjectFromJavaKey(obj_key); if (scriptable_object != NULL) { @@ -403,7 +403,7 @@ IcedTeaScriptableJavaPackageObject::get_scriptable_java_object(NPP instance, } // try to create normally - scriptable_object = browser_functions.createobject(instance, &np_class); + scriptable_object = (IcedTeaScriptableJavaObject*)browser_functions.createobject(instance, &np_class); // didn't work? try creating asynch if (!scriptable_object) @@ -426,11 +426,11 @@ IcedTeaScriptableJavaPackageObject::get_scriptable_java_object(NPP instance, PLUGIN_DEBUG("Constructed new Java Object with classid=%s, instanceid=%s, isArray=%d and scriptable_object=%p\n", class_id.c_str(), instance_id.c_str(), isArray, scriptable_object); - ((IcedTeaScriptableJavaObject*) scriptable_object)->setClassIdentifier(class_id); - ((IcedTeaScriptableJavaObject*) scriptable_object)->setIsArray(isArray); + scriptable_object->setClassIdentifier(class_id); + scriptable_object->setIsArray(isArray); if (instance_id != "0") - ((IcedTeaScriptableJavaObject*) scriptable_object)->setInstanceIdentifier(instance_id); + scriptable_object->setInstanceIdentifier(instance_id); IcedTeaPluginUtilities::storeInstanceID(scriptable_object, instance); IcedTeaPluginUtilities::storeObjectMapping(obj_key, scriptable_object); @@ -709,7 +709,7 @@ IcedTeaScriptableJavaObject::getProperty(NPObject *npobj, NPIdentifier name, NPV if (!strcmp(browser_functions.utf8fromidentifier(name), "Packages")) { - NPObject* pkgObject = IcedTeaScriptablePluginObject::get_scriptable_java_package_object(instance, ""); + NPObject* pkgObject = IcedTeaScriptableJavaPackageObject::get_scriptable_java_package_object(instance, ""); OBJECT_TO_NPVARIANT(pkgObject, *result); return true; } @@ -890,7 +890,7 @@ IcedTeaScriptableJavaObject::construct(NPObject *npobj, const NPVariant *args, u std::string return_obj_class_id = class_id; return_obj_instance_id.append(*(java_result->return_string)); - obj = IcedTeaScriptableJavaPackageObject::get_scriptable_java_object( + obj = IcedTeaScriptableJavaObject::get_scriptable_java_object( IcedTeaPluginUtilities::getInstanceFromMemberPtr(npobj), return_obj_class_id, return_obj_instance_id, false); diff --git a/plugin/icedteanp/IcedTeaScriptablePluginObject.h b/plugin/icedteanp/IcedTeaScriptablePluginObject.h index ad8a2eb..71fab4e 100644 --- a/plugin/icedteanp/IcedTeaScriptablePluginObject.h +++ b/plugin/icedteanp/IcedTeaScriptablePluginObject.h @@ -87,7 +87,6 @@ class IcedTeaScriptablePluginObject: public NPObject static bool construct(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); - static NPObject* get_scriptable_java_package_object(NPP instance, const NPUTF8* name); }; NPObject* allocate_scriptable_jp_object(NPP npp, NPClass *aClass); @@ -136,10 +135,7 @@ class IcedTeaScriptableJavaPackageObject: public NPObject static bool construct(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); - static NPObject* get_scriptable_java_object(NPP instance, - std::string class_id, - std::string instance_id, - bool isArray); + static NPObject* get_scriptable_java_package_object(NPP instance, const NPUTF8* name); static bool is_valid_java_object(NPObject* object_ptr); }; @@ -199,6 +195,11 @@ class IcedTeaScriptableJavaObject: public NPObject static bool construct(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); + + static NPObject* get_scriptable_java_object(NPP instance, + std::string class_id, + std::string instance_id, + bool isArray); }; /* Creates and retains a scriptable java object (intended to be called asynch.) */ |