1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* 3 * Copyright © 2015 Gustavo Noronha Silva <gns@gnome.org> 4 * Copyright © 2016 Igalia S.L. 5 * 6 * This file is part of Epiphany. 7 * 8 * Epiphany is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * Epiphany is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with Epiphany. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 22 #pragma once 23 24 #include <glib-object.h> 25 #include <jsc/jsc.h> 26 27 G_BEGIN_DECLS 28 29 #define EPHY_TYPE_PERMISSIONS_MANAGER (ephy_permissions_manager_get_type ()) 30 31 G_DECLARE_FINAL_TYPE (EphyPermissionsManager, ephy_permissions_manager, EPHY, PERMISSIONS_MANAGER, GObject) 32 33 typedef enum { 34 EPHY_PERMISSION_UNDECIDED = -1, 35 EPHY_PERMISSION_DENY = 0, 36 EPHY_PERMISSION_PERMIT = 1 37 } EphyPermission; 38 39 typedef enum { 40 EPHY_PERMISSION_TYPE_SHOW_NOTIFICATIONS, 41 EPHY_PERMISSION_TYPE_SAVE_PASSWORD, 42 EPHY_PERMISSION_TYPE_ACCESS_LOCATION, 43 EPHY_PERMISSION_TYPE_ACCESS_MICROPHONE, 44 EPHY_PERMISSION_TYPE_ACCESS_WEBCAM, 45 EPHY_PERMISSION_TYPE_SHOW_ADS, 46 EPHY_PERMISSION_TYPE_AUTOPLAY_POLICY, 47 EPHY_PERMISSION_TYPE_ACCESS_WEBCAM_AND_MICROPHONE, 48 } EphyPermissionType; 49 50 EphyPermissionsManager *ephy_permissions_manager_new (void); 51 52 EphyPermission ephy_permissions_manager_get_permission (EphyPermissionsManager *manager, 53 EphyPermissionType type, 54 const char *origin); 55 void ephy_permissions_manager_set_permission (EphyPermissionsManager *manager, 56 EphyPermissionType type, 57 const char *origin, 58 EphyPermission permission); 59 60 GList *ephy_permissions_manager_get_permitted_origins (EphyPermissionsManager *manager, 61 EphyPermissionType type); 62 GList *ephy_permissions_manager_get_denied_origins (EphyPermissionsManager *manager, 63 EphyPermissionType type); 64 65 void ephy_permissions_manager_export_to_js_context (EphyPermissionsManager *manager, 66 JSCContext *js_context, 67 JSCValue *js_namespace); 68 69 G_END_DECLS 70