diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp index 7d8a10e1f..8790c7cbf 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp @@ -20,6 +20,8 @@ #include "config.h" #include "WebKitCookieManager.h" +#include "SoupCookiePersistentStorageType.h" +#include "WebCookieManagerProxy.h" #include "WebKitCookieManagerPrivate.h" #include "WebKitEnumTypes.h" #include <wtf/gobject/GRefPtr.h> @@ -41,6 +43,9 @@ static guint signals[LAST_SIGNAL] = { 0, }; G_DEFINE_TYPE(WebKitCookieManager, webkit_cookie_manager, G_TYPE_OBJECT) +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT, SoupCookiePersistentStorageText); +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE, SoupCookiePersistentStorageSQLite); + COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS, kWKHTTPCookieAcceptPolicyAlways); COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_NEVER, kWKHTTPCookieAcceptPolicyNever); COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY, kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain); @@ -104,6 +109,30 @@ WebKitCookieManager* webkitCookieManagerCreate(WKCookieManagerRef wkCookieManage } /** + * webkit_cookie_manager_set_persistent_storage: + * @cookie_manager: a #WebKitCookieManager + * @filename: the filename to read to/write from + * @storage: a #WebKitCookiePersistentStorage + * + * 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 persistenly, so you need to call this + * method to keep cookies saved across sessions. + */ +void webkit_cookie_manager_set_persistent_storage(WebKitCookieManager* manager, const char* filename, WebKitCookiePersistentStorage storage) +{ + g_return_if_fail(WEBKIT_IS_COOKIE_MANAGER(manager)); + g_return_if_fail(filename); + + WKCookieManagerStopObservingCookieChanges(manager->priv->wkCookieManager.get()); + toImpl(manager->priv->wkCookieManager.get())->setCookiePersistentStorage(String::fromUTF8(filename), storage); + WKCookieManagerStartObservingCookieChanges(manager->priv->wkCookieManager.get()); +} + +/** * webkit_cookie_manager_set_accept_policy: * @cookie_manager: a #WebKitCookieManager * @policy: a #WebKitCookieAcceptPolicy |