![]() | ![]() | ![]() | Epiphany Reference Manual | ![]() |
---|
EphyPermissionManager — Sets webpages' cookie, image and popup permissions.
struct EphyPermissionInfo; enum EphyPermissionType; enum EphyPermission; void ephy_permission_info_free (EphyPermissionInfo *info); void ephy_permission_manager_add (EphyPermissionManager *manager, const char *host, EphyPermissionType type, EphyPermission permission); void ephy_permission_manager_remove (EphyPermissionManager *manager, const char *host, EphyPermissionType type); void ephy_permission_manager_clear (EphyPermissionManager *manager); EphyPermission ephy_permission_manager_test (EphyPermissionManager *manager, const char *host, EphyPermissionType type); GList* ephy_permission_manager_list (EphyPermissionManager *manager, EphyPermissionType type);
The EphyPermissionManager keeps a list of websites and their permissions. For example, the user may want a certain website to display images but block cookies and popup windows; this could correspond to three entries in the EphyPermissionManager.
Use ephy_permission_manager_add() to set permissions for a website, ephy_permission_manager_remove() to remove the permissions, and ephy_permission_manager_test() to test them. Note that ephy_permission_manager_test() may return EPHY_PERMISSION_DEFAULT, which means the caller might need to find the default permission some other way.
The EphyPermissionManager stores a list of site-specific permissions, but not defaults. For popups, the default permission is determined by the GConf key /apps/epiphany/web/allow_popups, which in turn determines Mozilla's dom.disable_open_during_load preference. For cookies, the GConf key /apps/epiphany/web/cookie_accept determines Mozilla's network.cookie.cookieBehavior preference. For images, the default is determined by Mozilla's network.image.imageBehavior preference.
Though the word "host" is used in many function descriptions, Mozilla does not act as one would expect. Always pass a URL to any functions which need have a "host" parameter. However, the "host" in an EphyPermissionInfo is a simple DNS hostname.
struct EphyPermissionInfo { char *host; EphyPermissionType type; EphyPermission permission; };
Details a specific permission of a specific website.
char *host | The hostname of the website to which this permission applies. |
EphyPermissionType type | An EphyPermissionType. |
EphyPermission permission | An EphyPermission (either allow or deny). |
typedef enum { EPT_COOKIE, EPT_IMAGE, EPT_POPUP } EphyPermissionType;
Determines what permission we're dealing with.
EPT_COOKIE | Permission for the website to store cookies on the user's computer. |
EPT_IMAGE | Permission for the website to show images to the user. |
EPT_POPUP | Permission for the website to open popup windows (using JavaScript). |
typedef enum { EPHY_PERMISSION_ALLOWED, EPHY_PERMISSION_DENIED, EPHY_PERMISSION_DEFAULT } EphyPermission;
Determines whether the website is allowed or denied access.
EPHY_PERMISSION_ALLOWED | The website is unconditionally allowed to perform the desired action. |
EPHY_PERMISSION_DENIED | The website is unconditionally denied to perform the desired action. |
EPHY_PERMISSION_DEFAULT | The user has not set a preference for this particular website; the caller should therefore fall back to default settings. |
void ephy_permission_info_free (EphyPermissionInfo *info);
Frees info.
info : | an EphyPermissionInfo |
void ephy_permission_manager_add (EphyPermissionManager *manager, const char *host, EphyPermissionType type, EphyPermission permission);
Adds the specified permission to the permissions database.
manager : | the EphyPermissionManager |
host : | a website URL |
type : | an EphyPermissionType |
permission : | either EPHY_PERMISSION_ALLOWED or EPHY_PERMISSION_DENIED |
void ephy_permission_manager_remove (EphyPermissionManager *manager, const char *host, EphyPermissionType type);
Removes the specified permission from the permissions database. This implies that the browser should use defaults when next visiting the specified host's web pages.
manager : | the EphyPermissionManager |
host : | a website URL |
type : | an EphyPermissionType |
void ephy_permission_manager_clear (EphyPermissionManager *manager);
Clears the permissions database. This cannot be undone.
manager : | the EphyPermissionManager |
EphyPermission ephy_permission_manager_test (EphyPermissionManager *manager, const char *host, EphyPermissionType type);
Retrieves an EphyPermissionType from the permissions database. If there is no entry for this type and host, it will return EPHY_PERMISSION_DEFAULT. In that case, the caller may need to determine the appropriate default behavior.
manager : | the EphyPermissionManager |
host : | a website URL |
type : | an EphyPermissionType |
Returns : | the permission of type EphyPermission |
GList* ephy_permission_manager_list (EphyPermissionManager *manager, EphyPermissionType type);
Lists all permission entries of type type in the permissions database, each as its own EphyPermissionInfo. These entries must be freed using ephy_permission_info_free().
manager : | the EphyPermissionManager |
type : | an EphyPermissionType |
Returns : | the list of permission database entries |
<< Epiphany | EphyWindow >> |