- Timestamp:
- Sep 24, 2014, 9:34:21 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/icedtea-web/plugin/icedteanp/IcedTeaScriptablePluginObject.h
r348 r429 40 40 #define __ICEDTEASCRIPTABLEPLUGINOBJECT_H_ 41 41 42 #if MOZILLA_VERSION_COLLAPSED < 109010043 #include "npupp.h"44 #else45 42 #include <npapi.h> 46 43 #include <npruntime.h> 47 #endif48 44 49 45 #include "IcedTeaJavaRequestProcessor.h" … … 68 64 static void invalidate(NPObject *npobj); 69 65 70 static bool hasMethod(NPObject *npobj, NPIdentifier name );71 72 static bool invoke(NPObject *npobj, NPIdentifier name ,66 static bool hasMethod(NPObject *npobj, NPIdentifier name_id); 67 68 static bool invoke(NPObject *npobj, NPIdentifier name_id, 73 69 const NPVariant *args, uint32_t argCount, NPVariant *result); 74 70 … … 76 72 uint32_t argCount, NPVariant *result); 77 73 78 static bool hasProperty(NPObject *npobj, NPIdentifier name );79 80 static bool getProperty(NPObject *npobj, NPIdentifier name ,74 static bool hasProperty(NPObject *npobj, NPIdentifier name_id); 75 76 static bool getProperty(NPObject *npobj, NPIdentifier name_id, 81 77 NPVariant *result); 82 78 83 static bool setProperty(NPObject *npobj, NPIdentifier name ,79 static bool setProperty(NPObject *npobj, NPIdentifier name_id, 84 80 const NPVariant *value); 85 81 86 static bool removeProperty(NPObject *npobj, NPIdentifier name );82 static bool removeProperty(NPObject *npobj, NPIdentifier name_id); 87 83 88 84 static bool enumerate(NPObject *npobj, NPIdentifier **value, … … 92 88 uint32_t argCount, NPVariant *result); 93 89 94 static NPObject* get_scriptable_java_package_object(NPP instance, const NPUTF8* name);95 90 }; 96 91 … … 117 112 static void invalidate(NPObject *npobj); 118 113 119 static bool hasMethod(NPObject *npobj, NPIdentifier name );120 121 static bool invoke(NPObject *npobj, NPIdentifier name ,114 static bool hasMethod(NPObject *npobj, NPIdentifier name_id); 115 116 static bool invoke(NPObject *npobj, NPIdentifier name_id, 122 117 const NPVariant *args, uint32_t argCount, NPVariant *result); 123 118 … … 125 120 uint32_t argCount, NPVariant *result); 126 121 127 static bool hasProperty(NPObject *npobj, NPIdentifier name );128 129 static bool getProperty(NPObject *npobj, NPIdentifier name ,122 static bool hasProperty(NPObject *npobj, NPIdentifier name_id); 123 124 static bool getProperty(NPObject *npobj, NPIdentifier name_id, 130 125 NPVariant *result); 131 126 132 static bool setProperty(NPObject *npobj, NPIdentifier name ,127 static bool setProperty(NPObject *npobj, NPIdentifier name_id, 133 128 const NPVariant *value); 134 129 135 static bool removeProperty(NPObject *npobj, NPIdentifier name );130 static bool removeProperty(NPObject *npobj, NPIdentifier name_id); 136 131 137 132 static bool enumerate(NPObject *npobj, NPIdentifier **value, … … 141 136 uint32_t argCount, NPVariant *result); 142 137 143 static NPObject* get_scriptable_java_object(NPP instance, 144 std::string class_id, 145 std::string instance_id, 146 bool isArray); 138 static NPObject* get_scriptable_java_package_object(NPP instance, const NPUTF8* name); 147 139 148 140 static bool is_valid_java_object(NPObject* object_ptr); … … 151 143 class IcedTeaScriptableJavaObject: public NPObject 152 144 { 153 154 private: 155 NPP instance; 156 bool isObjectArray; 157 std::string* class_id; 158 std::string* instance_id; 159 160 public: 161 IcedTeaScriptableJavaObject(NPP instance); 162 163 ~IcedTeaScriptableJavaObject(); 164 165 void setClassIdentifier(std::string class_id); 166 167 void setInstanceIdentifier(std::string instance_id); 168 169 void setIsArray(bool isArray); 170 171 std::string getClassID() { return *class_id; } 172 173 std::string getInstanceID() { return *instance_id; } 174 175 NPP getInstance() { return instance; } 176 177 bool isArray() { return isObjectArray; } 178 179 static void deAllocate(NPObject *npobj); 180 181 static void invalidate(NPObject *npobj); 182 183 static bool hasMethod(NPObject *npobj, NPIdentifier name); 184 185 static bool invoke(NPObject *npobj, NPIdentifier name, 186 const NPVariant *args, uint32_t argCount, NPVariant *result); 187 188 static bool invokeDefault(NPObject *npobj, const NPVariant *args, 189 uint32_t argCount, NPVariant *result); 190 191 static bool hasProperty(NPObject *npobj, NPIdentifier name); 192 193 static bool getProperty(NPObject *npobj, NPIdentifier name, 194 NPVariant *result); 195 196 static bool setProperty(NPObject *npobj, NPIdentifier name, 197 const NPVariant *value); 198 199 static bool removeProperty(NPObject *npobj, NPIdentifier name); 200 201 static bool enumerate(NPObject *npobj, NPIdentifier **value, 202 uint32_t *count); 203 204 static bool construct(NPObject *npobj, const NPVariant *args, 205 uint32_t argCount, NPVariant *result); 145 private: 146 NPP instance; 147 bool is_object_array; 148 /* These may be empty if 'is_applet_instance' is true 149 * and the object has not yet been used */ 150 std::string class_id, instance_id; 151 public: 152 IcedTeaScriptableJavaObject(NPP instance) { 153 this->instance = instance; 154 is_object_array = false; 155 } 156 static void deAllocate(NPObject *npobj) { 157 delete (IcedTeaScriptableJavaObject*)npobj; 158 } 159 std::string getInstanceID() { 160 return instance_id; 161 } 162 std::string getClassID() { 163 return class_id; 164 } 165 std::string objectKey() { 166 return getClassID() + ":" + getInstanceID(); 167 } 168 static void invalidate(NPObject *npobj) { 169 IcedTeaPluginUtilities::removeInstanceID(npobj); 170 IcedTeaScriptableJavaObject* scriptable_object = (IcedTeaScriptableJavaObject*) npobj; 171 IcedTeaPluginUtilities::removeObjectMapping(scriptable_object->objectKey()); 172 } 173 static bool hasMethod(NPObject *npobj, NPIdentifier name_id); 174 static bool invoke(NPObject *npobj, NPIdentifier name_id, 175 const NPVariant *args, uint32_t argCount, NPVariant *result); 176 static bool invokeDefault(NPObject *npobj, const NPVariant *args, 177 uint32_t argCount, NPVariant *result) { 178 PLUGIN_ERROR ("** Unimplemented: IcedTeaScriptableJavaObject::invokeDefault %p\n", npobj); 179 return false; 180 } 181 static bool hasProperty(NPObject *npobj, NPIdentifier name_id); 182 static bool getProperty(NPObject *npobj, NPIdentifier name_id, 183 NPVariant *result); 184 static bool setProperty(NPObject *npobj, NPIdentifier name_id, 185 const NPVariant *value); 186 187 static bool removeProperty(NPObject *npobj, NPIdentifier name_id) { 188 PLUGIN_ERROR ("** Unimplemented: IcedTeaScriptableJavaObject::removeProperty %p\n", npobj); 189 return false; 190 } 191 static bool enumerate(NPObject *npobj, NPIdentifier **value, 192 uint32_t *count) { 193 PLUGIN_ERROR ("** Unimplemented: IcedTeaScriptableJavaObject::enumerate %p\n", npobj); 194 return false; 195 } 196 static bool construct(NPObject *npobj, const NPVariant *args, 197 uint32_t argCount, NPVariant *result); 198 /* Creates and retains a scriptable java object (intended to be called asynch.) */ 199 static NPObject* get_scriptable_java_object(NPP instance, 200 std::string class_id, 201 std::string instance_id, 202 bool isArray); 206 203 }; 207 204
Note:
See TracChangeset
for help on using the changeset viewer.