Exemple #1
0
void WebUIClient::unavailablePluginButtonClicked(WebPageProxy* page, WKPluginUnavailabilityReason pluginUnavailabilityReason, ImmutableDictionary* pluginInformation)
{
    if (pluginUnavailabilityReason == kWKPluginUnavailabilityReasonPluginMissing) {
        if (m_client.missingPluginButtonClicked_deprecatedForUseWithV0)
            m_client.missingPluginButtonClicked_deprecatedForUseWithV0(
                toAPI(page),
                toAPI(pluginInformation->get<WebString>(pluginInformationMIMETypeKey())),
                toAPI(pluginInformation->get<WebString>(pluginInformationPluginURLKey())),
                toAPI(pluginInformation->get<WebString>(pluginInformationPluginspageAttributeURLKey())),
                m_client.clientInfo);
    }

    if (m_client.unavailablePluginButtonClicked_deprecatedForUseWithV1)
        m_client.unavailablePluginButtonClicked_deprecatedForUseWithV1(
            toAPI(page),
            pluginUnavailabilityReason,
            toAPI(pluginInformation->get<WebString>(pluginInformationMIMETypeKey())),
            toAPI(pluginInformation->get<WebString>(pluginInformationPluginURLKey())),
            toAPI(pluginInformation->get<WebString>(pluginInformationPluginspageAttributeURLKey())),
            m_client.clientInfo);

    if (m_client.unavailablePluginButtonClicked)
        m_client.unavailablePluginButtonClicked(
            toAPI(page),
            pluginUnavailabilityReason,
            toAPI(pluginInformation),
            m_client.clientInfo);
}
PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const String& mimeType, const String& frameURLString, const String& pageURLString)
{
    ImmutableDictionary::MapType map;

    if (!frameURLString.isEmpty())
        map.set(pluginInformationFrameURLKey(), API::URL::create(frameURLString));
    if (!mimeType.isEmpty())
        map.set(pluginInformationMIMETypeKey(), API::String::create(mimeType));
    if (!pageURLString.isEmpty())
        map.set(pluginInformationPageURLKey(), API::URL::create(pageURLString));

    return ImmutableDictionary::create(std::move(map));
}
void WebLoaderClient::didFailToInitializePlugin(WebPageProxy* page, ImmutableDictionary* pluginInformation)
{
    if (m_client.didFailToInitializePlugin_deprecatedForUseWithV0)
        m_client.didFailToInitializePlugin_deprecatedForUseWithV0(
            toAPI(page),
            toAPI(pluginInformation->get<WebString>(pluginInformationMIMETypeKey())),
            m_client.clientInfo);

    if (m_client.pluginDidFail_deprecatedForUseWithV1)
        m_client.pluginDidFail_deprecatedForUseWithV1(
            toAPI(page),
            kWKErrorCodeCannotLoadPlugIn,
            toAPI(pluginInformation->get<WebString>(pluginInformationMIMETypeKey())),
            0,
            0,
            m_client.clientInfo);

    if (m_client.pluginDidFail)
        m_client.pluginDidFail(
            toAPI(page),
            kWKErrorCodeCannotLoadPlugIn,
            toAPI(pluginInformation),
            m_client.clientInfo);
}
void WebLoaderClient::didBlockInsecurePluginVersion(WebPageProxy* page, ImmutableDictionary* pluginInformation)
{
    if (m_client.pluginDidFail_deprecatedForUseWithV1)
        m_client.pluginDidFail_deprecatedForUseWithV1(
            toAPI(page),
            kWKErrorCodeInsecurePlugInVersion,
            toAPI(pluginInformation->get<WebString>(pluginInformationMIMETypeKey())),
            toAPI(pluginInformation->get<WebString>(pluginInformationBundleIdentifierKey())),
            toAPI(pluginInformation->get<WebString>(pluginInformationBundleVersionKey())),
            m_client.clientInfo);

    if (m_client.pluginDidFail)
        m_client.pluginDidFail(
            toAPI(page),
            kWKErrorCodeInsecurePlugInVersion,
            toAPI(pluginInformation),
            m_client.clientInfo);
}
PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const PluginModuleInfo& plugin, const String& frameURLString, const String& mimeType, const String& pageURLString, const String& pluginspageAttributeURLString, const String& pluginURLString, bool replacementObscured)
{
    ImmutableDictionary::MapType map;
    getPluginModuleInformation(plugin, map);

    if (!frameURLString.isEmpty())
        map.set(pluginInformationFrameURLKey(), API::URL::create(frameURLString));
    if (!mimeType.isEmpty())
        map.set(pluginInformationMIMETypeKey(), API::String::create(mimeType));
    if (!pageURLString.isEmpty())
        map.set(pluginInformationPageURLKey(), API::URL::create(pageURLString));
    if (!pluginspageAttributeURLString.isEmpty())
        map.set(pluginInformationPluginspageAttributeURLKey(), API::URL::create(pluginspageAttributeURLString));
    if (!pluginURLString.isEmpty())
        map.set(pluginInformationPluginURLKey(), API::URL::create(pluginURLString));
    map.set(plugInInformationReplacementObscuredKey(), API::Boolean::create(replacementObscured));

    return ImmutableDictionary::create(std::move(map));
}