summaryrefslogtreecommitdiffstats
path: root/src/core/type_conversion.h
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@theqtcompany.com>2015-06-03 19:00:34 +0200
committerAndras Becsi <andras.becsi@theqtcompany.com>2015-06-16 09:39:22 +0000
commit8a77cd16793bc91b0f7c267fc579a3041dd55e61 (patch)
treeadeb282e7170f753719a6984252ff2b39aa9dc72 /src/core/type_conversion.h
parent0e006b8ea755ebad01faf3e747e61abdf158289a (diff)
Add QWebEngineCookieStoreClient core API
This class or its subclass can be set on the QWebEngineProfile and its API enables intercepting Chromium's cookies, setting and deleting cookies in the cookie store. These functions are asynchronous so if the result of the task is needed the user can provide a callback which will be run on the calling thread when the requested operation finishes. This does not include a hook for QQuick layer yet, there we have to figure out what the most convenient way is from a developer's perspective. Change-Id: I6a3af071883ce632df7a2fb952da93f306ac3fe2 Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com>
Diffstat (limited to 'src/core/type_conversion.h')
-rw-r--r--src/core/type_conversion.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h
index 3f5575a47..a711e7235 100644
--- a/src/core/type_conversion.h
+++ b/src/core/type_conversion.h
@@ -41,12 +41,14 @@
#include <QDateTime>
#include <QDir>
#include <QMatrix4x4>
+#include <QNetworkCookie>
#include <QRect>
#include <QString>
#include <QUrl>
#include "base/files/file_path.h"
#include "base/time/time.h"
#include "content/public/common/file_chooser_file_info.h"
+#include "net/cookies/canonical_cookie.h"
#include "third_party/skia/include/utils/SkMatrix44.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/rect.h"
@@ -147,6 +149,17 @@ inline base::Time toTime(const QDateTime &dateTime) {
return base::Time::FromInternalValue(dateTime.toMSecsSinceEpoch());
}
+inline QNetworkCookie toQt(const net::CanonicalCookie & cookie)
+{
+ QNetworkCookie qCookie = QNetworkCookie(QByteArray::fromStdString(cookie.Name()), QByteArray::fromStdString(cookie.Value()));
+ qCookie.setDomain(toQt(cookie.Domain()));
+ qCookie.setExpirationDate(toQt(cookie.ExpiryDate()));
+ qCookie.setHttpOnly(cookie.IsHttpOnly());
+ qCookie.setPath(toQt(cookie.Path()));
+ qCookie.setSecure(cookie.IsSecure());
+ return qCookie;
+}
+
inline base::FilePath::StringType toFilePathString(const QString &str)
{
#if defined(OS_WIN)