From e9575322f8068b2dd2bc0b30a0f444f769a861b9 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Fri, 21 Mar 2014 14:43:21 +0100 Subject: Implement QWebEngineHistory serialization This does uses logic taken from Chromium's state save and restore code. The history version is incremented from the same method in QtWebKit in cases where the application would try loading a stream from a previous version using QtWebKit. In all cases where Chromium does a restore of a serialized history, it does so on a fresh WebContents instance, thus we must do the same and some of the initialization code has to be updated. Change-Id: I45abb052073bd44c9cb47bc2abcf4b558fe3dbbd Reviewed-by: Pierre Rossi --- src/webenginewidgets/api/qwebenginepage.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/webenginewidgets/api/qwebenginepage.cpp') diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index b6c84de6c..e9ad17cf0 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -354,6 +354,15 @@ void QWebEnginePagePrivate::_q_webActionTriggered(bool checked) } #endif // QT_NO_ACTION +void QWebEnginePagePrivate::recreateFromSerializedHistory(QDataStream &input) +{ + QExplicitlySharedDataPointer newWebContents = WebContentsAdapter::createFromSerializedNavigationHistory(input, this, WebContentsAdapterClient::SoftwareRenderingMode); + if (newWebContents) { + adapter = newWebContents.data(); + adapter->initialize(this); + } +} + QWebEnginePage::QWebEnginePage(QObject* parent) : QObject(*new QWebEnginePagePrivate, parent) { -- cgit v1.2.3