WebKitCookieManager

WebKitCookieManager — Defines how to handle cookies in a WebKitWebContext

Functions

Signals

Types and Values

Object Hierarchy

    GObject
    ╰── WebKitCookieManager

Description

The WebKitCookieManager defines how to set up and handle cookies. You can get it from a WebKitWebsiteDataManager with webkit_website_data_manager_get_cookie_manager(), and use it to set where to store cookies with webkit_cookie_manager_set_persistent_storage(), or to set the acceptance policy, with webkit_cookie_manager_get_accept_policy().

Functions

webkit_cookie_manager_set_persistent_storage ()

void
webkit_cookie_manager_set_persistent_storage
                               (WebKitCookieManager *cookie_manager,
                                const gchar *filename,
                                WebKitCookiePersistentStorage storage);

Set the filename where non-session cookies are stored persistently using storage as the format to read/write the cookies. Cookies are initially read from filename to create an initial set of cookies. Then, non-session cookies will be written to filename when the WebKitCookieManager::changed signal is emitted. By default, cookie_manager doesn't store the cookies persistently, so you need to call this method to keep cookies saved across sessions.

This method should never be called on a WebKitCookieManager associated to an ephemeral WebKitWebsiteDataManager.

Parameters

cookie_manager

a WebKitCookieManager

 

filename

the filename to read to/write from

 

storage

a WebKitCookiePersistentStorage

 

webkit_cookie_manager_set_accept_policy ()

void
webkit_cookie_manager_set_accept_policy
                               (WebKitCookieManager *cookie_manager,
                                WebKitCookieAcceptPolicy policy);

Set the cookie acceptance policy of cookie_manager as policy .

Parameters

cookie_manager

a WebKitCookieManager

 

policy

a WebKitCookieAcceptPolicy

 

webkit_cookie_manager_get_accept_policy ()

