summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c9
-rw-r--r--src/setting.c12
2 files changed, 20 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index d6ace19..9d4610e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2012,7 +2012,14 @@ static gboolean on_permission_request(WebKitWebView *webview,
char *msg = NULL;
if (WEBKIT_IS_GEOLOCATION_PERMISSION_REQUEST(request)) {
- msg = "request your location";
+ char* geolocation_setting = GET_CHAR(c, "geolocation");
+ if (strcmp(geolocation_setting, "ask") == 0) {
+ msg = "access your location";
+ } else if (strcmp(geolocation_setting, "always") == 0) {
+ return TRUE;
+ } else if (strcmp(geolocation_setting, "never") == 0) {
+ return FALSE;
+ }
} else if (WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST(request)) {
if (webkit_user_media_permission_is_for_audio_device(WEBKIT_USER_MEDIA_PERMISSION_REQUEST(request))) {
msg = "access the microphone";
diff --git a/src/setting.c b/src/setting.c
index fbdd680..75505fa 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -53,6 +53,7 @@ static void setting_free(Setting *s);
static int cookie_accept(Client *c, const char *name, DataType type, void *value, void *data);
static int default_zoom(Client *c, const char *name, DataType type, void *value, void *data);
static int fullscreen(Client *c, const char *name, DataType type, void *value, void *data);
+static int geolocation(Client *c, const char *name, DataType type, void *value, void *data);
static int gui_style(Client *c, const char *name, DataType type, void *value, void *data);
static int hardware_acceleration_policy(Client *c, const char *name, DataType type, void *value, void *data);
static int input_autohide(Client *c, const char *name, DataType type, void *value, void *data);
@@ -90,6 +91,7 @@ void setting_init(Client *c)
i = SETTING_DEFAULT_FONT_SIZE;
setting_add(c, "font-size", TYPE_INTEGER, &i, webkit, 0, "default-font-size");
setting_add(c, "frame-flattening", TYPE_BOOLEAN, &off, webkit, 0, "enable-frame-flattening");
+ setting_add(c, "geolocation", TYPE_CHAR, &"ask", geolocation, FLAG_NODUP, NULL);
setting_add(c, "hardware-acceleration-policy", TYPE_CHAR, &"ondemand", hardware_acceleration_policy, FLAG_NODUP, NULL);
setting_add(c, "header", TYPE_CHAR, &"", headers, FLAG_LIST|FLAG_NODUP, "header");
i = 1000;
@@ -540,6 +542,16 @@ static int fullscreen(Client *c, const char *name, DataType type, void *value, v
return CMD_SUCCESS;
}
+static int geolocation(Client *c, const char *name, DataType type, void *value, void *data)
+{
+ char *policy = (char *)value;
+ if (strcmp("always", policy) != 0 && strcmp("ask", policy) != 0 && strcmp("never", policy) != 0) {
+ vb_echo(c, MSG_ERROR, FALSE, "%s must be in [always, ask, never]", name);
+ return CMD_ERROR | CMD_KEEPINPUT;
+ }
+ return CMD_SUCCESS;
+}
+
/* This needs to be called before the window is shown for the best chance of
* success, but it may be called at any time.
* Currently the setting file is read after the window has been shown, which