aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-web-view.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-06-22 17:03:36 +0800
committerCarlos Garcia Campos <carlosgc@gnome.org>2012-06-27 20:16:00 +0800
commit7e1964acdacd4bdf4e23e85ec733fe9e92688ca6 (patch)
tree6acf7bf26c7b8ddf0e4a5161122fccc3c2cd46c2 /embed/ephy-web-view.c
parent39931fc51a3a668d04f938fa555bdf9a4abf3056 (diff)
downloadgsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.tar
gsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.tar.gz
gsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.tar.bz2
gsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.tar.lz
gsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.tar.xz
gsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.tar.zst
gsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.zip
Port downloads to WebKit2
https://bugzilla.gnome.org/show_bug.cgi?id=678612
Diffstat (limited to 'embed/ephy-web-view.c')
-rw-r--r--embed/ephy-web-view.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 83a89bf94..2a21b0b70 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1689,8 +1689,12 @@ decide_policy_cb (WebKitWebView *web_view,
{
WebKitResponsePolicyDecision *response_decision;
WebKitURIResponse *response;
+ WebKitURIRequest *request;
EphyWebViewDocumentType type;
+ GObject *single;
const char *mime_type;
+ const char *uri;
+ gboolean handled = FALSE;
if (decision_type != WEBKIT_POLICY_DECISION_TYPE_RESPONSE)
return FALSE;
@@ -1716,27 +1720,25 @@ decide_policy_cb (WebKitWebView *web_view,
g_object_notify (G_OBJECT (web_view), "document-type");
}
+ /* If WebKit can't handle the mime type start the download
+ process */
+ if (webkit_web_view_can_show_mime_type (web_view, mime_type))
+ return FALSE;
+
/* TODO: Check also Content-Disposition header before emitting
* handle-content signal. We need API for that in WebKit2.
*/
- if (!webkit_web_view_can_show_mime_type (web_view, mime_type)) {
- GObject *single;
- WebKitURIRequest *request;
- const char *uri;
- gboolean handled = FALSE;
+ single = ephy_embed_shell_get_embed_single (embed_shell);
+ request = webkit_response_policy_decision_get_request (response_decision);
+ uri = webkit_uri_request_get_uri (request);
+ g_signal_emit_by_name (single, "handle-content", mime_type, uri, &handled);
- single = ephy_embed_shell_get_embed_single (embed_shell);
- request = webkit_response_policy_decision_get_request (response_decision);
- g_signal_emit_by_name (single, "handle-content", mime_type, uri, &handled);
-
- if (handled) {
- webkit_policy_decision_ignore (decision);
-
- return TRUE;
- }
- }
+ if (handled)
+ webkit_policy_decision_ignore (decision);
+ else
+ webkit_policy_decision_download (decision);
- return FALSE;
+ return TRUE;
}
#else
static gboolean