summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-03-16 13:46:47 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-03-17 18:19:05 +0000
commit24610724db7918150d07ee7037019ecabe65d160 (patch)
tree57e6aa2031da611c163c16edae1bef597fc389c4
parent327fcc7fd3396219a29a6c8d38dc4774e410c1e9 (diff)
Fix HTTP authentication
Render Frame ID is no longer reliable, so use web-contents getter to get web-contents. Task-number: QTBUG-66845 Change-Id: Ic42a3fcaea381118bfd498b7c4f7d7e30b0f5f51 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
-rw-r--r--src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp18
-rw-r--r--src/core/renderer_host/resource_dispatcher_host_delegate_qt.h5
2 files changed, 11 insertions, 12 deletions
diff --git a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp
index 53d3e88ba..421b3167b 100644
--- a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp
+++ b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp
@@ -61,11 +61,14 @@ ResourceDispatcherHostLoginDelegateQt::ResourceDispatcherHostLoginDelegateQt(net
, m_request(request)
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- content::ResourceRequestInfo::GetRenderFrameForRequest(request, &m_renderProcessId, &m_renderFrameId);
+ const content::ResourceRequestInfo *requestInfo = content::ResourceRequestInfo::ForRequest(request);
+ Q_ASSERT(requestInfo);
content::BrowserThread::PostTask(
- content::BrowserThread::UI, FROM_HERE,
- base::Bind(&ResourceDispatcherHostLoginDelegateQt::triggerDialog, this));
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(&ResourceDispatcherHostLoginDelegateQt::triggerDialog,
+ this,
+ requestInfo->GetWebContentsGetterForRequest()));
}
ResourceDispatcherHostLoginDelegateQt::~ResourceDispatcherHostLoginDelegateQt()
@@ -100,14 +103,13 @@ bool ResourceDispatcherHostLoginDelegateQt::isProxy() const
return m_authInfo->is_proxy;
}
-void ResourceDispatcherHostLoginDelegateQt::triggerDialog()
+void ResourceDispatcherHostLoginDelegateQt::triggerDialog(const content::ResourceRequestInfo::WebContentsGetter &webContentsGetter)
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- content::RenderFrameHost *renderFrameHost = content::RenderFrameHost::FromID(m_renderProcessId, m_renderFrameId);
- if (!renderFrameHost)
+ content::WebContentsImpl *webContents =
+ static_cast<content::WebContentsImpl *>(webContentsGetter.Run());
+ if (!webContents)
return;
- content::RenderViewHost *renderViewHost = renderFrameHost->GetRenderViewHost();
- content::WebContentsImpl *webContents = static_cast<content::WebContentsImpl *>(content::WebContents::FromRenderViewHost(renderViewHost));
WebContentsAdapterClient *client = WebContentsViewQt::from(webContents->GetView())->client();
AuthenticationDialogControllerPrivate *dialogControllerData = new AuthenticationDialogControllerPrivate(this);
diff --git a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h
index 305f0cea5..c254a60f5 100644
--- a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h
+++ b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h
@@ -65,12 +65,9 @@ public:
void sendAuthToRequester(bool success, const QString &user, const QString &password);
private:
- void triggerDialog();
+ void triggerDialog(const content::ResourceRequestInfo::WebContentsGetter &);
void destroy();
- int m_renderProcessId;
- int m_renderFrameId;
-
scoped_refptr<net::AuthChallengeInfo> m_authInfo;
// The request that wants login data.