aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r--src/ephy-window.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 3fcd3eed0..5b309a09c 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -54,6 +54,7 @@
#include "ephy-shell.h"
#include "ephy-toolbar.h"
#include "ephy-type-builtins.h"
+#include "ephy-web-app-utils.h"
#include "ephy-web-view.h"
#include "ephy-zoom-action.h"
#include "ephy-zoom.h"
@@ -2466,6 +2467,28 @@ create_web_view_cb (WebKitWebView *web_view,
return new_web_view;
}
+static void
+delete_web_app (const char *request_uri)
+{
+ SoupURI *uri = soup_uri_new (request_uri);
+
+ if (uri->query)
+ {
+ GHashTable *form;
+ const char *app_id;
+
+ form = soup_form_decode (uri->query);
+ app_id = g_hash_table_lookup (form, "app_id");
+ if (app_id)
+ {
+ ephy_web_application_delete (app_id);
+ }
+ g_hash_table_destroy (form);
+ }
+
+ soup_uri_free (uri);
+}
+
#ifdef HAVE_WEBKIT2
static gboolean
decide_policy_cb (WebKitWebView *web_view,
@@ -2737,6 +2760,15 @@ policy_decision_required_cb (WebKitWebView *web_view,
return TRUE;
}
+ if (reason == WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED && uri &&
+ g_str_has_prefix (uri, "ephy-about:applications"))
+ {
+ delete_web_app (uri);
+ webkit_web_policy_decision_use (decision);
+
+ return TRUE;
+ }
+
return FALSE;
}
#endif