summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/api/qwebenginepage_p.h
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-01-15 18:22:24 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-22 08:45:09 +0100
commit6d760436bc0d7081d5bdb50e4141171b6ba940ee (patch)
tree9f17b8122a09b89a818373d9a269072d984ca0a6 /src/webenginewidgets/api/qwebenginepage_p.h
parente6b846f3800eed35d31a45122f7f8c3215dc38ef (diff)
Refactor the callback mechanism used by runJavaScript
This prepares the way for other API made async like toHtml and toPlainText. Use a callback class with an implicit templated constructor to carry the functor across the API boundary and avoid the intermediate helper method as the ABI that we have to maintain. Also pass the callback result through WebContentsAdapterClient using a bookkeeping ID instead of transferring the callback to WebContentsAdapter. This will allow other calls, which might not already allow passing a callback functor, to use a consisten way of carrying back the result to the top API layer. Change-Id: Ia923767b9c1021a108c26da17d4c41878ef7cb95 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'src/webenginewidgets/api/qwebenginepage_p.h')
-rw-r--r--src/webenginewidgets/api/qwebenginepage_p.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h
index c8dd63daa..656eb4788 100644
--- a/src/webenginewidgets/api/qwebenginepage_p.h
+++ b/src/webenginewidgets/api/qwebenginepage_p.h
@@ -80,6 +80,7 @@ public:
virtual bool contextMenuRequested(const WebEngineContextMenuData &data) Q_DECL_OVERRIDE;
virtual void javascriptDialog(QSharedPointer<JavaScriptDialogController>) Q_DECL_OVERRIDE;
virtual void runFileChooser(FileChooserMode, const QString &defaultFileName, const QStringList &acceptedMimeTypes) Q_DECL_OVERRIDE;
+ virtual void didRunJavaScript(const QVariant& result, quint64 requestId) Q_DECL_OVERRIDE;
void updateAction(QWebEnginePage::WebAction) const;
void updateNavigationActions();
@@ -91,6 +92,9 @@ public:
mutable QAction *actions[QWebEnginePage::WebActionCount];
bool m_isLoading;
WebEngineContextMenuData m_menuData;
+
+ typedef QtWebEnginePrivate::QWebEngineCallbackPrivateBase<const QVariant&> VariantCallback;
+ mutable QHash<quint64, QExplicitlySharedDataPointer<VariantCallback> > m_variantCallbacks;
};
QT_END_NAMESPACE