diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index b8c14c39efe094e6c3467629ae308bbd19d3428d..1749fc7085dfa941e8ab3d596c8811f7752c6d26 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -314,3 +314,14 @@ void BrowserContextAdapter::setHttpCacheMaxSize(int maxSize) if (m_browserContext->url_request_getter_.get()) m_browserContext->url_request_getter_->updateHttpCache(); } + +QVector<CustomUrlSchemeHandler*> &BrowserContextAdapter::customUrlSchemeHandlers() +{ + return m_customUrlSchemeHandlers; +} + +void BrowserContextAdapter::updateCustomUrlSchemeHandlers() +{ + if (m_browserContext->url_request_getter_.get()) + m_browserContext->url_request_getter_->updateStorageSettings(); +} diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h index 90f0bec7a0973d7bacc299159f4793a50a716d00..6389d666c945692351d99d21d4ae228bc57150cb 100644 --- a/src/core/browser_context_adapter.h +++ b/src/core/browser_context_adapter.h @@ -42,9 +42,11 @@ #include <QScopedPointer> #include <QSharedData> #include <QString> +#include <QVector> class BrowserContextAdapterClient; class BrowserContextQt; +class CustomUrlSchemeHandler; class DownloadManagerDelegateQt; class WebEngineVisitedLinksManager; @@ -119,6 +121,9 @@ public: bool trackVisitedLinks() const; bool persistVisitedLinks() const; + QVector<CustomUrlSchemeHandler*> &customUrlSchemeHandlers(); + void updateCustomUrlSchemeHandlers(); + private: QString m_name; bool m_offTheRecord; @@ -131,6 +136,7 @@ private: HttpCacheType m_httpCacheType; PersistentCookiesPolicy m_persistentCookiesPolicy; VisitedLinksPolicy m_visitedLinksPolicy; + QVector<CustomUrlSchemeHandler*> m_customUrlSchemeHandlers; BrowserContextAdapterClient *m_client; int m_httpCacheMaxSize; diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro index 3980dcc5a62ac15d21d93d9c4d7976ed4206f5d3..b93ea0175da6a2a0742e944d348d30064b010806 100644 --- a/src/core/core_gyp_generator.pro +++ b/src/core/core_gyp_generator.pro @@ -41,6 +41,8 @@ SOURCES = \ content_client_qt.cpp \ content_browser_client_qt.cpp \ content_main_delegate_qt.cpp \ + custom_protocol_handler.cpp \ + custom_url_scheme_handler.cpp \ delegated_frame_node.cpp \ desktop_screen_qt.cpp \ dev_tools_http_handler_delegate_qt.cpp \ @@ -66,6 +68,8 @@ SOURCES = \ stream_video_node.cpp \ surface_factory_qt.cpp \ url_request_context_getter_qt.cpp \ + url_request_custom_job.cpp \ + url_request_custom_job_delegate.cpp \ url_request_qrc_job_qt.cpp \ web_channel_ipc_transport_host.cpp \ web_contents_adapter.cpp \ @@ -94,6 +98,8 @@ HEADERS = \ content_client_qt.h \ content_browser_client_qt.h \ content_main_delegate_qt.h \ + custom_protocol_handler.h \ + custom_url_scheme_handler.h \ delegated_frame_node.h \ desktop_screen_qt.h \ dev_tools_http_handler_delegate_qt.h \ @@ -121,6 +127,8 @@ HEADERS = \ surface_factory_qt.h \ type_conversion.h \ url_request_context_getter_qt.h \ + url_request_custom_job.h \ + url_request_custom_job_delegate.h \ url_request_qrc_job_qt.h \ web_channel_ipc_transport_host.h \ web_contents_adapter.h \ diff --git a/src/core/custom_protocol_handler.cpp b/src/core/custom_protocol_handler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fd8cebb9e826b884979068f1bd3f9f89a3e09d6e --- /dev/null +++ b/src/core/custom_protocol_handler.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "custom_protocol_handler.h" +#include "url_request_custom_job.h" + +#include "net/base/net_errors.h" +#include "net/url_request/url_request.h" +#include "net/url_request/url_request_error_job.h" + +CustomProtocolHandler::CustomProtocolHandler(CustomUrlSchemeHandler *schemeHandler) + : m_schemeHandler(schemeHandler) +{ +} + +net::URLRequestJob *CustomProtocolHandler::MaybeCreateJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate) const +{ + if (!networkDelegate) + return new net::URLRequestErrorJob(request, Q_NULLPTR, net::ERR_ACCESS_DENIED); + + return new URLRequestCustomJob(request, networkDelegate, m_schemeHandler); +} diff --git a/src/core/custom_protocol_handler.h b/src/core/custom_protocol_handler.h new file mode 100644 index 0000000000000000000000000000000000000000..4b29a82b7714a082fe0a9dc24367d8090571998e --- /dev/null +++ b/src/core/custom_protocol_handler.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CUSTOM_PROTOCOL_HANDLER_H_ +#define CUSTOM_PROTOCOL_HANDLER_H_ + +#include "qtwebenginecoreglobal.h" +#include "net/url_request/url_request_job_factory.h" + +#include <QtCore/QByteArray> +#include <QtCore/QObject> +#include <QtCore/qcompilerdetection.h> // Needed for Q_DECL_OVERRIDE + +class BrowserContextAdapter; +class CustomUrlSchemeHandler; + +QT_FORWARD_DECLARE_CLASS(QIODevice) + +namespace net { +class NetworkDelegate; +class URLRequestJob; +} // namespace + +// Implements a ProtocolHandler for custom URL schemes. +// If |network_delegate_| is NULL then all file requests will fail with ERR_ACCESS_DENIED. +class QWEBENGINE_EXPORT CustomProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { + +public: + CustomProtocolHandler(CustomUrlSchemeHandler *); + + virtual net::URLRequestJob *MaybeCreateJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate) const Q_DECL_OVERRIDE; + +private: + DISALLOW_COPY_AND_ASSIGN(CustomProtocolHandler); + CustomUrlSchemeHandler *m_schemeHandler; +}; + +#endif // CUSTOM_PROTOCOL_HANDLER_H_ diff --git a/src/core/custom_url_scheme_handler.cpp b/src/core/custom_url_scheme_handler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a8701a5d4c506b82ae7bccc488a932caa53fe1d7 --- /dev/null +++ b/src/core/custom_url_scheme_handler.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "custom_url_scheme_handler.h" +#include "custom_protocol_handler.h" + +CustomUrlSchemeHandler::CustomUrlSchemeHandler(const QByteArray &scheme) + : m_scheme(scheme) + , m_protocolHandler(new CustomProtocolHandler(this)) +{ +} + +CustomUrlSchemeHandler::~CustomUrlSchemeHandler() +{ +} + +QByteArray CustomUrlSchemeHandler::scheme() const +{ + return m_scheme; +} + +void CustomUrlSchemeHandler::setScheme(const QByteArray &scheme) +{ + m_scheme = scheme; +} + +CustomProtocolHandler *CustomUrlSchemeHandler::protocolHandler() +{ + return m_protocolHandler.data(); +} diff --git a/src/core/custom_url_scheme_handler.h b/src/core/custom_url_scheme_handler.h new file mode 100644 index 0000000000000000000000000000000000000000..fef29c98a13a781b228ef41b42d57fdf1540e176 --- /dev/null +++ b/src/core/custom_url_scheme_handler.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CUSTOM_URL_SCHEME_HANDLER_H_ +#define CUSTOM_URL_SCHEME_HANDLER_H_ + +#include "qtwebenginecoreglobal.h" + +#include <QtCore/QByteArray> +#include <QtCore/QScopedPointer> + +class BrowserContextAdapter; +class CustomProtocolHandler; +class URLRequestCustomJobDelegate; + +QT_FORWARD_DECLARE_CLASS(QIODevice) + +class QWEBENGINE_EXPORT CustomUrlSchemeHandler { +public: + explicit CustomUrlSchemeHandler(const QByteArray &); + ~CustomUrlSchemeHandler(); + + QByteArray scheme() const; + void setScheme(const QByteArray &); + CustomProtocolHandler *protocolHandler(); + + virtual bool handleJob(URLRequestCustomJobDelegate*) = 0; + +private: + QByteArray m_scheme; + QScopedPointer<CustomProtocolHandler> m_protocolHandler; +}; + +#endif // CUSTOM_URL_SCHEME_HANDLER_H_ diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index 96ba36565456a70f5144791fa6171a6e8d78d449..41af37e5dda14ba65d85cb53db37e5df936e7308 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -62,6 +62,8 @@ #include "net/ftp/ftp_network_layer.h" #include "browser_context_adapter.h" +#include "custom_protocol_handler.h" +#include "custom_url_scheme_handler.h" #include "content_client_qt.h" #include "network_delegate_qt.h" #include "qrc_protocol_handler_qt.h" @@ -282,6 +284,10 @@ void URLRequestContextGetterQt::generateJobFactory() m_jobFactory->SetProtocolHandler(url::kFtpScheme, new net::FtpProtocolHandler(new net::FtpNetworkLayer(m_urlRequestContext->host_resolver()))); + Q_FOREACH (CustomUrlSchemeHandler* handler, m_browserContext->customUrlSchemeHandlers()) { + m_jobFactory->SetProtocolHandler(handler->scheme().toStdString(), handler->protocolHandler()); + } + m_urlRequestContext->set_job_factory(m_jobFactory.get()); } diff --git a/src/core/url_request_custom_job.cpp b/src/core/url_request_custom_job.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e97804c2f98783f7aafac7f4b0fdee254d2c52c4 --- /dev/null +++ b/src/core/url_request_custom_job.cpp @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "url_request_custom_job.h" +#include "url_request_custom_job_delegate.h" + +#include "custom_url_scheme_handler.h" +#include "type_conversion.h" + +#include "content/public/browser/browser_thread.h" +#include "net/base/net_errors.h" +#include "net/base/io_buffer.h" + +#include <QFileInfo> +#include <QMimeDatabase> +#include <QMimeType> +#include <QUrl> + +using namespace net; + +URLRequestCustomJob::URLRequestCustomJob(URLRequest *request, NetworkDelegate *networkDelegate, CustomUrlSchemeHandler *schemeHandler) + : URLRequestJob(request, networkDelegate) + , m_device(0) + , m_schemeHandler(schemeHandler) + , m_weakFactory(this) +{ +} + +URLRequestCustomJob::~URLRequestCustomJob() +{ + if (m_device && m_device->isOpen()) + m_device->close(); +} + +void URLRequestCustomJob::Start() +{ + content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, base::Bind(&URLRequestCustomJob::startAsync, m_weakFactory.GetWeakPtr())); +} + +void URLRequestCustomJob::Kill() +{ + if (m_device->isOpen()) + m_device->close(); + m_weakFactory.InvalidateWeakPtrs(); + + URLRequestJob::Kill(); +} + +bool URLRequestCustomJob::GetMimeType(std::string *mimeType) const +{ + if (m_mimeType.size() > 0) { + *mimeType = m_mimeType; + return true; + } + return false; +} + +bool URLRequestCustomJob::GetCharset(std::string* charset) +{ + if (m_charset.size() > 0) { + *charset = m_charset; + return true; + } + return false; +} + +void URLRequestCustomJob::setReplyMimeType(const std::string &mimeType) +{ + m_mimeType = mimeType; +} + +void URLRequestCustomJob::setReplyCharset(const std::string &charset) +{ + m_charset = charset; +} + +void URLRequestCustomJob::setReplyDevice(QIODevice *device) +{ + m_device = device; + if (m_device && !m_device->isReadable()) + m_device->open(QIODevice::ReadOnly); + content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestCustomJob::notifyStarted, m_weakFactory.GetWeakPtr())); +} + +bool URLRequestCustomJob::ReadRawData(IOBuffer *buf, int bufSize, int *bytesRead) +{ + Q_ASSERT(bytesRead); + qint64 rv = m_device ? m_device->read(buf->data(), bufSize) : -1; + if (rv >= 0) { + *bytesRead = static_cast<int>(rv); + return true; + } else { + NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, ERR_FAILED)); + } + return false; +} + +void URLRequestCustomJob::notifyStarted() +{ + if (m_device && m_device->isReadable()) + NotifyHeadersComplete(); + else + NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, ERR_INVALID_URL)); +} + +void URLRequestCustomJob::startAsync() +{ + m_delegate.reset(new URLRequestCustomJobDelegate(this)); + m_schemeHandler->handleJob(m_delegate.get()); +} diff --git a/src/core/url_request_custom_job.h b/src/core/url_request_custom_job.h new file mode 100644 index 0000000000000000000000000000000000000000..c47358e71512320f40f9ac670fb900aa831ea1df --- /dev/null +++ b/src/core/url_request_custom_job.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef URL_REQUEST_CUSTOM_JOB_H_ +#define URL_REQUEST_CUSTOM_JOB_H_ + +#include "net/url_request/url_request.h" +#include "net/url_request/url_request_job.h" + +#include <QtCore/qglobal.h> + +QT_FORWARD_DECLARE_CLASS(QIODevice) + +class CustomUrlSchemeHandler; +class URLRequestCustomJobDelegate; + +// A request job that handles reading custom URL schemes +class URLRequestCustomJob : public net::URLRequestJob { +public: + URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, CustomUrlSchemeHandler *schemeHandler); + virtual void Start() Q_DECL_OVERRIDE; + virtual void Kill() Q_DECL_OVERRIDE; + virtual bool ReadRawData(net::IOBuffer *buf, int bufSize, int *bytesRead) Q_DECL_OVERRIDE; + virtual bool GetMimeType(std::string *mimeType) const Q_DECL_OVERRIDE; + virtual bool GetCharset(std::string *charset) Q_DECL_OVERRIDE; + + void setReplyMimeType(const std::string &); + void setReplyCharset(const std::string &); + void setReplyDevice(QIODevice *); + +protected: + virtual ~URLRequestCustomJob(); + void startAsync(); + void notifyStarted(); + +private: + QIODevice *m_device; + scoped_ptr<URLRequestCustomJobDelegate> m_delegate; + CustomUrlSchemeHandler *m_schemeHandler; + std::string m_mimeType; + std::string m_charset; + base::WeakPtrFactory<URLRequestCustomJob> m_weakFactory; + + DISALLOW_COPY_AND_ASSIGN(URLRequestCustomJob); +}; + +#endif // URL_REQUEST_CUSTOM_JOB_H_ diff --git a/src/core/url_request_custom_job_delegate.cpp b/src/core/url_request_custom_job_delegate.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fcb2220bcc770d3b4fb49564c9d8aea249edd217 --- /dev/null +++ b/src/core/url_request_custom_job_delegate.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "url_request_custom_job.h" +#include "url_request_custom_job_delegate.h" + +#include "type_conversion.h" + +#include <QByteArray> + +URLRequestCustomJobDelegate::URLRequestCustomJobDelegate(URLRequestCustomJob *job) + : m_job(job) +{ +} + +URLRequestCustomJobDelegate::~URLRequestCustomJobDelegate() +{ +} + +QUrl URLRequestCustomJobDelegate::url() const +{ + return toQt(m_job->request()->url()); +} + +void URLRequestCustomJobDelegate::setReply(const QByteArray &contentType, QIODevice *device) +{ + m_job->setReplyMimeType(contentType.toStdString()); + m_job->setReplyDevice(device); +} + diff --git a/src/core/url_request_custom_job_delegate.h b/src/core/url_request_custom_job_delegate.h new file mode 100644 index 0000000000000000000000000000000000000000..e82debdf2419c320a7dec329555fb17532826982 --- /dev/null +++ b/src/core/url_request_custom_job_delegate.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef URL_REQUEST_CUSTOM_JOB_DELEGATE_H_ +#define URL_REQUEST_CUSTOM_JOB_DELEGATE_H_ + +#include "qtwebenginecoreglobal.h" + +#include <QObject> +#include <QUrl> + +QT_FORWARD_DECLARE_CLASS(QIODevice) + +class URLRequestCustomJob; + +class QWEBENGINE_EXPORT URLRequestCustomJobDelegate : public QObject { + Q_OBJECT +public: + ~URLRequestCustomJobDelegate(); + + QUrl url() const; + + void setReply(const QByteArray &contentType, QIODevice *device); + +private: + URLRequestCustomJobDelegate(URLRequestCustomJob *job); + + friend class URLRequestCustomJob; + URLRequestCustomJob *m_job; +}; + +#endif // URL_REQUEST_CUSTOM_JOB_DELEGATE_H_ diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 6427d3811ca5fdd5f64b18d95619b24a4602871b..3de2fe521922ec47ca509cb113944674cee5c568 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -41,6 +41,7 @@ #include "qwebenginepage.h" #include "qwebengineprofile_p.h" #include "qwebenginesettings.h" +#include "qwebengineurlschemehandler_p_p.h" #include "browser_context_adapter.h" #include "web_engine_visited_links_manager.h" @@ -453,4 +454,51 @@ QWebEngineSettings *QWebEngineProfile::settings() const return d->settings(); } +QWebEngineUrlSchemeHandler *QWebEngineProfilePrivate::urlSchemeHandler(const QByteArray &protocol) +{ + if (m_urlSchemeHandlers.contains(protocol)) + return m_urlSchemeHandlers.value(protocol); + return 0; +} + +static bool checkInternalScheme(const QByteArray &scheme) +{ + static QSet<QByteArray> internalSchemes; + if (internalSchemes.isEmpty()) { + internalSchemes << QByteArrayLiteral("qrc") << QByteArrayLiteral("data") << QByteArrayLiteral("blob") + << QByteArrayLiteral("http") << QByteArrayLiteral("ftp") << QByteArrayLiteral("javascript"); + } + return internalSchemes.contains(scheme); +} + +void QWebEngineProfilePrivate::installUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler) +{ + Q_ASSERT(handler); + QByteArray scheme = handler->scheme(); + if (checkInternalScheme(scheme)) { + qWarning() << "Can not install a URL scheme handler overriding internal scheme: " << scheme; + return; + } + + m_urlSchemeHandlers.insert(scheme, handler); + browserContext()->customUrlSchemeHandlers().append(handler->d_func()); + browserContext()->updateCustomUrlSchemeHandlers(); +} + +void QWebEngineProfilePrivate::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler) +{ + int count = m_urlSchemeHandlers.remove(handler->scheme()); + if (!count) + return; + browserContext()->customUrlSchemeHandlers().removeOne(handler->d_func()); + browserContext()->updateCustomUrlSchemeHandlers(); +} + +void QWebEngineProfilePrivate::clearUrlSchemeHandlers() +{ + m_urlSchemeHandlers.clear(); + browserContext()->customUrlSchemeHandlers().clear(); + browserContext()->updateCustomUrlSchemeHandlers(); +} + QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h index ac875c050672a231bd637597333b035376c22ac7..a2523edad36d1864b08f0604ec4b4c3d8f646b46 100644 --- a/src/webenginewidgets/api/qwebengineprofile.h +++ b/src/webenginewidgets/api/qwebengineprofile.h @@ -104,10 +104,11 @@ Q_SIGNALS: void downloadRequested(QWebEngineDownloadItem *download); private: - Q_DECLARE_PRIVATE(QWebEngineProfile); + Q_DECLARE_PRIVATE(QWebEngineProfile) QWebEngineProfile(QWebEngineProfilePrivate *); friend class QWebEnginePagePrivate; + friend class QWebEngineUrlSchemeHandler; QScopedPointer<QWebEngineProfilePrivate> d_ptr; }; diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h index b56e1b3b2f909e1e81b4366393829c02711120d8..1fc2297c7cb193c47a976b3cb4a86a4550353584 100644 --- a/src/webenginewidgets/api/qwebengineprofile_p.h +++ b/src/webenginewidgets/api/qwebengineprofile_p.h @@ -39,6 +39,7 @@ #include "browser_context_adapter_client.h" #include "qwebengineprofile.h" +#include "qwebengineurlschemehandler_p.h" #include <QMap> #include <QPointer> @@ -63,12 +64,18 @@ public: void downloadRequested(DownloadItemInfo &info) Q_DECL_OVERRIDE; void downloadUpdated(const DownloadItemInfo &info) Q_DECL_OVERRIDE; + QWebEngineUrlSchemeHandler *urlSchemeHandler(const QByteArray &); + void installUrlSchemeHandler(QWebEngineUrlSchemeHandler *); + void removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *); + void clearUrlSchemeHandlers(); + private: QWebEngineProfile *q_ptr; QWebEngineSettings *m_settings; BrowserContextAdapter *m_browserContext; QExplicitlySharedDataPointer<BrowserContextAdapter> m_browserContextRef; QMap<quint32, QPointer<QWebEngineDownloadItem> > m_ongoingDownloads; + QMap<QByteArray, QPointer<QWebEngineUrlSchemeHandler> > m_urlSchemeHandlers; }; QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebengineurlrequestjob.cpp b/src/webenginewidgets/api/qwebengineurlrequestjob.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e937a5bba6f1aea3ae4306429ea250e7e8d5db46 --- /dev/null +++ b/src/webenginewidgets/api/qwebengineurlrequestjob.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwebengineurlrequestjob_p.h" + +#include "qwebengineprofile.h" + +#include "url_request_custom_job_delegate.h" + +QT_BEGIN_NAMESPACE + +QWebEngineUrlRequestJob::QWebEngineUrlRequestJob(URLRequestCustomJobDelegate * p) + : QObject(p) // owned by the jobdelegate and deleted when the job is done + , d_ptr(p) +{ +} + +QWebEngineUrlRequestJob::~QWebEngineUrlRequestJob() +{ +} + +QUrl QWebEngineUrlRequestJob::requestUrl() const +{ + return d_ptr->url(); +} + +void QWebEngineUrlRequestJob::setReply(const QByteArray &contentType, QIODevice *device) +{ + d_ptr->setReply(contentType, device); +} + + + +QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebengineurlrequestjob_p.h b/src/webenginewidgets/api/qwebengineurlrequestjob_p.h new file mode 100644 index 0000000000000000000000000000000000000000..3aea80d2fe9b1930121aa5e0fd8bce255e5a324a --- /dev/null +++ b/src/webenginewidgets/api/qwebengineurlrequestjob_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWEBENGINEURLREQUESTJOB_H +#define QWEBENGINEURLREQUESTJOB_H + +#include "qtwebenginewidgetsglobal.h" + +#include <QtCore/QByteArray> +#include <QtCore/QObject> +#include <QtCore/QUrl> + +class URLRequestCustomJobDelegate; + +QT_BEGIN_NAMESPACE + +class QIODevice; + +class QWEBENGINEWIDGETS_EXPORT QWebEngineUrlRequestJob : public QObject { + Q_OBJECT +public: + ~QWebEngineUrlRequestJob(); + + QUrl requestUrl() const; + void setReply(const QByteArray &contentType, QIODevice *device); + +private: + QWebEngineUrlRequestJob(URLRequestCustomJobDelegate *); + friend class QWebEngineUrlSchemeHandlerPrivate; + + URLRequestCustomJobDelegate* d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QWEBENGINEURLREQUESTJOB_H diff --git a/src/webenginewidgets/api/qwebengineurlschemehandler.cpp b/src/webenginewidgets/api/qwebengineurlschemehandler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b52912b7c6c93432594c7599bbb0d57331fb227e --- /dev/null +++ b/src/webenginewidgets/api/qwebengineurlschemehandler.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwebengineurlschemehandler_p.h" +#include "qwebengineurlschemehandler_p_p.h" + +#include "qwebengineprofile.h" +#include "qwebengineprofile_p.h" +#include "qwebengineurlrequestjob_p.h" + +#include <QSharedPointer> + +QT_BEGIN_NAMESPACE + +QWebEngineUrlSchemeHandlerPrivate::QWebEngineUrlSchemeHandlerPrivate(const QByteArray &scheme, QWebEngineUrlSchemeHandler *q, QWebEngineProfile *profile) + : CustomUrlSchemeHandler(scheme) + , q_ptr(q) + , m_profile(profile) +{ +} + +QWebEngineUrlSchemeHandlerPrivate::~QWebEngineUrlSchemeHandlerPrivate() +{ +} + +bool QWebEngineUrlSchemeHandlerPrivate::handleJob(URLRequestCustomJobDelegate *job) +{ + QWebEngineUrlRequestJob *requestJob = new QWebEngineUrlRequestJob(job); + q_ptr->requestStarted(requestJob); + return true; +} + +QWebEngineUrlSchemeHandler::QWebEngineUrlSchemeHandler(const QByteArray &scheme, QWebEngineProfile *profile) + : QObject(profile) + , d_ptr(new QWebEngineUrlSchemeHandlerPrivate(scheme, this, profile)) +{ + profile->d_func()->installUrlSchemeHandler(this); +} + +QWebEngineUrlSchemeHandler::~QWebEngineUrlSchemeHandler() +{ + d_ptr->m_profile->d_func()->removeUrlSchemeHandler(this); +} + +QByteArray QWebEngineUrlSchemeHandler::scheme() const +{ + return d_ptr->scheme(); +} + +QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebengineurlschemehandler_p.h b/src/webenginewidgets/api/qwebengineurlschemehandler_p.h new file mode 100644 index 0000000000000000000000000000000000000000..0455128c7abd338c9a5d129d0c693d66fb7d16c9 --- /dev/null +++ b/src/webenginewidgets/api/qwebengineurlschemehandler_p.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWEBENGINEURLSCHEMEHANDLER_H +#define QWEBENGINEURLSCHEMEHANDLER_H + +#include "qtwebenginewidgetsglobal.h" + +#include <QtCore/QByteArray> +#include <QtCore/QIODevice> +#include <QtCore/QObject> +#include <QtCore/QScopedPointer> +#include <QtCore/QUrl> + +QT_BEGIN_NAMESPACE + +class QWebEngineProfile; +class QWebEngineUrlRequestJob; +class QWebEngineUrlSchemeHandlerPrivate; + +class QWEBENGINEWIDGETS_EXPORT QWebEngineUrlSchemeHandler : public QObject { + Q_OBJECT +public: + QWebEngineUrlSchemeHandler(const QByteArray &scheme, QWebEngineProfile *profile); + virtual ~QWebEngineUrlSchemeHandler(); + + QByteArray scheme() const; + + virtual void requestStarted(QWebEngineUrlRequestJob*) = 0; + +private: + Q_DECLARE_PRIVATE(QWebEngineUrlSchemeHandler) + friend class QWebEngineProfilePrivate; + QScopedPointer<QWebEngineUrlSchemeHandlerPrivate> d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QWEBENGINEURLSCHEMEHANDLER_H diff --git a/src/webenginewidgets/api/qwebengineurlschemehandler_p_p.h b/src/webenginewidgets/api/qwebengineurlschemehandler_p_p.h new file mode 100644 index 0000000000000000000000000000000000000000..e880bf0001d4feffe68a045979e213b666e295f3 --- /dev/null +++ b/src/webenginewidgets/api/qwebengineurlschemehandler_p_p.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWEBENGINEURLSCHEMEHANDLER_P_H +#define QWEBENGINEURLSCHEMEHANDLER_P_H + +#include "qwebengineurlschemehandler_p.h" + +#include "custom_url_scheme_handler.h" + +QT_BEGIN_NAMESPACE + +class QWebEngineProfile; +class QWebEngineUrlRequestJob; +class QWebEngineUrlSchemeHandler; + +class QWebEngineUrlSchemeHandlerPrivate : public CustomUrlSchemeHandler { +public: + Q_DECLARE_PUBLIC(QWebEngineUrlSchemeHandler) + + QWebEngineUrlSchemeHandlerPrivate(const QByteArray &, QWebEngineUrlSchemeHandler *, QWebEngineProfile *); + virtual ~QWebEngineUrlSchemeHandlerPrivate(); + + virtual bool handleJob(URLRequestCustomJobDelegate*) Q_DECL_OVERRIDE; + +private: + QWebEngineUrlSchemeHandler *q_ptr; + QWebEngineProfile* m_profile; +}; + +QT_END_NAMESPACE + +#endif // QWEBENGINEURLSCHEMEHANDLER_P_H diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro index 82908bfd03b1cd898fcb2ca645ff8718692f90c3..7fa63070276b44c66312595ef59da4c708f78216 100644 --- a/src/webenginewidgets/webenginewidgets.pro +++ b/src/webenginewidgets/webenginewidgets.pro @@ -18,6 +18,8 @@ SOURCES = \ api/qwebenginepage.cpp \ api/qwebengineprofile.cpp \ api/qwebenginesettings.cpp \ + api/qwebengineurlrequestjob.cpp \ + api/qwebengineurlschemehandler.cpp \ api/qwebengineview.cpp \ render_widget_host_view_qt_delegate_widget.cpp @@ -32,6 +34,9 @@ HEADERS = \ api/qwebengineprofile.h \ api/qwebengineprofile_p.h \ api/qwebenginesettings.h \ + api/qwebengineurlrequestjob_p.h \ + api/qwebengineurlschemehandler_p.h \ + api/qwebengineurlschemehandler_p_p.h \ api/qwebengineview.h \ api/qwebengineview_p.h \ render_widget_host_view_qt_delegate_widget.h