summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/api/qwebenginepage.cpp
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2015-08-26 10:43:05 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-09-06 19:26:52 +0000
commit691d4a008d90b7d69a7b4b05404475dae204848f (patch)
tree0a2144ae62ffaee5dc1788a5d6c1b9ce9ac52d12 /src/webenginewidgets/api/qwebenginepage.cpp
parent6ef0a365124d435314113837dc77fa07b02ff86b (diff)
Add AuthenticationDialogController
The new controller makes possible to handle authentication requests asynchronously. This is essential for the authentication support in the QtQuick API. Change-Id: Ib60b58448a60e817e64477529ec4bfd1535b3d19 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/webenginewidgets/api/qwebenginepage.cpp')
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index a4cc0ac12..bd3b2772a 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 "authentication_dialog_controller.h"
#include "browser_context_adapter.h"
#include "certificate_error_controller.h"
#include "file_picker_controller.h"
@@ -249,24 +250,24 @@ void QWebEnginePagePrivate::passOnFocus(bool reverse)
view->focusNextPrevChild(!reverse);
}
-bool QWebEnginePagePrivate::authenticationRequired(const QUrl &requestUrl, const QString &realm, bool isProxy, const QString &challengingHost, QString *outUser, QString *outPassword)
+void QWebEnginePagePrivate::authenticationRequired(QSharedPointer<AuthenticationDialogController> controller)
{
Q_Q(QWebEnginePage);
QAuthenticator networkAuth;
- networkAuth.setRealm(realm);
+ networkAuth.setRealm(controller->realm());
- if (isProxy)
- Q_EMIT q->proxyAuthenticationRequired(requestUrl, &networkAuth, challengingHost);
+ if (controller->isProxy())
+ Q_EMIT q->proxyAuthenticationRequired(controller->url(), &networkAuth, controller->host());
else
- Q_EMIT q->authenticationRequired(requestUrl, &networkAuth);
+ Q_EMIT q->authenticationRequired(controller->url(), &networkAuth);
// Authentication has been cancelled
- if (networkAuth.isNull())
- return false;
+ if (networkAuth.isNull()) {
+ controller->reject();
+ return;
+ }
- *outUser = networkAuth.user();
- *outPassword = networkAuth.password();
- return true;
+ controller->accept(networkAuth.user(), networkAuth.password());
}
void QWebEnginePagePrivate::runMediaAccessPermissionRequest(const QUrl &securityOrigin, WebContentsAdapterClient::MediaRequestFlags requestFlags)