void
webkit_cookie_manager_get_accept_policy
                               (WebKitCookieManager *cookie_manager,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Asynchronously get the cookie acceptance policy of cookie_manager .

When the operation is finished, callback will be called. You can then call webkit_cookie_manager_get_accept_policy_finish() to get the result of the operation.

Parameters

cookie_manager

a WebKitCookieManager

 

cancellable

a GCancellable or NULL to ignore.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

webkit_cookie_manager_get_accept_policy_finish ()

WebKitCookieAcceptPolicy
webkit_cookie_manager_get_accept_policy_finish
                               (WebKitCookieManager *cookie_manager,
                                GAsyncResult *result,
                                GError **error);

Finish an asynchronous operation started with webkit_cookie_manager_get_accept_policy().

Parameters

cookie_manager

a WebKitCookieManager

 

result

a GAsyncResult

 

error

return location for error or NULL to ignore

 

Returns

the cookie acceptance policy of cookie_manager as a WebKitCookieAcceptPolicy.


webkit_cookie_manager_get_domains_with_cookies ()

void
webkit_cookie_manager_get_domains_with_cookies
                               (WebKitCookieManager *cookie_manager,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

webkit_cookie_manager_get_domains_with_cookies has been deprecated since version 2.16 and should not be used in newly-written code.

Use webkit_website_data_manager_fetch() instead.

Asynchronously get the list of domains for which cookie_manager contains cookies.

When the operation is finished, callback will be called. You can then call webkit_cookie_manager_get_domains_with_cookies_finish() to get the result of the operation.

Parameters

cookie_manager

a WebKitCookieManager

 

cancellable

a GCancellable or NULL to ignore.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

webkit_cookie_manager_get_domains_with_cookies_finish ()

gchar **
webkit_cookie_manager_get_domains_with_cookies_finish
                               (WebKitCookieManager *cookie_manager,
                                GAsyncResult *result,
                                GError **error);

webkit_cookie_manager_get_domains_with_cookies_finish has been deprecated since version 2.16 and should not be used in newly-written code.

Use webkit_website_data_manager_fetch_finish() instead.

Finish an asynchronous operation started with webkit_cookie_manager_get_domains_with_cookies(). The return value is a NULL terminated list of strings which should be released with g_strfreev().

Parameters

cookie_manager

a WebKitCookieManager

 

result

a GAsyncResult

 

error

return location for error or NULL to ignore

 

Returns

A NULL terminated array of domain names or NULL in case of error.

[transfer full][array zero-terminated=1]


webkit_cookie_manager_add_cookie ()

void
webkit_cookie_manager_add_cookie (WebKitCookieManager *cookie_manager,
                                  SoupCookie *cookie,
                                  GCancellable *cancellable,
                                  GAsyncReadyCallback callback,
                                  gpointer user_data);

Asynchronously add a SoupCookie to the underlying storage.

When the operation is finished, callback will be called. You can then call webkit_cookie_manager_add_cookie_finish() to get the result of the operation.

Parameters

cookie_manager

a WebKitCookieManager

 

cookie

the SoupCookie to be added

 

cancellable

a GCancellable or NULL to ignore.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

Since: 2.20


webkit_cookie_manager_add_cookie_finish ()

gboolean
webkit_cookie_manager_add_cookie_finish
                               (WebKitCookieManager *cookie_manager,
                                GAsyncResult *result,
                                GError **error);

Finish an asynchronous operation started with webkit_cookie_manager_add_cookie().

Parameters

cookie_manager

a WebKitCookieManager

 

result

a GAsyncResult

 

error

return location for error or NULL to ignore

 

Returns

TRUE if the cookie was added or FALSE in case of error.

Since: 2.20


webkit_cookie_manager_get_cookies ()

void
webkit_cookie_manager_get_cookies (WebKitCookieManager *cookie_manager,
                                   const gchar *uri,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

Asynchronously get a list of SoupCookie from cookie_manager associated with uri , which must be either an HTTP or an HTTPS URL.

When the operation is finished, callback will be called. You can then call webkit_cookie_manager_get_cookies_finish() to get the result of the operation.

Parameters

cookie_manager

a WebKitCookieManager

 

uri

the URI associated to the cookies to be retrieved

 

cancellable

a GCancellable or NULL to ignore.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

Since: 2.20


webkit_cookie_manager_get_cookies_finish ()

GList *
webkit_cookie_manager_get_cookies_finish
                               (WebKitCookieManager *cookie_manager,
                                GAsyncResult *result,
                                GError **error);

Finish an asynchronous operation started with webkit_cookie_manager_get_cookies(). The return value is a GSList of SoupCookie instances which should be released with g_list_free_full() and soup_cookie_free().

Parameters

cookie_manager

a WebKitCookieManager

 

result

a GAsyncResult

 

error

return location for error or NULL to ignore

 

Returns

A GList of SoupCookie instances.

[element-type SoupCookie][transfer full]

Since: 2.20


webkit_cookie_manager_delete_cookie ()

void
webkit_cookie_manager_delete_cookie (WebKitCookieManager *cookie_manager,
                                     SoupCookie *cookie,
                                     GCancellable *cancellable,
                                     GAsyncReadyCallback callback,
                                     gpointer user_data);

Asynchronously delete a SoupCookie from the current session.

When the operation is finished, callback will be called. You can then call webkit_cookie_manager_delete_cookie_finish() to get the result of the operation.

Parameters

cookie_manager

a WebKitCookieManager

 

cookie

the SoupCookie to be deleted

 

cancellable

a GCancellable or NULL to ignore.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

Since: 2.20


webkit_cookie_manager_delete_cookie_finish ()

gboolean
webkit_cookie_manager_delete_cookie_finish
                               (WebKitCookieManager *cookie_manager,
                                GAsyncResult *result,
                                GError **error);

Finish an asynchronous operation started with webkit_cookie_manager_delete_cookie().

Parameters

cookie_manager

a WebKitCookieManager

 

result

a GAsyncResult

 

error

return location for error or NULL to ignore

 

Returns

TRUE if the cookie was deleted or FALSE in case of error.

Since: 2.20


webkit_cookie_manager_delete_cookies_for_domain ()

void
webkit_cookie_manager_delete_cookies_for_domain
                               (WebKitCookieManager *cookie_manager,
                                const gchar *domain);

webkit_cookie_manager_delete_cookies_for_domain has been deprecated since version 2.16 and should not be used in newly-written code.

Use webkit_website_data_manager_remove() instead.

Remove all cookies of cookie_manager for the given domain .

Parameters

cookie_manager

a WebKitCookieManager

 

domain

a domain name

 

webkit_cookie_manager_delete_all_cookies ()

void
webkit_cookie_manager_delete_all_cookies
                               (WebKitCookieManager *cookie_manager);

webkit_cookie_manager_delete_all_cookies has been deprecated since version 2.16 and should not be used in newly-written code.

Use webkit_website_data_manager_clear() instead.

Delete all cookies of cookie_manager

Parameters

cookie_manager

a WebKitCookieManager

 

Types and Values

struct WebKitCookieManager

struct WebKitCookieManager;

enum WebKitCookiePersistentStorage

Enum values used to denote the cookie persistent storage types.

Members

WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT

Cookies are stored in a text file in the Mozilla "cookies.txt" format.

 

WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE

Cookies are stored in a SQLite file in the current Mozilla format.

 

enum WebKitCookieAcceptPolicy

Enum values used to denote the cookie acceptance policies.

Members

WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS

Accept all cookies unconditionally.

 

WEBKIT_COOKIE_POLICY_ACCEPT_NEVER

Reject all cookies unconditionally.

 

WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY

Accept only cookies set by the main document loaded.

 

Signal Details

The “changed” signal

void
user_function (WebKitCookieManager *cookie_manager,
               gpointer             user_data)

This signal is emitted when cookies are added, removed or modified.

Parameters

cookie_manager

the WebKitCookieManager

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last