<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="epiphany-EphyPermissionManager">
<refmeta>
<refentrytitle role="top_of_page" id="epiphany-EphyPermissionManager.top_of_page">EphyPermissionManager</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>EPIPHANY Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>EphyPermissionManager</refname>
<refpurpose>Sets webpages' cookie, image and popup permissions.</refpurpose>
</refnamediv>

<refsynopsisdiv id="epiphany-EphyPermissionManager.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
                    <link linkend="EphyPermissionInfo">EphyPermissionInfo</link>;
enum                <link linkend="EphyPermission">EphyPermission</link>;
<link linkend="void">void</link>                <link linkend="ephy-permission-info-free">ephy_permission_info_free</link>           (<link linkend="EphyPermissionInfo">EphyPermissionInfo</link> *info);
</synopsis>
</refsynopsisdiv>









<refsect1 id="epiphany-EphyPermissionManager.description" role="desc">
<title role="desc.title">Description</title>
<para>
The <link linkend="EphyPermissionManager"><type>EphyPermissionManager</type></link> 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
<link linkend="EphyPermissionManager"><type>EphyPermissionManager</type></link>.
</para>
<para>
Use <link linkend="ephy-permission-manager-add"><function>ephy_permission_manager_add()</function></link> to set permissions for a website,
<link linkend="ephy-permission-manager-remove"><function>ephy_permission_manager_remove()</function></link> to remove the permissions, and
<link linkend="ephy-permission-manager-test"><function>ephy_permission_manager_test()</function></link> to test them. Note that
<link linkend="ephy-permission-manager-test"><function>ephy_permission_manager_test()</function></link> may return <link linkend="EPHY-PERMISSION-DEFAULT--CAPS"><literal>EPHY_PERMISSION_DEFAULT</literal></link>, which
means the caller might need to find the default permission some other way.
</para>
<para>
The <link linkend="EphyPermissionManager"><type>EphyPermissionManager</type></link> 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.
</para>
<para>
The predefined permission types are EPT_COOKIE ("cookie"), EPT_IMAGE ("image")
and EPT_POPUP ("popup"). You can also make up your own type string.
</para>
<para>
Though the word &quot;host&quot; 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 &quot;host&quot; parameter. However, the &quot;host&quot; in an
<link linkend="EphyPermissionInfo"><type>EphyPermissionInfo</type></link> is a simple DNS hostname.
</para>
</refsect1>

<refsect1 id="epiphany-EphyPermissionManager.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="EphyPermissionInfo" role="struct">
<title>EphyPermissionInfo</title>
<indexterm zone="EphyPermissionInfo"><primary sortas="EphyPermissionInfo">EphyPermissionInfo</primary></indexterm><programlisting>typedef struct {
	char *host;
	GQuark qtype;
	EphyPermission permission;
} EphyPermissionInfo;
</programlisting>
<para>
Details a specific permission of a specific website.
</para><variablelist role="struct">
<varlistentry>
<term><link linkend="char">char</link>&#160;*<structfield>host</structfield>;</term>
<listitem><simpara>The hostname of the website to which this permission applies.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GQuark">GQuark</link>&#160;<structfield>qtype</structfield>;</term>
<listitem><simpara>
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="EphyPermission">EphyPermission</link>&#160;<structfield>permission</structfield>;</term>
<listitem><simpara>An <link linkend="EphyPermission"><type>EphyPermission</type></link> (either allow or deny).
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="EphyPermission" role="enum">
<title>enum EphyPermission</title>
<indexterm zone="EphyPermission"><primary sortas="EphyPermission">EphyPermission</primary></indexterm><programlisting>typedef enum
{
	EPHY_PERMISSION_ALLOWED,
	EPHY_PERMISSION_DENIED,
	EPHY_PERMISSION_DEFAULT
} EphyPermission;
</programlisting>
<para>
Determines whether the website is allowed or denied access.
</para><variablelist role="enum">
<varlistentry id="EPHY-PERMISSION-ALLOWED--CAPS" role="constant">
<term><literal>EPHY_PERMISSION_ALLOWED</literal></term>
<listitem><simpara>
	The website is unconditionally allowed to perform the desired action.
</simpara></listitem>
</varlistentry>
<varlistentry id="EPHY-PERMISSION-DENIED--CAPS" role="constant">
<term><literal>EPHY_PERMISSION_DENIED</literal></term>
<listitem><simpara>
	The website is unconditionally denied to perform the desired action.
</simpara></listitem>
</varlistentry>
<varlistentry id="EPHY-PERMISSION-DEFAULT--CAPS" role="constant">
<term><literal>EPHY_PERMISSION_DEFAULT</literal></term>
<listitem><simpara>
	The user has not set a preference for this particular website; the
	caller should therefore fall back to default settings.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="ephy-permission-info-free" role="function">
<title>ephy_permission_info_free ()</title>
<indexterm zone="ephy-permission-info-free"><primary sortas="ephy_permission_info_free">ephy_permission_info_free</primary></indexterm><programlisting><link linkend="void">void</link>                ephy_permission_info_free           (<link linkend="EphyPermissionInfo">EphyPermissionInfo</link> *info);</programlisting>
<para>
Frees <parameter>info</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>info</parameter>&#160;:</term>
<listitem><simpara> an <link linkend="EphyPermissionInfo"><type>EphyPermissionInfo</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
