diff options
author | Gustavo Noronha Silva <gns@gnome.org> | 2014-12-09 15:19:57 +0100 |
---|---|---|
committer | Gustavo Noronha Silva <gns@gnome.org> | 2014-12-16 08:33:50 -0200 |
commit | 10b74cc94f396120d3644de4ea3b8bbb0b33c606 (patch) | |
tree | 9d2de6394e0a8371a320f5f2066078f863e03fbc /embed/ephy-web-view.c | |
parent | 5b25f91f8449db3d032b949a58c806928f5c0b24 (diff) | |
download | epiphany-10b74cc94f396120d3644de4ea3b8bbb0b33c606.tar.gz |
Also handle notification permission requests
Now that WebKit has API and a default implementation for HTML5 notifications,
handle premissions for those requests as well.
This needs this patch: http://webkit.org/b/61140
https://bugzilla.gnome.org/show_bug.cgi?id=741295
Diffstat (limited to 'embed/ephy-web-view.c')
-rw-r--r-- | embed/ephy-web-view.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 61dcd08d4..5998dcf22 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -1379,9 +1379,9 @@ decide_policy_cb (WebKitWebView *web_view, } static void -decide_on_geolocation_policy_request (GtkWidget *info_bar, - int response, - WebKitPermissionRequest *request) +decide_on_permission_request (GtkWidget *info_bar, + int response, + WebKitPermissionRequest *request) { gtk_widget_destroy (info_bar); @@ -1409,7 +1409,8 @@ permission_request_cb (WebKitWebView *web_view, char *message; char *host; - if (!WEBKIT_IS_GEOLOCATION_PERMISSION_REQUEST (decision)) + if (!WEBKIT_IS_GEOLOCATION_PERMISSION_REQUEST (decision) && + !WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST (decision)) return FALSE; info_bar = gtk_info_bar_new_with_buttons (_("Deny"), GTK_RESPONSE_NO, @@ -1417,14 +1418,22 @@ permission_request_cb (WebKitWebView *web_view, NULL); action_area = gtk_info_bar_get_action_area (GTK_INFO_BAR (info_bar)); - /* Translators: Geolocation policy for a specific site. */ gtk_orientable_set_orientation (GTK_ORIENTABLE (action_area), GTK_ORIENTATION_HORIZONTAL); /* Label */ host = ephy_string_get_host_name (webkit_web_view_get_uri (web_view)); - message = g_markup_printf_escaped (_("The page at <b>%s</b> wants to know your location."), - host); + + if (WEBKIT_IS_GEOLOCATION_PERMISSION_REQUEST (decision)) { + /* Translators: Geolocation policy for a specific site. */ + message = g_markup_printf_escaped (_("The page at <b>%s</b> wants to know your location."), + host); + } else { + /* Translators: Notification policy for a specific site. */ + message = g_markup_printf_escaped (_("The page at <b>%s</b> wants to show desktop notifications."), + host); + } + g_free (host); label = gtk_label_new (NULL); @@ -1440,7 +1449,7 @@ permission_request_cb (WebKitWebView *web_view, /* Ref the decision, to keep it alive while we decide */ g_signal_connect (info_bar, "response", - G_CALLBACK (decide_on_geolocation_policy_request), + G_CALLBACK (decide_on_permission_request), g_object_ref (decision)); ephy_embed_add_top_widget (EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view), |