⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 netscapepluginhostproxy.mm

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 MM
📖 第 1 页 / 共 2 页
字号:
    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;    RetainPtr<CFDataRef> result(AdoptCF, CFDataCreate(0, reinterpret_cast<UInt8*>(resultData), resultLength));    instanceProxy->setCurrentReply(new NetscapePluginInstanceProxy::BooleanAndDataReply(returnValue, result));        return KERN_SUCCESS;}kern_return_t WKPCInstantiatePluginReply(mach_port_t clientPort, uint32_t pluginID, kern_return_t result, uint32_t renderContextID, boolean_t useSoftwareRenderer){    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;    instanceProxy->setCurrentReply(new NetscapePluginInstanceProxy::InstantiatePluginReply(result, renderContextID, useSoftwareRenderer));    return KERN_SUCCESS;}kern_return_t WKPCGetWindowNPObject(mach_port_t clientPort, uint32_t pluginID, uint32_t* outObjectID){    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;    uint32_t objectID;    if (!instanceProxy->getWindowNPObject(objectID))        return KERN_FAILURE;        *outObjectID = objectID;        return KERN_SUCCESS;}kern_return_t WKPCGetPluginElementNPObject(mach_port_t clientPort, uint32_t pluginID, uint32_t* outObjectID){    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;        uint32_t objectID;    if (!instanceProxy->getPluginElementNPObject(objectID))        return KERN_FAILURE;        *outObjectID = objectID;        return KERN_SUCCESS;}kern_return_t WKPCReleaseObject(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID){    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;    instanceProxy->releaseObject(objectID);    return KERN_SUCCESS;}kern_return_t WKPCEvaluate(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID, data_t scriptData, mach_msg_type_number_t scriptLength){    DataDeallocator deallocator(scriptData, scriptLength);    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;    PluginDestroyDeferrer deferrer(instanceProxy);        String script = String::fromUTF8WithLatin1Fallback(scriptData, scriptLength);        data_t resultData;    mach_msg_type_number_t resultLength;        boolean_t returnValue = instanceProxy->evaluate(objectID, script, resultData, resultLength);        _WKPHBooleanAndDataReply(hostProxy->port(), instanceProxy->pluginID(), returnValue, resultData, resultLength);    mig_deallocate(reinterpret_cast<vm_address_t>(resultData), resultLength);            return KERN_SUCCESS;}kern_return_t WKPCGetStringIdentifier(mach_port_t clientPort, data_t name, mach_msg_type_number_t nameCnt, uint64_t* identifier){    DataDeallocator deallocator(name, nameCnt);    COMPILE_ASSERT(sizeof(*identifier) == sizeof(IdentifierRep*), identifier_sizes);        *identifier = reinterpret_cast<uint64_t>(IdentifierRep::get(name));    return KERN_SUCCESS;}kern_return_t WKPCGetIntIdentifier(mach_port_t clientPort, int32_t value, uint64_t* identifier){    COMPILE_ASSERT(sizeof(*identifier) == sizeof(NPIdentifier), identifier_sizes);        *identifier = reinterpret_cast<uint64_t>(IdentifierRep::get(value));    return KERN_SUCCESS;}static Identifier identifierFromIdentifierRep(IdentifierRep* identifier){    ASSERT(IdentifierRep::isValid(identifier));    ASSERT(identifier->isString());      const char* str = identifier->string();        return Identifier(JSDOMWindow::commonJSGlobalData(), String::fromUTF8WithLatin1Fallback(str, strlen(str)));}kern_return_t WKPCInvoke(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID, uint64_t serverIdentifier,                         data_t argumentsData, mach_msg_type_number_t argumentsLength) {    DataDeallocator deallocator(argumentsData, argumentsLength);    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;    PluginDestroyDeferrer deferrer(instanceProxy);        IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);    if (!IdentifierRep::isValid(identifier)) {        _WKPHBooleanAndDataReply(hostProxy->port(), instanceProxy->pluginID(), false, 0, 0);        return KERN_SUCCESS;    }    Identifier methodNameIdentifier = identifierFromIdentifierRep(identifier);    data_t resultData;    mach_msg_type_number_t resultLength;        boolean_t returnValue = instanceProxy->invoke(objectID, methodNameIdentifier, argumentsData, argumentsLength, resultData, resultLength);        _WKPHBooleanAndDataReply(hostProxy->port(), instanceProxy->pluginID(), returnValue, resultData, resultLength);    mig_deallocate(reinterpret_cast<vm_address_t>(resultData), resultLength);        return KERN_SUCCESS;}kern_return_t WKPCInvokeDefault(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID,                                data_t argumentsData, mach_msg_type_number_t argumentsLength){    DataDeallocator deallocator(argumentsData, argumentsLength);    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;    PluginDestroyDeferrer deferrer(instanceProxy);    data_t resultData;    mach_msg_type_number_t resultLength;        boolean_t returnValue = instanceProxy->invokeDefault(objectID, argumentsData, argumentsLength, resultData, resultLength);        _WKPHBooleanAndDataReply(hostProxy->port(), instanceProxy->pluginID(), returnValue, resultData, resultLength);    mig_deallocate(reinterpret_cast<vm_address_t>(resultData), resultLength);        return KERN_SUCCESS;}kern_return_t WKPCConstruct(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID,                            data_t argumentsData, mach_msg_type_number_t argumentsLength,                             boolean_t* returnValue, data_t* resultData, mach_msg_type_number_t* resultLength){    DataDeallocator deallocator(argumentsData, argumentsLength);    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;    PluginDestroyDeferrer deferrer(instanceProxy);    *returnValue = instanceProxy->construct(objectID, argumentsData, argumentsLength, *resultData, *resultLength);        return KERN_SUCCESS;}kern_return_t WKPCGetProperty(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID, uint64_t serverIdentifier){    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;        IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);    if (!IdentifierRep::isValid(identifier))        return KERN_FAILURE;        PluginDestroyDeferrer deferrer(instanceProxy);    data_t resultData;    mach_msg_type_number_t resultLength;    boolean_t returnValue;        if (identifier->isString()) {        Identifier propertyNameIdentifier = identifierFromIdentifierRep(identifier);                returnValue = instanceProxy->getProperty(objectID, propertyNameIdentifier, resultData, resultLength);    } else         returnValue = instanceProxy->setProperty(objectID, identifier->number(), resultData, resultLength);        _WKPHBooleanAndDataReply(hostProxy->port(), instanceProxy->pluginID(), returnValue, resultData, resultLength);    mig_deallocate(reinterpret_cast<vm_address_t>(resultData), resultLength);        return KERN_SUCCESS;}kern_return_t WKPCSetProperty(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID, uint64_t serverIdentifier, data_t valueData, mach_msg_type_number_t valueLength, boolean_t* returnValue){    DataDeallocator deallocator(valueData, valueLength);    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;    PluginDestroyDeferrer deferrer(instanceProxy);    IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);    if (!IdentifierRep::isValid(identifier))        *returnValue = false;        if (identifier->isString()) {        Identifier propertyNameIdentifier = identifierFromIdentifierRep(identifier);                *returnValue = instanceProxy->setProperty(objectID, propertyNameIdentifier, valueData, valueLength);    } else         *returnValue = instanceProxy->setProperty(objectID, identifier->number(), valueData, valueLength);        return KERN_SUCCESS;}kern_return_t WKPCRemoveProperty(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID, uint64_t serverIdentifier, boolean_t* returnValue){    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;        PluginDestroyDeferrer deferrer(instanceProxy);    IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);    if (!IdentifierRep::isValid(identifier))        return KERN_FAILURE;            if (identifier->isString()) {        Identifier propertyNameIdentifier = identifierFromIdentifierRep(identifier);                *returnValue = instanceProxy->removeProperty(objectID, propertyNameIdentifier);    } else         *returnValue = instanceProxy->removeProperty(objectID, identifier->number());        return KERN_SUCCESS;}kern_return_t WKPCHasProperty(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID, uint64_t serverIdentifier){    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;        PluginDestroyDeferrer deferrer(instanceProxy);    IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);    if (!IdentifierRep::isValid(identifier)) {        _WKPHBooleanReply(hostProxy->port(), instanceProxy->pluginID(), false);        return KERN_SUCCESS;    }            boolean_t returnValue;    if (identifier->isString()) {        Identifier propertyNameIdentifier = identifierFromIdentifierRep(identifier);                returnValue = instanceProxy->hasProperty(objectID, propertyNameIdentifier);    } else         returnValue = instanceProxy->hasProperty(objectID, identifier->number());        _WKPHBooleanReply(hostProxy->port(), instanceProxy->pluginID(), returnValue);        return KERN_SUCCESS;}kern_return_t WKPCHasMethod(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID, uint64_t serverIdentifier){    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;        PluginDestroyDeferrer deferrer(instanceProxy);    IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);    if (!IdentifierRep::isValid(identifier)) {        _WKPHBooleanReply(hostProxy->port(), instanceProxy->pluginID(), false);        return KERN_SUCCESS;    }        Identifier methodNameIdentifier = identifierFromIdentifierRep(identifier);            boolean_t returnValue = instanceProxy->hasMethod(objectID, methodNameIdentifier);    _WKPHBooleanReply(hostProxy->port(), instanceProxy->pluginID(), returnValue);    return KERN_SUCCESS;}kern_return_t WKPCIdentifierInfo(mach_port_t clientPort, uint64_t serverIdentifier, data_t* infoData, mach_msg_type_number_t* infoLength){    IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);    if (!IdentifierRep::isValid(identifier))        return KERN_FAILURE;        id info;    if (identifier->isString()) {        const char* str = identifier->string();        info = [NSData dataWithBytesNoCopy:(void*)str length:strlen(str) freeWhenDone:NO];    } else         info = [NSNumber numberWithInt:identifier->number()];    RetainPtr<NSData*> data = [NSPropertyListSerialization dataFromPropertyList:info format:NSPropertyListBinaryFormat_v1_0 errorDescription:0];    ASSERT(data);        *infoLength = [data.get() length];    mig_allocate(reinterpret_cast<vm_address_t*>(infoData), *infoLength);        memcpy(*infoData, [data.get() bytes], *infoLength);        return KERN_SUCCESS;}kern_return_t WKPCEnumerate(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID){    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);    if (!instanceProxy)        return KERN_FAILURE;        data_t resultData = 0;    mach_msg_type_number_t resultLength = 0;        boolean_t returnValue = instanceProxy->enumerate(objectID, resultData, resultLength);        _WKPHBooleanAndDataReply(hostProxy->port(), instanceProxy->pluginID(), returnValue, resultData, resultLength);    mig_deallocate(reinterpret_cast<vm_address_t>(resultData), resultLength);        return KERN_SUCCESS;}kern_return_t WKPCSetMenuBarVisible(mach_port_t clientPort, boolean_t menuBarVisible){    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;    hostProxy->setMenuBarVisible(menuBarVisible);        return KERN_SUCCESS;}kern_return_t WKPCSetModal(mach_port_t clientPort, boolean_t modal){    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);    if (!hostProxy)        return KERN_FAILURE;        hostProxy->setModal(modal);        return KERN_SUCCESS;}#endif // USE(PLUGIN_HOST_PROCESS)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -