void WebFrameLoaderClient::download(ResourceHandle* handle, const ResourceRequest& request, const ResourceRequest&, const ResourceResponse& response)
{
    SharedPtr<WebDownloadDelegate> downloadDelegate;
    WebView* webView = m_webFrame->webView();
    downloadDelegate = webView->downloadDelegate();
    if(downloadDelegate)
    {
        WebDownload* download = WebDownload::createInstance(handle, &request, &response, downloadDelegate);
        download->start();
    }
}
Beispiel #2
0
void WebFrame::download(ResourceHandle* handle, const ResourceRequest& request, const ResourceRequest&, const ResourceResponse& response)
{
    DefaultDownloadDelegate* downloadDelegate;
    WebView* webView = this->webView();
    downloadDelegate = webView->downloadDelegate();
    if(!downloadDelegate)
    {
        // If the WebView doesn't successfully provide a download delegate we'll pass a null one
        // into the WebDownload - which may or may not decide to use a DefaultDownloadDelegate
        //LOG_ERROR("Failed to get downloadDelegate from WebView");
        downloadDelegate = 0;
    }

    // Its the delegate's job to ref the WebDownload to keep it alive - otherwise it will be destroyed
    // when this method returns
    WebDownload* download = WebDownload::createInstance(handle, request, response, downloadDelegate);
    delete download;
}