From c6505f14bce8b12ddd1df6f85ea185d0111eb7f3 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Mon, 5 Mar 2018 16:16:29 +0100 Subject: Doc: Add code snippet to QWebEngineCookieStore::setCookieFilter() docs Task-number: QTBUG-66723 Change-Id: Ic59f2bea41d6f5a4b0a1ca2b27ed7cce79b4a6ce Reviewed-by: Allan Sandfeld Jensen --- src/core/api/qwebenginecookiestore.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/core/api/qwebenginecookiestore.cpp') diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp index 713dcdf6d..583ca1df8 100644 --- a/src/core/api/qwebenginecookiestore.cpp +++ b/src/core/api/qwebenginecookiestore.cpp @@ -336,9 +336,20 @@ void QWebEngineCookieStore::deleteAllCookies() \since 5.11 Installs a cookie filter that can prevent sites and resources from using cookies. - The \a filterCallback must be a lambda or functor taking a FilterRequest structure. If the + The \a filter must be a lambda or functor taking a FilterRequest structure. If the cookie is to be rejected, the filter can set FilterRequest::accepted to \c false. + The following code snippet illustrates how to set a cookie filter: + + \code + profile->setCookieFilter( + [&allowThirdPartyCookiesSetting](QWebEngineCookieStore::FilterRequest &request) + { request.accepted = !request.thirdParty || allowThirdPartyCookiesSetting; } + ); + \endcode + + You can unset the filter with a nullptr argument. + The callback should not be used to execute heavy tasks since it is running on the IO thread and therefore blocks the Chromium networking. -- cgit v1.2.3