diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2014-07-02 09:21:47 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2014-08-06 12:44:31 +0200 |
commit | d8e50b380dbad791cf0bfeaba0314ec30d88b82a (patch) | |
tree | 875ebcd5e52ec5ec002a63c09f2a0a34c1358c49 /src/ephy-window.c | |
parent | 6476f3a5d0f11c3a46a0d19e76862f74304d683f (diff) | |
download | epiphany-d8e50b380dbad791cf0bfeaba0314ec30d88b82a.tar.gz |
Add support for downloads from evince browser plugin
Enable javascript popups in WebKit by default and block them from
epiphany in the policy checker callback. Evince browser plugin allows to
download the current document only when the user agent contains
Epiphany, by using a special target frame name. When we detect that
target name in the policy checker callback we convert the request into a
download.
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r-- | src/ephy-window.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c index 6fa09b800..a74442b48 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -2111,6 +2111,24 @@ decide_policy_cb (WebKitWebView *web_view, return TRUE; } + if (decision_type == WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION) + { + const char *frame_name = webkit_navigation_policy_decision_get_frame_name (navigation_decision); + + if (g_strcmp0 (frame_name, "_evince_download") == 0) + { + /* The Evince Browser Plugin is requesting us to downlod the document */ + webkit_policy_decision_download (decision); + return TRUE; + } + + if (!g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_POPUPS)) + { + webkit_policy_decision_ignore (decision); + return TRUE; + } + } + navigation_type = webkit_navigation_policy_decision_get_navigation_type (navigation_decision); if (navigation_type == WEBKIT_NAVIGATION_TYPE_LINK_CLICKED && |