本文整理汇总了C++中PluginInstanceParent::GetNPP方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginInstanceParent::GetNPP方法的具体用法?C++ PluginInstanceParent::GetNPP怎么用?C++ PluginInstanceParent::GetNPP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginInstanceParent
的用法示例。
在下文中一共展示了PluginInstanceParent::GetNPP方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetClass
bool
PluginScriptableObjectParent::AnswerEnumerate(InfallibleTArray<PPluginIdentifierParent*>* aProperties,
bool* aSuccess)
{
if (!mObject) {
NS_WARNING("Calling AnswerEnumerate with an invalidated object!");
*aSuccess = false;
return true;
}
NS_ASSERTION(mObject->_class != GetClass(), "Bad object type!");
NS_ASSERTION(mType == LocalObject, "Bad type!");
PluginInstanceParent* instance = GetInstance();
if (!instance) {
NS_ERROR("No instance?!");
*aSuccess = false;
return true;
}
const NPNetscapeFuncs* npn = GetNetscapeFuncs(instance);
if (!npn) {
NS_WARNING("No netscape funcs?!");
*aSuccess = false;
return true;
}
NPIdentifier* ids;
uint32_t idCount;
if (!npn->enumerate(instance->GetNPP(), mObject, &ids, &idCount)) {
*aSuccess = false;
return true;
}
aProperties->SetCapacity(idCount);
mozilla::AutoSafeJSContext cx;
for (uint32_t index = 0; index < idCount; index++) {
// Because of GC hazards, all identifiers returned from enumerate
// must be made permanent.
if (_identifierisstring(ids[index])) {
JSString* str = NPIdentifierToString(ids[index]);
if (!JS_StringHasBeenInterned(cx, str)) {
DebugOnly<JSString*> str2 = JS_InternJSString(cx, str);
NS_ASSERTION(str2 == str, "Interning a JS string which is currently an ID should return itself.");
}
}
PluginIdentifierParent* id =
instance->Module()->GetIdentifierForNPIdentifier(instance->GetNPP(), ids[index]);
aProperties->AppendElement(id);
NS_ASSERTION(!id->IsTemporary(), "Should only have permanent identifiers!");
}
npn->memfree(ids);
*aSuccess = true;
return true;
}
示例2: GetClass
bool
PluginScriptableObjectParent::AnswerRemoveProperty(PPluginIdentifierParent* aId,
bool* aSuccess)
{
if (!mObject) {
NS_WARNING("Calling AnswerRemoveProperty with an invalidated object!");
*aSuccess = false;
return true;
}
NS_ASSERTION(mObject->_class != GetClass(), "Bad object type!");
NS_ASSERTION(mType == LocalObject, "Bad type!");
PluginInstanceParent* instance = GetInstance();
if (!instance) {
NS_ERROR("No instance?!");
*aSuccess = false;
return true;
}
const NPNetscapeFuncs* npn = GetNetscapeFuncs(instance);
if (!npn) {
NS_ERROR("No netscape funcs?!");
*aSuccess = false;
return true;
}
PluginIdentifierParent* id = static_cast<PluginIdentifierParent*>(aId);
*aSuccess = npn->removeproperty(instance->GetNPP(), mObject,
id->ToNPIdentifier());
return true;
}
示例3: mIdentifier
PluginIdentifierParent::StackIdentifier::StackIdentifier
(NPObject* aObject, NPIdentifier aIdentifier)
: mIdentifier(NULL)
{
PluginInstanceParent* inst = GetInstance(aObject);
mIdentifier = inst->Module()->GetIdentifierForNPIdentifier(inst->GetNPP(), aIdentifier);
}
示例4: GetClass
bool
PluginScriptableObjectParent::AnswerEnumerate(nsTArray<PPluginIdentifierParent*>* aProperties,
bool* aSuccess)
{
if (!mObject) {
NS_WARNING("Calling AnswerEnumerate with an invalidated object!");
*aSuccess = false;
return true;
}
NS_ASSERTION(mObject->_class != GetClass(), "Bad object type!");
NS_ASSERTION(mType == LocalObject, "Bad type!");
PluginInstanceParent* instance = GetInstance();
if (!instance) {
NS_ERROR("No instance?!");
*aSuccess = false;
return true;
}
const NPNetscapeFuncs* npn = GetNetscapeFuncs(instance);
if (!npn) {
NS_WARNING("No netscape funcs?!");
*aSuccess = false;
return true;
}
NPIdentifier* ids;
uint32_t idCount;
if (!npn->enumerate(instance->GetNPP(), mObject, &ids, &idCount)) {
*aSuccess = false;
return true;
}
if (!aProperties->SetCapacity(idCount)) {
npn->memfree(ids);
*aSuccess = false;
return true;
}
for (uint32_t index = 0; index < idCount; index++) {
aProperties->AppendElement(GetIdentifier(instance, ids[index]));
}
npn->memfree(ids);
*aSuccess = true;
return true;
}
示例5: GetInstance
bool
PluginScriptableObjectParent::AnswerNPN_Evaluate(const nsCString& aScript,
Variant* aResult,
bool* aSuccess)
{
PluginInstanceParent* instance = GetInstance();
if (!instance) {
NS_ERROR("No instance?!");
*aResult = void_t();
*aSuccess = false;
return true;
}
const NPNetscapeFuncs* npn = GetNetscapeFuncs(instance);
if (!npn) {
NS_ERROR("No netscape funcs?!");
*aResult = void_t();
*aSuccess = false;
return true;
}
NPString script = { aScript.get(), aScript.Length() };
NPVariant result;
bool success = npn->evaluate(instance->GetNPP(), mObject, &script, &result);
if (!success) {
*aResult = void_t();
*aSuccess = false;
return true;
}
Variant convertedResult;
success = ConvertToRemoteVariant(result, convertedResult, instance);
DeferNPVariantLastRelease(npn, &result);
if (!success) {
*aResult = void_t();
*aSuccess = false;
return true;
}
*aSuccess = true;
*aResult = convertedResult;
return true;
}