summaryrefslogtreecommitdiffstats
path: root/src/core/url_request_context_getter_qt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/url_request_context_getter_qt.cpp')
-rw-r--r--src/core/url_request_context_getter_qt.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp
index fd0f24735..2622cb09e 100644
--- a/src/core/url_request_context_getter_qt.cpp
+++ b/src/core/url_request_context_getter_qt.cpp
@@ -44,6 +44,7 @@
#include "base/strings/string_util.h"
#include "base/task_scheduler/post_task.h"
#include "base/threading/sequenced_worker_pool.h"
+#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
#include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h"
#include "content/network/proxy_service_mojo.h"
#include "content/public/browser/browser_thread.h"
@@ -81,6 +82,7 @@
#include "api/qwebengineurlschemehandler.h"
#include "browser_context_adapter.h"
+#include "browser_context_qt.h"
#include "custom_protocol_handler.h"
#include "cookie_monster_delegate_qt.h"
#include "content_client_qt.h"
@@ -111,6 +113,14 @@ URLRequestContextGetterQt::URLRequestContextGetterQt(QSharedPointer<BrowserConte
{
std::swap(m_protocolHandlers, *protocolHandlers);
+ // The ProtocolHandlerRegistry and it's JobInterceptorFactory need to be
+ // created on the UI thread:
+ ProtocolHandlerRegistry* protocolHandlerRegistry =
+ ProtocolHandlerRegistryFactory::GetForBrowserContext(browserContext->browserContext());
+ DCHECK(protocolHandlerRegistry);
+ m_protocolHandlerInterceptor =
+ protocolHandlerRegistry->CreateJobInterceptorFactory();
+
QMutexLocker lock(&m_mutex);
m_cookieDelegate->setClient(browserContext->cookieStore());
setFullConfiguration(browserContext);
@@ -583,6 +593,11 @@ void URLRequestContextGetterQt::generateJobFactory()
m_requestInterceptors.clear();
+ if (m_protocolHandlerInterceptor) {
+ m_protocolHandlerInterceptor->Chain(std::move(topJobFactory));
+ topJobFactory = std::move(m_protocolHandlerInterceptor);
+ }
+
m_jobFactory = std::move(topJobFactory);
m_urlRequestContext->set_job_factory(m_jobFactory.get());