summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-05-09 14:40:48 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-09 16:57:25 +0200
commit15ca2336302e21da3e11c8607f6f3ff4e433d09e (patch)
tree35502b542537330559bc53a228c17e941b965c16 /src
parent3a96f1a674778ecd79745db7fc5dbff3236a0853 (diff)
Fix Google Maps not showing tiles when panning/zooming
The issue is that the web worker that fetches and pre-process the map tiles couldn't be started successfully from a Blob. We were missing the blob: scheme handler that was passed to us in the ignored protocol_handlers argument of BrowserContextQt::CreateRequestContext. Change-Id: I24b726a1577e7092d53b1821efd3e4aa2a66c7d9 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/browser_context_qt.cpp2
-rw-r--r--src/core/url_request_context_getter_qt.cpp18
-rw-r--r--src/core/url_request_context_getter_qt.h9
3 files changed, 18 insertions, 11 deletions
diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp
index 48fd8ce26..f0b43a334 100644
--- a/src/core/browser_context_qt.cpp
+++ b/src/core/browser_context_qt.cpp
@@ -145,7 +145,7 @@ quota::SpecialStoragePolicy *BrowserContextQt::GetSpecialStoragePolicy()
net::URLRequestContextGetter *BrowserContextQt::CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers)
{
- url_request_getter_ = new URLRequestContextGetterQt(GetPath());
+ url_request_getter_ = new URLRequestContextGetterQt(GetPath(), protocol_handlers);
static_cast<ResourceContextQt*>(resourceContext.get())->set_url_request_context_getter(url_request_getter_.get());
return url_request_getter_.get();
}
diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp
index cfa6b0ae6..ce67bb23d 100644
--- a/src/core/url_request_context_getter_qt.cpp
+++ b/src/core/url_request_context_getter_qt.cpp
@@ -73,10 +73,11 @@ static const char kQrcSchemeQt[] = "qrc";
using content::BrowserThread;
-URLRequestContextGetterQt::URLRequestContextGetterQt(const base::FilePath &basePath)
+URLRequestContextGetterQt::URLRequestContextGetterQt(const base::FilePath &basePath, content::ProtocolHandlerMap *protocolHandlers)
: m_ignoreCertificateErrors(false)
, m_basePath(basePath)
{
+ std::swap(m_protocolHandlers, *protocolHandlers);
// We must create the proxy config service on the UI loop on Linux because it
// must synchronously run on the glib message loop. This will be passed to
@@ -161,16 +162,21 @@ net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext()
network_session_params, main_backend);
m_storage->set_http_transaction_factory(main_cache);
- // FIXME: add protocol handling
m_jobFactory.reset(new net::URLRequestJobFactoryImpl());
+
+ // Chromium has a few protocol handlers ready for us, only pick blob: and throw away the rest.
+ content::ProtocolHandlerMap::iterator it = m_protocolHandlers.find(chrome::kBlobScheme);
+ Q_ASSERT(it != m_protocolHandlers.end());
+ m_jobFactory->SetProtocolHandler(it->first, it->second.release());
+ m_protocolHandlers.clear();
+
m_jobFactory->SetProtocolHandler(chrome::kDataScheme, new net::DataProtocolHandler());
- m_jobFactory->SetProtocolHandler(
- chrome::kFileScheme,
- new net::FileProtocolHandler(content::BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
+ m_jobFactory->SetProtocolHandler(chrome::kFileScheme, new net::FileProtocolHandler(
+ content::BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
m_jobFactory->SetProtocolHandler(kQrcSchemeQt, new QrcProtocolHandlerQt());
m_jobFactory->SetProtocolHandler(content::kFtpScheme, new net::FtpProtocolHandler(
- new net::FtpNetworkLayer(m_urlRequestContext->host_resolver())));
+ new net::FtpNetworkLayer(m_urlRequestContext->host_resolver())));
m_urlRequestContext->set_job_factory(m_jobFactory.get());
}
diff --git a/src/core/url_request_context_getter_qt.h b/src/core/url_request_context_getter_qt.h
index ca56cb38e..2b4b3bedd 100644
--- a/src/core/url_request_context_getter_qt.h
+++ b/src/core/url_request_context_getter_qt.h
@@ -46,9 +46,10 @@
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
+#include "content/public/browser/content_browser_client.h"
+#include "content/public/common/url_constants.h"
#include "net/url_request/url_request_context_storage.h"
#include "net/url_request/url_request_job_factory_impl.h"
-#include "content/public/common/url_constants.h"
#include "qglobal.h"
@@ -61,10 +62,9 @@ class ProxyConfigService;
class URLRequestContextGetterQt : public net::URLRequestContextGetter {
public:
- explicit URLRequestContextGetterQt(const base::FilePath&);
-
- virtual net::URLRequestContext* GetURLRequestContext() Q_DECL_OVERRIDE;
+ explicit URLRequestContextGetterQt(const base::FilePath &, content::ProtocolHandlerMap *protocolHandlers);
+ virtual net::URLRequestContext *GetURLRequestContext() Q_DECL_OVERRIDE;
virtual scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const Q_DECL_OVERRIDE;
private:
@@ -72,6 +72,7 @@ private:
bool m_ignoreCertificateErrors;
base::FilePath m_basePath;
+ content::ProtocolHandlerMap m_protocolHandlers;
scoped_ptr<net::ProxyConfigService> m_proxyConfigService;
scoped_ptr<net::URLRequestContext> m_urlRequestContext;