diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-02-04 13:11:02 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-02-04 12:22:50 +0000 |
commit | 0622e02b9da5b93c6824367732970af0214601fb (patch) | |
tree | 32b133d8d10683c833ae5fcee5e19015f5a7f857 /src/core/web_contents_delegate_qt.cpp | |
parent | 49a08bdf0ce3f42607d42eaefb693293c5bb53b9 (diff) |
Handle multiple feature requests
This patch makes it possible to have multiple outstanding feature
requests and adds hooks for chromium to cancel requests.
Change-Id: Icbeb30aa39ace090d853a29aefaeebbe726fe251
Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'src/core/web_contents_delegate_qt.cpp')
-rw-r--r-- | src/core/web_contents_delegate_qt.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 41bcfe609..d24b8a2cd 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -312,15 +312,25 @@ void WebContentsDelegateQt::allowCertificateError(const QSharedPointer<Certifica m_viewClient->allowCertificateError(errorController); } -void WebContentsDelegateQt::requestGeolocationPermission(const GURL &requestingFrameOrigin, base::Callback<void (bool)> resultCallback) +void WebContentsDelegateQt::requestGeolocationPermission(const GURL &requestingFrameOrigin, const base::Callback<void (bool)> &resultCallback) { - m_lastGeolocationPermissionRequest.url = toQt(requestingFrameOrigin); - m_lastGeolocationPermissionRequest.callback = resultCallback; - m_viewClient->runGeolocationPermissionRequest(m_lastGeolocationPermissionRequest.url); + QUrl url = toQt(requestingFrameOrigin); + bool newRequest = !m_geolocationPermissionRequests.contains(url); + m_geolocationPermissionRequests[url] = resultCallback; + if (newRequest) + m_viewClient->runGeolocationPermissionRequest(url); +} + +void WebContentsDelegateQt::cancelGeolocationPermissionRequest(const GURL &requestingFrameOrigin) +{ + m_geolocationPermissionRequests.remove(toQt(requestingFrameOrigin)); + // FIXME: Tell the API layer to cancel the permission request? } void WebContentsDelegateQt::geolocationPermissionReply(const QUrl &origin, bool permission) { - if (m_lastGeolocationPermissionRequest.url == origin) - m_lastGeolocationPermissionRequest.callback.Run(permission); + if (m_geolocationPermissionRequests.contains(origin)) { + m_geolocationPermissionRequests[origin].Run(permission); + m_geolocationPermissionRequests.remove(origin); + } } |