Ejemplo n.º 1
0
void WebFormClient::willSubmitForm(WebPageProxy& page, WebFrameProxy& frame, WebFrameProxy& sourceFrame, const Vector<std::pair<String, String>>& textFieldValues, API::Object* userData, Ref<WebFormSubmissionListenerProxy>&& listener)
{
    if (!m_client.willSubmitForm) {
        listener->continueSubmission();
        return;
    }

    API::Dictionary::MapType map;
    for (size_t i = 0; i < textFieldValues.size(); ++i)
        map.set(textFieldValues[i].first, API::String::create(textFieldValues[i].second));
    RefPtr<API::Dictionary> textFieldsMap = API::Dictionary::create(WTF::move(map));
    m_client.willSubmitForm(toAPI(&page), toAPI(&frame), toAPI(&sourceFrame), toAPI(textFieldsMap.get()), toAPI(userData), toAPI(&listener.get()), m_client.base.clientInfo);
}
Ejemplo n.º 2
0
void WebProcessPool::pluginInfoStoreDidLoadPlugins(PluginInfoStore* store)
{
#ifdef NDEBUG
    UNUSED_PARAM(store);
#endif
    ASSERT(store == &m_pluginInfoStore);

    Vector<PluginModuleInfo> pluginModules = m_pluginInfoStore.plugins();

    Vector<RefPtr<API::Object>> plugins;
    plugins.reserveInitialCapacity(pluginModules.size());

    for (const auto& pluginModule : pluginModules) {
        API::Dictionary::MapType map;
        map.set(ASCIILiteral("path"), API::String::create(pluginModule.path));
        map.set(ASCIILiteral("name"), API::String::create(pluginModule.info.name));
        map.set(ASCIILiteral("file"), API::String::create(pluginModule.info.file));
        map.set(ASCIILiteral("desc"), API::String::create(pluginModule.info.desc));

        Vector<RefPtr<API::Object>> mimeTypes;
        mimeTypes.reserveInitialCapacity(pluginModule.info.mimes.size());
        for (const auto& mimeClassInfo : pluginModule.info.mimes)
            mimeTypes.uncheckedAppend(API::String::create(mimeClassInfo.type));
        map.set(ASCIILiteral("mimes"), API::Array::create(WTFMove(mimeTypes)));

#if PLATFORM(COCOA)
        map.set(ASCIILiteral("bundleId"), API::String::create(pluginModule.bundleIdentifier));
        map.set(ASCIILiteral("version"), API::String::create(pluginModule.versionString));
#endif

        plugins.uncheckedAppend(API::Dictionary::create(WTFMove(map)));
    }

    m_client.plugInInformationBecameAvailable(this, API::Array::create(WTFMove(plugins)).ptr());
}