summaryrefslogtreecommitdiff
path: root/surf.c
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2017-05-18 11:20:07 +0200
committerQuentin Rameau <quinq@fifth.space>2017-05-21 17:13:02 +0200
commitbcd05ae321de686840fd560931f2894f62ba8345 (patch)
tree59aff122214e5ff74f3e1ef286d1eaf100a853ff /surf.c
parentf5be376ccc1fef96722df610c4783e99ce1e944e (diff)
downloadsurf-bcd05ae321de686840fd560931f2894f62ba8345.tar.gz
surf-bcd05ae321de686840fd560931f2894f62ba8345.tar.bz2
surf-bcd05ae321de686840fd560931f2894f62ba8345.zip
Add config option for microphone and webcam access
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/surf.c b/surf.c
index 2d3a6f5..c11a095 100644
--- a/surf.c
+++ b/surf.c
@@ -61,6 +61,8 @@ enum {
typedef enum {
AcceleratedCanvas,
+ AccessMicrophone,
+ AccessWebcam,
CaretBrowsing,
Certificate,
CookiePolicies,
@@ -678,6 +680,10 @@ setparameter(Client *c, int refresh, ParamName p, const Arg *a)
case AcceleratedCanvas:
webkit_settings_set_enable_accelerated_2d_canvas(s, a->b);
break;
+ case AccessMicrophone:
+ return; /* do nothing */
+ case AccessWebcam:
+ return; /* do nothing */
case CaretBrowsing:
webkit_settings_set_enable_caret_browsing(s, a->b);
refresh = 0;
@@ -1450,15 +1456,27 @@ mousetargetchanged(WebKitWebView *v, WebKitHitTestResult *h, guint modifiers,
gboolean
permissionrequested(WebKitWebView *v, WebKitPermissionRequest *r, Client *c)
{
+ ParamName param = ParameterLast;
+
if (WEBKIT_IS_GEOLOCATION_PERMISSION_REQUEST(r)) {
- if (curconfig[Geolocation].val.b)
- webkit_permission_request_allow(r);
- else
- webkit_permission_request_deny(r);
- return TRUE;
+ param = Geolocation;
+ } else if (WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST(r)) {
+ if (webkit_user_media_permission_is_for_audio_device(
+ WEBKIT_USER_MEDIA_PERMISSION_REQUEST(r)))
+ param = AccessMicrophone;
+ else if (webkit_user_media_permission_is_for_video_device(
+ WEBKIT_USER_MEDIA_PERMISSION_REQUEST(r)))
+ param = AccessWebcam;
+ } else {
+ return FALSE;
}
- return FALSE;
+ if (curconfig[param].val.b)
+ webkit_permission_request_allow(r);
+ else
+ webkit_permission_request_deny(r);
+
+ return TRUE;
}
gboolean