Changeset 113870 in webkit


Ignore:
Timestamp:
Apr 11, 2012 9:14:45 AM (12 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Initial cookies API for WebKit2 GTK+ API
https://bugs.webkit.org/show_bug.cgi?id=82441

Reviewed by Gustavo Noronha Silva.

  • GNUmakefile.am: Add new files to compilation.
  • UIProcess/API/gtk/WebKitCookieManager.cpp: Added.

(webkit_cookie_manager_init):
(webkitCookieManagerFinalize):
(webkit_cookie_manager_class_init):
(webkitCookieManagerCreate): Create a new WebKitCookieManager for
the given WKCookieManagerRef.
(webkit_cookie_manager_set_accept_policy): Set the cookie
acceptance policy.
(webkitCookieManagerGetAcceptPolicyCallback): Callback called by
the C API when the cookie acceptance policy has been received.
(webkit_cookie_manager_get_accept_policy): Asynchronously get the
cookie acceptance policy.
(webkit_cookie_manager_get_accept_policy_finish): Finish async
operation started by webkit_cookie_manager_get_accept_policy()
returning the cookie acceptance policy.
(webkitCookieManagerGetDomainsWithCookiesCallback): Callback
called by the C API when the list of hostnames with cookies has
been received.
(webkit_cookie_manager_get_domains_with_cookies): Asynchronously
get the list of domains with cookies.
(webkit_cookie_manager_get_domains_with_cookies_finish): Finish
async operation started by
webkit_cookie_manager_get_domains_with_cookies() returning the
list of domains.
(webkit_cookie_manager_delete_cookies_for_domain): Delete all
cookies for the given domain.
(webkit_cookie_manager_delete_all_cookies): Delete all cookies.

  • UIProcess/API/gtk/WebKitCookieManager.h: Added.
  • UIProcess/API/gtk/WebKitCookieManagerPrivate.h: Added.
  • UIProcess/API/gtk/WebKitWebContext.cpp:

(webkit_web_context_get_cookie_manager): Get the
WebKitCookieManager associated with the web context.

  • UIProcess/API/gtk/WebKitWebContext.h:
  • UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new chapter for

WebKitCookieManager.

  • UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
  • UIProcess/API/gtk/docs/webkit2gtk.types: Add

webkit_cookie_manager_get_type.

  • UIProcess/API/gtk/tests/GNUmakefile.am:
  • UIProcess/API/gtk/tests/TestCookieManager.cpp: Added.

(testCookieManagerAcceptPolicy):
(testCookieManagerDeleteCookies):
(serverCallback):
(beforeAll):
(afterAll):

  • UIProcess/API/gtk/webkit2.h: Include WebKitCookieManager.h.
Location:
trunk/Source/WebKit2
Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r113861 r113870  
     12012-04-11  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Initial cookies API for WebKit2 GTK+ API
     4        https://bugs.webkit.org/show_bug.cgi?id=82441
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        * GNUmakefile.am: Add new files to compilation.
     9        * UIProcess/API/gtk/WebKitCookieManager.cpp: Added.
     10        (webkit_cookie_manager_init):
     11        (webkitCookieManagerFinalize):
     12        (webkit_cookie_manager_class_init):
     13        (webkitCookieManagerCreate): Create a new WebKitCookieManager for
     14        the given WKCookieManagerRef.
     15        (webkit_cookie_manager_set_accept_policy): Set the cookie
     16        acceptance policy.
     17        (webkitCookieManagerGetAcceptPolicyCallback): Callback called by
     18        the C API when the cookie acceptance policy has been received.
     19        (webkit_cookie_manager_get_accept_policy): Asynchronously get the
     20        cookie acceptance policy.
     21        (webkit_cookie_manager_get_accept_policy_finish): Finish async
     22        operation started by webkit_cookie_manager_get_accept_policy()
     23        returning the cookie acceptance policy.
     24        (webkitCookieManagerGetDomainsWithCookiesCallback): Callback
     25        called by the C API when the list of hostnames with cookies has
     26        been received.
     27        (webkit_cookie_manager_get_domains_with_cookies): Asynchronously
     28        get the list of domains with cookies.
     29        (webkit_cookie_manager_get_domains_with_cookies_finish): Finish
     30        async operation started by
     31        webkit_cookie_manager_get_domains_with_cookies() returning the
     32        list of domains.
     33        (webkit_cookie_manager_delete_cookies_for_domain): Delete all
     34        cookies for the given domain.
     35        (webkit_cookie_manager_delete_all_cookies): Delete all cookies.
     36        * UIProcess/API/gtk/WebKitCookieManager.h: Added.
     37        * UIProcess/API/gtk/WebKitCookieManagerPrivate.h: Added.
     38        * UIProcess/API/gtk/WebKitWebContext.cpp:
     39        (webkit_web_context_get_cookie_manager): Get the
     40        WebKitCookieManager associated with the web context.
     41        * UIProcess/API/gtk/WebKitWebContext.h:
     42        * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new chapter for
     43        WebKitCookieManager.
     44        * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
     45        * UIProcess/API/gtk/docs/webkit2gtk.types: Add
     46        webkit_cookie_manager_get_type.
     47        * UIProcess/API/gtk/tests/GNUmakefile.am:
     48        * UIProcess/API/gtk/tests/TestCookieManager.cpp: Added.
     49        (testCookieManagerAcceptPolicy):
     50        (testCookieManagerDeleteCookies):
     51        (serverCallback):
     52        (beforeAll):
     53        (afterAll):
     54        * UIProcess/API/gtk/webkit2.h: Include WebKitCookieManager.h.
     55
    1562012-04-10  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
    257
  • trunk/Source/WebKit2/GNUmakefile.am

    r113831 r113870  
    8888        $(WebKit2)/UIProcess/API/gtk/WebKitBackForwardList.h \
    8989        $(WebKit2)/UIProcess/API/gtk/WebKitBackForwardListItem.h \
     90        $(WebKit2)/UIProcess/API/gtk/WebKitCookieManager.h \
    9091        $(WebKit2)/UIProcess/API/gtk/WebKitDefines.h \
    9192        $(WebKit2)/UIProcess/API/gtk/WebKitDownload.h \
     
    551552        Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp \
    552553        Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListPrivate.h \
     554        Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.h \
     555        Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp \
     556        Source/WebKit2/UIProcess/API/gtk/WebKitCookieManagerPrivate.h \
    553557        Source/WebKit2/UIProcess/API/gtk/WebKitDefines.h \
    554558        Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp \
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp

    r105708 r113870  
    2222
    2323#include "WebContext.h"
     24#include "WebKitCookieManagerPrivate.h"
    2425#include "WebKitDownloadClient.h"
    2526#include "WebKitDownloadPrivate.h"
     
    4041struct _WebKitWebContextPrivate {
    4142    WKRetainPtr<WKContextRef> context;
     43
     44    GRefPtr<WebKitCookieManager> cookieManager;
    4245};
    4346
     
    216219}
    217220
     221/**
     222 * webkit_web_context_get_cookie_manager:
     223 * @context: a #WebKitWebContext
     224 *
     225 * Get the #WebKitCookieManager of @context.
     226 *
     227 * Returns: (transfer none): the #WebKitCookieManager of @context.
     228 */
     229WebKitCookieManager* webkit_web_context_get_cookie_manager(WebKitWebContext* context)
     230{
     231    g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0);
     232
     233    WebKitWebContextPrivate* priv = context->priv;
     234    if (!priv->cookieManager)
     235        priv->cookieManager = adoptGRef(webkitCookieManagerCreate(WKContextGetCookieManager(priv->context.get())));
     236
     237    return priv->cookieManager.get();
     238}
     239
    218240WebKitDownload* webkitWebContextGetOrCreateDownload(WKDownloadRef wkDownload)
    219241{
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h

    r105708 r113870  
    2626
    2727#include <glib-object.h>
     28#include <webkit2/WebKitCookieManager.h>
    2829#include <webkit2/WebKitDefines.h>
    2930#include <webkit2/WebKitDownload.h>
     
    8081
    8182WEBKIT_API GType
    82 webkit_web_context_get_type        (void);
     83webkit_web_context_get_type           (void);
    8384
    8485WEBKIT_API WebKitWebContext *
    85 webkit_web_context_get_default     (void);
     86webkit_web_context_get_default        (void);
    8687
    8788WEBKIT_API void
    88 webkit_web_context_set_cache_model (WebKitWebContext *context,
    89                                     WebKitCacheModel  cache_model);
     89webkit_web_context_set_cache_model    (WebKitWebContext *context,
     90                                       WebKitCacheModel  cache_model);
    9091WEBKIT_API WebKitCacheModel
    91 webkit_web_context_get_cache_model (WebKitWebContext *context);
     92webkit_web_context_get_cache_model    (WebKitWebContext *context);
    9293
    9394WEBKIT_API WebKitDownload *
    94 webkit_web_context_download_uri    (WebKitWebContext *context,
    95                                     const gchar      *uri);
     95webkit_web_context_download_uri       (WebKitWebContext *context,
     96                                       const gchar      *uri);
     97
     98WEBKIT_API WebKitCookieManager *
     99webkit_web_context_get_cookie_manager (WebKitWebContext *context);
    96100
    97101G_END_DECLS
  • trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml

    r112221 r113870  
    3030    <xi:include href="xml/WebKitError.xml"/>
    3131    <xi:include href="xml/WebKitFindController.xml"/>
     32    <xi:include href="xml/WebKitCookieManager.xml"/>
    3233  </chapter>
    3334
  • trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt

    r112227 r113870  
    2929webkit_web_context_set_cache_model
    3030webkit_web_context_download_uri
     31webkit_web_context_get_cookie_manager
    3132
    3233<SUBSECTION Standard>
     
    547548webkit_find_controller_get_type
    548549</SECTION>
     550
     551<SECTION>
     552<FILE>WebKitCookieManager</FILE>
     553WebKitCookieManager
     554WebKitCookieAcceptPolicy
     555webkit_cookie_manager_set_accept_policy
     556webkit_cookie_manager_get_accept_policy
     557webkit_cookie_manager_get_accept_policy_finish
     558webkit_cookie_manager_get_domains_with_cookies
     559webkit_cookie_manager_get_domains_with_cookies_finish
     560webkit_cookie_manager_delete_cookies_for_domain
     561webkit_cookie_manager_delete_all_cookies
     562
     563<SUBSECTION Standard>
     564WebKitCookieManagerClass
     565WEBKIT_TYPE_COOKIE_MANAGER
     566WEBKIT_COOKIE_MANAGER
     567WEBKIT_IS_COOKIE_MANAGER
     568WEBKIT_COOKIE_MANAGER_CLASS
     569WEBKIT_IS_COOKIE_MANAGER_CLASS
     570WEBKIT_COOKIE_MANAGER_GET_CLASS
     571
     572<SUBSECTION Private>
     573WebKitCookieManagerPrivate
     574webkit_cookie_manager_get_type
     575</SECTION>
  • trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types

    r112221 r113870  
    1414webkit_javascript_result_get_type
    1515webkit_web_resource_get_type
     16webkit_cookie_manager_get_type
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am

    r112221 r113870  
    33TEST_PROGS += \
    44        Programs/WebKit2APITests/TestBackForwardList \
     5        Programs/WebKit2APITests/TestCookieManager \
    56        Programs/WebKit2APITests/TestDownloads \
    67        Programs/WebKit2APITests/TestLoaderClient \
     
    143144Programs_WebKit2APITests_TestResources_LDFLAGS = $(webkit2_tests_ldflags)
    144145
     146Programs_WebKit2APITests_TestCookieManager_SOURCES = \
     147        Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp
     148Programs_WebKit2APITests_TestCookieManager_CPPFLAGS = $(webkit2_tests_cppflags)
     149Programs_WebKit2APITests_TestCookieManager_LDADD = $(webkit2_tests_ldadd)
     150Programs_WebKit2APITests_TestCookieManager_LDFLAGS = $(webkit2_tests_ldflags)
     151
    145152endif # ENABLE_WEBKIT2
  • trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h

    r112221 r113870  
    2626#include <webkit2/WebKitBackForwardList.h>
    2727#include <webkit2/WebKitBackForwardListItem.h>
     28#include <webkit2/WebKitCookieManager.h>
    2829#include <webkit2/WebKitDefines.h>
    2930#include <webkit2/WebKitDownload.h>
Note: See TracChangeset for help on using the changeset viewer.