* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "TestObject.h"
+#include "content/shell/tools/plugin/test_object.h"
+
#include "PluginObject.h"
#include <string.h>
uint32_t argCount,
NPVariant* result);
-static NPClass testClass = {
+static NPClass g_test_class = {
NP_CLASS_STRUCT_VERSION, testAllocate, testDeallocate, 0,
testHasMethod, testInvoke, 0, testHasProperty,
testGetProperty, 0, 0, testEnumerate,
testConstruct};
-NPClass* getTestClass(void) { return &testClass; }
-
-static int testObjectCount = 0;
-int getTestObjectCount() { return testObjectCount; }
+static int g_test_object_count = 0;
typedef struct {
NPObject header;
TestObject* newInstance =
static_cast<TestObject*>(malloc(sizeof(TestObject)));
newInstance->testObject = 0;
- ++testObjectCount;
+ ++g_test_object_count;
if (!identifiersInitialized) {
identifiersInitialized = true;
if (testObject->testObject)
browser->releaseobject(testObject->testObject);
- --testObjectCount;
+ --g_test_object_count;
free(obj);
}
STRINGZ_TO_NPVARIANT(mem, *result);
return true;
}
+ if (name == testIdentifiers[ID_PROPERTY_BAR]) {
+ char* mem = static_cast<char*>(browser->memalloc(4));
+ strcpy(mem, "bar");
+ STRINGZ_TO_NPVARIANT(mem, *result);
+ return true;
+ }
if (name == testIdentifiers[ID_PROPERTY_OBJECT_POINTER]) {
int32_t objectPointer =
static_cast<int32_t>(reinterpret_cast<long long>(npobj));
if (name == testIdentifiers[ID_PROPERTY_TEST_OBJECT]) {
TestObject* testObject = reinterpret_cast<TestObject*>(npobj);
if (!testObject->testObject)
- testObject->testObject = browser->createobject(0, &testClass);
+ testObject->testObject = browser->createobject(0, &g_test_class);
browser->retainobject(testObject->testObject);
OBJECT_TO_NPVARIANT(testObject->testObject, *result);
return true;
OBJECT_TO_NPVARIANT(npobj, *result);
return true;
}
+
+namespace content {
+
+NPClass* GetTestClass() { return &g_test_class; }
+
+int GetTestObjectCount() { return g_test_object_count; }
+
+} // namespace content