El mar, 27-01-2015 a las 18:27 -0500, Nicolas Jäger escribió:
> Hi,
> I'm struggling to make my web browser able to download.
> What I'm doing, is trough the policies, when I got a,
>
> |
> |WEBKIT_POLICY_DECISION_TYPE_RESPONSE
> |
>
> then I check the mime type to decide to download it or not
>
> |
> |WebKitResponsePolicyDecision* responseDecision =
> |WEBKIT_RESPONSE_POLICY_DECISION (decision);
> |
> |response = webkit_response_policy_decision_get_response
> |(responseDecision);
> |
> |mimeType = webkit_uri_response_get_mime_type(response);
> |
> |if( !webkit_response_policy_decision_is_mime_type_supported(
> responseDecision)
> | || mimeType == "application/pdf" ) {
> | webkit_policy_decision_download( decision );
> |}
> |
>
> also, I have this function :
>
> |
> |static
> |void
> |downloadRequestedGC( WebKitWebView* webview
> | , WebKitDownload* download
> | , gboolean* handled
> | )
> |{
> | std::cout << "downloadRequestedGC" << std::endl;
> | std::string destination = "file:////home/user/test";
> | // what to do before ?
> | webkit_download_set_destination(download,destination.c_str());
> | // what to do next ?
> |}
> |Where's this callback connected? We don't have any download-requested signal in WebKitWebView. It seems to me you are mixing the WebKit1 and WebKit2 APIs somehow, because in WebKit1 there's download-requested signal in WebKitWebView. In WebKit2, downloads are handled by the WebKitWebContext. There's WebKitWebContext::download-started signal that is emitted every time a new download is started either by the policy checker (webkit_policy_decision_download) or by the API. You can start a download manually with webkit_web_context_download_uri() that returns the WebKitDownload object. > First I don't know how to send a signal like "I want to download". > because if I click on file, I never get downloadRequestedGC called. > Second I don't see some function like "start the download" in the API. See: http://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebContext.html#webkit-web-context-download-uri http://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebContext.html#WebKitWebContext-download-started http://webkitgtk.org/reference/webkit2gtk/stable/WebKitDownload.html > regards, > /nicoo > _______________________________________________ > webkit-gtk mailing list > [email protected] > https://lists.webkit.org/mailman/listinfo/webkit-gtk > -- Carlos Garcia Campos http://pgp.rediris.es:11371/pks/lookup?op=get&search=0xF3D322D0EC4582C3
signature.asc
Description: This is a digitally signed message part
_______________________________________________ webkit-gtk mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-gtk
