summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/api/qwebenginepage.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-08-25 15:37:49 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-08-29 14:47:12 +0200
commit66def056d0f0fc8794f622fcfd61f974fce2a3b1 (patch)
tree2f5276dc594e1e737fe4b6245ab96307439c04b3 /src/webenginewidgets/api/qwebenginepage.cpp
parent530ab16146b18457d0b3395ea64a6de756a4d22d (diff)
Add Qt WebEngine Widgets API for allowing certificate errors
This adds API for overriding some certificate errors. Once overridden any identical error for the same hostname and certificate will use the same override. Similar API for QtWebEngine QML should be added in a later patch. Change-Id: I144147b86d9b592e3f87346a1e48890acee0c670 Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src/webenginewidgets/api/qwebenginepage.cpp')
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index e8f34a1e..51e733e7 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -23,6 +23,7 @@
#include "qwebenginepage.h"
#include "qwebenginepage_p.h"
+#include "certificate_error_controller.h"
#include "javascript_dialog_controller.h"
#include "qwebenginehistory.h"
#include "qwebenginehistory_p.h"
@@ -646,6 +647,18 @@ void QWebEnginePagePrivate::javascriptDialog(QSharedPointer<JavaScriptDialogCont
controller->reject();
}
+void QWebEnginePagePrivate::allowCertificateError(const QExplicitlySharedDataPointer<CertificateErrorController> &controller)
+{
+ Q_Q(QWebEnginePage);
+ bool accepted = false;
+
+ QWebEngineCertificateError error(controller->error(), controller->url(), controller->overridable() && !controller->strictEnforcement(), controller->errorString());
+ accepted = q->certificateError(error);
+
+ if (error.isOverridable())
+ controller->accept(accepted);
+}
+
void QWebEnginePagePrivate::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID)
{
Q_Q(QWebEnginePage);
@@ -919,6 +932,12 @@ void QWebEnginePage::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel leve
Q_UNUSED(lineNumber);
Q_UNUSED(sourceID);
}
+
+bool QWebEnginePage::certificateError(const QWebEngineCertificateError &)
+{
+ return false;
+}
+
QT_END_NAMESPACE
#include "moc_qwebenginepage.cpp"