/**
 * webkit_network_response_get_suggested_filename:
 * @response: a #WebKitNetworkResponse
 *
 * Obtains the suggested filename for the given network response. The
 * suggested filename is taken from the 'Content-Disposition' HTTP
 * header, but this is not always present, and this method will return
 * %NULL in such case.
 *
 * Returns: (transfer none): the suggested filename or %NULL if not present
 * Since: 1.10
 **/
const gchar* webkit_network_response_get_suggested_filename(WebKitNetworkResponse* response)
{
    g_return_val_if_fail(WEBKIT_IS_NETWORK_RESPONSE(response), 0);

    WebKitNetworkResponsePrivate* priv = response->priv;

    if (priv->suggestedFilename)
        return priv->suggestedFilename;

    WebCore::ResourceResponse coreResponse = core(response);
    priv->suggestedFilename = g_strdup(coreResponse.suggestedFilename().utf8().data());
    return priv->suggestedFilename;
}
示例#2
0
void DumpRenderTree::didDecidePolicyForResponse(const WebCore::ResourceResponse& response)
{
    if (!testDone && m_policyDelegateEnabled) {
        if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::ContentDispositionAttachment)
            printf("Policy delegate: resource is an attachment, suggested file name '%s'\n", response.suggestedFilename().utf8().data());
        if (waitForPolicy)
            gTestRunner->notifyDone();
    }
}