summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@redhat.com>2023-05-01 16:17:28 -0500
committerMarge Bot <marge-bot@gnome.org>2023-05-07 22:22:46 +0000
commit8cb10cb2285b6c80290eb1954a8c9b65e8491e9b (patch)
tree9c3e5f5dec78eafa7fbabe2f7f2b6a33f0afa12c
parent5a79d275c7c3b6efc0c0bd9aa1efbc0dcf7e8f6d (diff)
downloadepiphany-8cb10cb2285b6c80290eb1954a8c9b65e8491e9b.tar.gz
Support clipboard access permission request
Test page: https://googlechrome.github.io/samples/async-clipboard/ Click the Paste button before Copy is clicked to trigger the permission request. (Note the Permissions buttons are Chrome-specific and will not work.) https://commits.webkit.org/262202@main Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1327>
-rw-r--r--embed/ephy-web-view.c2
-rw-r--r--lib/ephy-permissions-manager.c4
-rw-r--r--lib/ephy-permissions-manager.h1
-rw-r--r--meson.build2
-rw-r--r--src/ephy-permission-popover.c7
5 files changed, 14 insertions, 2 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 97da49b0d..3bb439e3e 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -944,6 +944,8 @@ permission_request_cb (WebKitWebView *web_view,
permission_type = EPHY_PERMISSION_TYPE_ACCESS_LOCATION;
} else if (WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST (decision)) {
permission_type = EPHY_PERMISSION_TYPE_SHOW_NOTIFICATIONS;
+ } else if (WEBKIT_IS_CLIPBOARD_PERMISSION_REQUEST (decision)) {
+ permission_type = EPHY_PERMISSION_TYPE_CLIPBOARD;
} else if (WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST (decision)) {
gboolean is_for_audio_device = webkit_user_media_permission_is_for_audio_device (WEBKIT_USER_MEDIA_PERMISSION_REQUEST (decision));
gboolean is_for_video_device = webkit_user_media_permission_is_for_video_device (WEBKIT_USER_MEDIA_PERMISSION_REQUEST (decision));
diff --git a/lib/ephy-permissions-manager.c b/lib/ephy-permissions-manager.c
index 9901bc99e..e5af1e779 100644
--- a/lib/ephy-permissions-manager.c
+++ b/lib/ephy-permissions-manager.c
@@ -186,8 +186,10 @@ ephy_permission_is_stored_by_permissions_manager (EphyPermissionType type)
{
switch (type) {
case EPHY_PERMISSION_TYPE_ACCESS_WEBCAM_AND_MICROPHONE:
- /* fallthrough */
+ /* fallthrough */
case EPHY_PERMISSION_TYPE_COOKIES:
+ /* fallthrough */
+ case EPHY_PERMISSION_TYPE_CLIPBOARD:
return FALSE;
default:
return TRUE;
diff --git a/lib/ephy-permissions-manager.h b/lib/ephy-permissions-manager.h
index 788774a49..478a899e2 100644
--- a/lib/ephy-permissions-manager.h
+++ b/lib/ephy-permissions-manager.h
@@ -46,6 +46,7 @@ typedef enum {
EPHY_PERMISSION_TYPE_AUTOPLAY_POLICY,
EPHY_PERMISSION_TYPE_ACCESS_WEBCAM_AND_MICROPHONE,
EPHY_PERMISSION_TYPE_COOKIES,
+ EPHY_PERMISSION_TYPE_CLIPBOARD
} EphyPermissionType;
EphyPermissionsManager *ephy_permissions_manager_new (void);
diff --git a/meson.build b/meson.build
index 501389677..2061b89e7 100644
--- a/meson.build
+++ b/meson.build
@@ -77,7 +77,7 @@ glib_requirement = '>= 2.74.0'
gtk_requirement = '>= 4.9.3'
libadwaita_requirement = '>= 1.4.alpha'
nettle_requirement = '>= 3.4'
-webkitgtk_requirement = '>= 2.39.91'
+webkitgtk_requirement = '>= 2.41.1'
conf.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_74')
conf.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_2_74')
diff --git a/src/ephy-permission-popover.c b/src/ephy-permission-popover.c
index c2f47bd3f..6068f2439 100644
--- a/src/ephy-permission-popover.c
+++ b/src/ephy-permission-popover.c
@@ -310,6 +310,13 @@ ephy_permission_popover_get_text (EphyPermissionPopover *self,
*message = g_strdup_printf (_("The page at “%s” would like to access its own data (including cookies) while browsing “%s”. This will allow “%s” to track your activity on “%s”."),
requesting_domain, current_domain, requesting_domain, current_domain);
break;
+ case EPHY_PERMISSION_TYPE_CLIPBOARD:
+ /* Translators: Clipboard policy for a specific site. */
+ *title = g_strdup (_("Clipboard Access Request"));
+ /* Translators: Clipboard policy for a specific site. */
+ *message = g_strdup_printf (_("The page at “%s” would like to access your clipboard"),
+ bold_origin);
+ break;
default:
g_assert_not_reached ();
}