static PP_Bool Instance_DidCreate(PP_Instance instance, uint32_t argc, const char* argn[], const char* argv[]) { loader = loader_->Create(instance); requestInfo = requestInfo_->Create(instance); requestInfo_->SetProperty(requestInfo, PP_URLREQUESTPROPERTY_URL, StrToVar("http://localhost:5103/NaClueakTest/foo.image")); requestInfo_->SetProperty(requestInfo, PP_URLREQUESTPROPERTY_METHOD, StrToVar("GET")); loader_->Open(loader, requestInfo, LoadCompletionCallback); Log("loader open\n"); return loader ? PP_TRUE : PP_FALSE; }
/** * Invoke the function associated with @a name. * @param[in] object unused * @param[in] name method name * @param[in] argc number of arguments * @param[in] argv array of arguments * @param[out] exception pointer to the exception object, unused * @return If the method does exist, return true. */ static struct PP_Var Squeak_Call(void* object, struct PP_Var name, uint32_t argc, struct PP_Var* argv, struct PP_Var* exception) { struct PP_Var v = PP_MakeInt32(0); const char* method_name = VarToCStr(name); if (NULL != method_name) { if (strcmp(method_name, kPaintMethodId) == 0) { Paint(); return v; } if (strcmp(method_name, kGetStatusMethodId) == 0) return StrToVar(status); } return v; }