本文整理汇总了C++中PluginIdentifierParent::ToNPIdentifier方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginIdentifierParent::ToNPIdentifier方法的具体用法?C++ PluginIdentifierParent::ToNPIdentifier怎么用?C++ PluginIdentifierParent::ToNPIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginIdentifierParent
的用法示例。
在下文中一共展示了PluginIdentifierParent::ToNPIdentifier方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: actor
// static
bool
PluginScriptableObjectParent::ScriptableEnumerate(NPObject* aObject,
NPIdentifier** aIdentifiers,
uint32_t* aCount)
{
if (aObject->_class != GetClass()) {
NS_ERROR("Don't know what kind of object this is!");
return false;
}
ParentNPObject* object = reinterpret_cast<ParentNPObject*>(aObject);
if (object->invalidated) {
NS_WARNING("Calling method on an invalidated object!");
return false;
}
ProtectedActor<PluginScriptableObjectParent> actor(object->parent);
if (!actor) {
return false;
}
NS_ASSERTION(actor->Type() == Proxy, "Bad type!");
const NPNetscapeFuncs* npn = GetNetscapeFuncs(aObject);
if (!npn) {
NS_ERROR("No netscape funcs!");
return false;
}
AutoInfallibleTArray<PPluginIdentifierParent*, 10> identifiers;
bool success;
if (!actor->CallEnumerate(&identifiers, &success)) {
NS_WARNING("Failed to send message!");
return false;
}
if (!success) {
return false;
}
*aCount = identifiers.Length();
if (!*aCount) {
*aIdentifiers = nullptr;
return true;
}
*aIdentifiers = (NPIdentifier*)npn->memalloc(*aCount * sizeof(NPIdentifier));
if (!*aIdentifiers) {
NS_ERROR("Out of memory!");
return false;
}
for (uint32_t index = 0; index < *aCount; index++) {
PluginIdentifierParent* id =
static_cast<PluginIdentifierParent*>(identifiers[index]);
(*aIdentifiers)[index] = id->ToNPIdentifier();
}
return true;
}