summaryrefslogtreecommitdiff
path: root/Source/WebKit2/NetworkProcess
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2017-04-24 22:40:03 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-04-25 18:29:55 +0000
commit4bd713d56aa9bb86bc96ea9cb0c64cbf94bf43d4 (patch)
tree02bd448d49627f059df0d8036fbdb9d9ee883a50 /Source/WebKit2/NetworkProcess
parentbd3f57b00bee3088971209a0ebc513eb1ef4ba14 (diff)
downloadqtwebkit-4bd713d56aa9bb86bc96ea9cb0c64cbf94bf43d4.tar.gz
Import WebKit commit 3040e0455efecd271f1aeef53cf287e75486a70d
Change-Id: I7df106cef8ce93ce33e49ad6fb0d202cd066d87c Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebKit2/NetworkProcess')
-rw-r--r--Source/WebKit2/NetworkProcess/CustomProtocols/qt/CustomProtocolManagerImpl.h36
-rw-r--r--Source/WebKit2/NetworkProcess/CustomProtocols/qt/CustomProtocolManagerQt.cpp78
-rw-r--r--Source/WebKit2/NetworkProcess/Downloads/Download.cpp3
-rw-r--r--Source/WebKit2/NetworkProcess/Downloads/Download.h2
-rw-r--r--Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp2
-rw-r--r--Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h2
-rw-r--r--Source/WebKit2/NetworkProcess/Downloads/qt/DownloadQt.cpp17
-rw-r--r--Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp34
-rw-r--r--Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.h10
-rw-r--r--Source/WebKit2/NetworkProcess/EntryPoint/qt/NetworkProcessMain.cpp35
-rw-r--r--Source/WebKit2/NetworkProcess/NetworkProcess.cpp7
-rw-r--r--Source/WebKit2/NetworkProcess/NetworkProcess.h15
-rw-r--r--Source/WebKit2/NetworkProcess/NetworkProcess.messages.in3
-rw-r--r--Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp4
-rw-r--r--Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h4
-rw-r--r--Source/WebKit2/NetworkProcess/RemoteNetworkingContext.h7
-rw-r--r--Source/WebKit2/NetworkProcess/qt/NetworkProcessMainQt.cpp125
-rw-r--r--Source/WebKit2/NetworkProcess/qt/NetworkProcessQt.cpp77
-rw-r--r--Source/WebKit2/NetworkProcess/qt/QtNetworkAccessManager.cpp136
-rw-r--r--Source/WebKit2/NetworkProcess/qt/QtNetworkAccessManager.h58
-rw-r--r--Source/WebKit2/NetworkProcess/qt/RemoteNetworkingContextQt.cpp65
21 files changed, 687 insertions, 33 deletions
diff --git a/Source/WebKit2/NetworkProcess/CustomProtocols/qt/CustomProtocolManagerImpl.h b/Source/WebKit2/NetworkProcess/CustomProtocols/qt/CustomProtocolManagerImpl.h
new file mode 100644
index 000000000..a115e40eb
--- /dev/null
+++ b/Source/WebKit2/NetworkProcess/CustomProtocols/qt/CustomProtocolManagerImpl.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016 Konstantin Tokarev <annulen@yandex.ru>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/Noncopyable.h>
+
+namespace WebKit {
+
+class CustomProtocolManagerImpl {
+ WTF_MAKE_NONCOPYABLE(CustomProtocolManagerImpl);
+};
+
+} // namespace WebKit
diff --git a/Source/WebKit2/NetworkProcess/CustomProtocols/qt/CustomProtocolManagerQt.cpp b/Source/WebKit2/NetworkProcess/CustomProtocols/qt/CustomProtocolManagerQt.cpp
new file mode 100644
index 000000000..9e79503c4
--- /dev/null
+++ b/Source/WebKit2/NetworkProcess/CustomProtocols/qt/CustomProtocolManagerQt.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2017 Konstantin Tokarev <annulen@yandex.ru>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "CustomProtocolManager.h"
+
+namespace WebKit {
+
+const char* CustomProtocolManager::supplementName()
+{
+ return "";
+}
+
+CustomProtocolManager::CustomProtocolManager(ChildProcess*)
+ : m_impl(nullptr)
+{
+}
+
+void CustomProtocolManager::initializeConnection(IPC::Connection*)
+{
+}
+
+void CustomProtocolManager::initialize(const NetworkProcessCreationParameters&)
+{
+}
+
+void CustomProtocolManager::registerScheme(const String&)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void CustomProtocolManager::unregisterScheme(const String&)
+{
+}
+
+bool CustomProtocolManager::supportsScheme(const String&)
+{
+ return false;
+}
+
+void CustomProtocolManager::didFailWithError(uint64_t, const WebCore::ResourceError&)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void CustomProtocolManager::didLoadData(uint64_t, const IPC::DataReference&)
+{
+}
+
+void CustomProtocolManager::didReceiveResponse(uint64_t, const WebCore::ResourceResponse&, uint32_t)
+{
+}
+
+void CustomProtocolManager::didFinishLoading(uint64_t)
+{
+}
+
+void CustomProtocolManager::wasRedirectedToRequest(uint64_t, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&)
+{
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/NetworkProcess/Downloads/Download.cpp b/Source/WebKit2/NetworkProcess/Downloads/Download.cpp
index 67f8128fd..4d2398a54 100644
--- a/Source/WebKit2/NetworkProcess/Downloads/Download.cpp
+++ b/Source/WebKit2/NetworkProcess/Downloads/Download.cpp
@@ -53,9 +53,6 @@ Download::Download(DownloadManager& downloadManager, DownloadID downloadID, cons
#if !USE(NETWORK_SESSION)
, m_request(request)
#endif
-#if PLATFORM(QT)
- , m_qtDownloader(0)
-#endif
{
ASSERT(m_downloadID.downloadID());
diff --git a/Source/WebKit2/NetworkProcess/Downloads/Download.h b/Source/WebKit2/NetworkProcess/Downloads/Download.h
index 9720f2aac..2c5a3a83d 100644
--- a/Source/WebKit2/NetworkProcess/Downloads/Download.h
+++ b/Source/WebKit2/NetworkProcess/Downloads/Download.h
@@ -149,7 +149,7 @@ private:
RefPtr<DownloadAuthenticationClient> m_authenticationClient;
#endif
#if PLATFORM(QT)
- QtFileDownloader* m_qtDownloader;
+ QtFileDownloader* m_qtDownloader { nullptr };
#endif
#if PLATFORM(GTK) || PLATFORM(EFL)
std::unique_ptr<WebCore::ResourceHandleClient> m_downloadClient;
diff --git a/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp b/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp
index 0dd20f0e1..f05aa645c 100644
--- a/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp
+++ b/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp
@@ -150,7 +150,7 @@ AuthenticationManager& DownloadManager::downloadsAuthenticationManager()
}
#if PLATFORM(QT)
-void DownloadManager::startTransfer(uint64_t downloadID, const String& destination)
+void DownloadManager::startTransfer(DownloadID downloadID, const String& destination)
{
ASSERT(m_downloads.contains(downloadID));
Download* download = m_downloads.get(downloadID);
diff --git a/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h b/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h
index ea433e5b0..53c8d3bb9 100644
--- a/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h
+++ b/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h
@@ -96,7 +96,7 @@ public:
AuthenticationManager& downloadsAuthenticationManager();
#if PLATFORM(QT)
- void startTransfer(uint64_t downloadID, const String& destination);
+ void startTransfer(DownloadID, const String& destination);
#endif
private:
diff --git a/Source/WebKit2/NetworkProcess/Downloads/qt/DownloadQt.cpp b/Source/WebKit2/NetworkProcess/Downloads/qt/DownloadQt.cpp
index 9747f5210..3db5ecdfb 100644
--- a/Source/WebKit2/NetworkProcess/Downloads/qt/DownloadQt.cpp
+++ b/Source/WebKit2/NetworkProcess/Downloads/qt/DownloadQt.cpp
@@ -28,7 +28,6 @@
#include "Download.h"
#include "QtFileDownloader.h"
-#include "WebProcess.h"
#include <WebCore/NotImplemented.h>
#include <WebCore/QNetworkReplyHandler.h>
#include <WebCore/ResourceHandle.h>
@@ -41,19 +40,19 @@ namespace WebKit {
void Download::start()
{
- QNetworkAccessManager* manager = WebProcess::singleton().networkAccessManager();
- ASSERT(manager);
ASSERT(!m_qtDownloader);
-
- m_qtDownloader = new QtFileDownloader(this, manager->get(m_request.toNetworkRequest()));
- m_qtDownloader->init();
+ m_qtDownloader = new QtFileDownloader(*this, m_request.toNetworkRequest());
}
void Download::startWithHandle(ResourceHandle* handle, const ResourceResponse& resp)
{
ASSERT(!m_qtDownloader);
- m_qtDownloader = new QtFileDownloader(this, handle->getInternal()->m_job->release());
- m_qtDownloader->init();
+ m_qtDownloader = new QtFileDownloader(*this, handle->getInternal()->m_job->release());
+}
+
+void Download::resume(const IPC::DataReference&, const WTF::String&, const SandboxExtension::Handle&)
+{
+ notImplemented();
}
void Download::cancel()
@@ -66,7 +65,7 @@ void Download::platformInvalidate()
{
ASSERT(m_qtDownloader);
m_qtDownloader->deleteLater();
- m_qtDownloader = 0;
+ m_qtDownloader = nullptr;
}
void Download::startTransfer(const String& destination)
diff --git a/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp b/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp
index abed3cd34..2eaed702d 100644
--- a/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp
+++ b/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp
@@ -24,6 +24,7 @@
#include "Download.h"
#include "HTTPParsers.h"
#include "MIMETypeRegistry.h"
+#include "NetworkProcess.h"
#include <QCoreApplication>
#include <QFile>
#include <QFileInfo>
@@ -37,12 +38,25 @@ using namespace WTF;
namespace WebKit {
-QtFileDownloader::QtFileDownloader(Download* download, QNetworkReply* reply)
+QtFileDownloader::QtFileDownloader(Download& download, const QNetworkRequest& request)
: m_download(download)
- , m_reply(reply)
+ , m_reply(NetworkProcess::singleton().networkAccessManager().get(request))
, m_error(QNetworkReply::NoError)
- , m_headersRead(false)
{
+ makeConnections();
+}
+
+QtFileDownloader::QtFileDownloader(Download& download, QNetworkReply* reply)
+ : m_download(download)
+ , m_reply(reply)
+ , m_error(reply->error())
+{
+ makeConnections();
+
+ if (reply->isFinished())
+ onFinished();
+ else if (reply->isReadable())
+ onReadyRead();
}
QtFileDownloader::~QtFileDownloader()
@@ -53,7 +67,7 @@ QtFileDownloader::~QtFileDownloader()
abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorAborted);
}
-void QtFileDownloader::init()
+void QtFileDownloader::makeConnections()
{
connect(m_reply.get(), SIGNAL(readyRead()), SLOT(onReadyRead()));
connect(m_reply.get(), SIGNAL(finished()), SLOT(onFinished()));
@@ -86,7 +100,7 @@ void QtFileDownloader::startTransfer(const QString& decidedFilePath)
// finished shall be called in the end.
m_destinationFile = WTFMove(downloadFile);
- m_download->didCreateDestination(m_destinationFile->fileName());
+ m_download.didCreateDestination(m_destinationFile->fileName());
// We might have gotten readyRead already even before this function
// was called.
@@ -105,7 +119,7 @@ void QtFileDownloader::abortDownloadWritingAndEmitError(QtFileDownloader::Downlo
// On network failures it's QNetworkReplyHandler::errorForReply who will handle errors.
if (errorCode == QtFileDownloader::DownloadErrorNetworkFailure) {
- m_download->didFail(QNetworkReplyHandler::errorForReply(m_reply.get()), IPC::DataReference(0, 0));
+ m_download.didFail(QNetworkReplyHandler::errorForReply(m_reply.get()), IPC::DataReference(0, 0));
return;
}
@@ -135,7 +149,7 @@ void QtFileDownloader::abortDownloadWritingAndEmitError(QtFileDownloader::Downlo
ResourceError downloadError("Download", errorCode, m_reply->url(), translatedErrorMessage);
- m_download->didFail(downloadError, IPC::DataReference(0, 0));
+ m_download.didFail(downloadError, IPC::DataReference(0, 0));
}
void QtFileDownloader::handleDownloadResponse()
@@ -151,7 +165,7 @@ void QtFileDownloader::handleDownloadResponse()
mimeType = MIMETypeRegistry::getMIMETypeForPath(m_reply->url().path());
ResourceResponse response(m_reply->url(), mimeType, m_reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), encoding);
- m_download->didReceiveResponse(response);
+ m_download.didReceiveResponse(response);
}
void QtFileDownloader::onReadyRead()
@@ -172,7 +186,7 @@ void QtFileDownloader::onReadyRead()
// does not actually represent an error.
ASSERT(bytesWritten == content.size());
- m_download->didReceiveData(bytesWritten);
+ m_download.didReceiveData(bytesWritten);
} else if (!m_headersRead) {
handleDownloadResponse();
m_headersRead = true;
@@ -195,7 +209,7 @@ void QtFileDownloader::onFinished()
m_destinationFile = nullptr;
if (m_error == QNetworkReply::NoError)
- m_download->didFinish();
+ m_download.didFinish();
else if (m_error == QNetworkReply::OperationCanceledError)
abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCancelled);
else
diff --git a/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.h b/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.h
index 738f38b9c..58f2d5f1f 100644
--- a/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.h
+++ b/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.h
@@ -40,10 +40,11 @@ class Download;
class QtFileDownloader : public QObject {
Q_OBJECT
public:
- QtFileDownloader(Download*, QNetworkReply*);
+ QtFileDownloader(Download&, const QNetworkRequest&);
+ QtFileDownloader(Download&, QNetworkReply*);
virtual ~QtFileDownloader();
+
void cancel();
- void init();
void startTransfer(const QString& destination);
enum DownloadError {
@@ -62,14 +63,15 @@ private Q_SLOTS:
void onError(QNetworkReply::NetworkError);
private:
+ void makeConnections();
void abortDownloadWritingAndEmitError(QtFileDownloader::DownloadError);
void handleDownloadResponse();
- Download* m_download;
+ Download& m_download;
std::unique_ptr<QNetworkReply> m_reply;
std::unique_ptr<QFile> m_destinationFile;
QNetworkReply::NetworkError m_error;
- bool m_headersRead;
+ bool m_headersRead { false };
};
} // namespace WebKit
diff --git a/Source/WebKit2/NetworkProcess/EntryPoint/qt/NetworkProcessMain.cpp b/Source/WebKit2/NetworkProcess/EntryPoint/qt/NetworkProcessMain.cpp
new file mode 100644
index 000000000..b102fc566
--- /dev/null
+++ b/Source/WebKit2/NetworkProcess/EntryPoint/qt/NetworkProcessMain.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2016 Konstantin Tokarev <annulen@yandex.ru>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+namespace WebKit {
+Q_DECL_IMPORT int NetworkProcessMainQt(int argc, char** argv);
+}
+
+int main(int argc, char** argv)
+{
+ return WebKit::NetworkProcessMainQt(argc, argv);
+}
diff --git a/Source/WebKit2/NetworkProcess/NetworkProcess.cpp b/Source/WebKit2/NetworkProcess/NetworkProcess.cpp
index 15ee4a8f5..75ce5d4a2 100644
--- a/Source/WebKit2/NetworkProcess/NetworkProcess.cpp
+++ b/Source/WebKit2/NetworkProcess/NetworkProcess.cpp
@@ -451,6 +451,13 @@ void NetworkProcess::cancelDownload(DownloadID downloadID)
{
downloadManager().cancelDownload(downloadID);
}
+
+#if PLATFORM(QT)
+void NetworkProcess::startTransfer(DownloadID downloadID, const String& destination)
+{
+ downloadManager().startTransfer(downloadID, destination);
+}
+#endif
#if USE(NETWORK_SESSION)
void NetworkProcess::continueCanAuthenticateAgainstProtectionSpace(DownloadID downloadID, bool canAuthenticate)
diff --git a/Source/WebKit2/NetworkProcess/NetworkProcess.h b/Source/WebKit2/NetworkProcess/NetworkProcess.h
index e43a91fe9..4b573b9b5 100644
--- a/Source/WebKit2/NetworkProcess/NetworkProcess.h
+++ b/Source/WebKit2/NetworkProcess/NetworkProcess.h
@@ -41,6 +41,10 @@
#include "WebSQLiteDatabaseTracker.h"
#endif
+#if PLATFORM(QT)
+#include "QtNetworkAccessManager.h"
+#endif
+
namespace WebCore {
class CertificateInfo;
class NetworkStorageSession;
@@ -99,6 +103,10 @@ public:
void clearHSTSCache(WebCore::NetworkStorageSession&, std::chrono::system_clock::time_point modifiedSince);
#endif
+#if PLATFORM(QT)
+ QNetworkAccessManager& networkAccessManager() { return m_networkAccessManager; }
+#endif
+
void prefetchDNS(const String&);
private:
@@ -154,6 +162,9 @@ private:
void downloadRequest(WebCore::SessionID, DownloadID, const WebCore::ResourceRequest&);
void resumeDownload(WebCore::SessionID, DownloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle&);
void cancelDownload(DownloadID);
+#if PLATFORM(QT)
+ void startTransfer(DownloadID, const String& destination);
+#endif
#if USE(NETWORK_SESSION)
void continueCanAuthenticateAgainstProtectionSpace(DownloadID, bool canAuthenticate);
void continueWillSendRequest(DownloadID, const WebCore::ResourceRequest&);
@@ -197,6 +208,10 @@ private:
#if PLATFORM(IOS)
WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;
#endif
+
+#if PLATFORM(QT)
+ QtNetworkAccessManager m_networkAccessManager;
+#endif
};
} // namespace WebKit
diff --git a/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in b/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in
index 315a54721..3c6f89337 100644
--- a/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in
+++ b/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in
@@ -44,6 +44,9 @@ messages -> NetworkProcess LegacyReceiver {
DownloadRequest(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, WebCore::ResourceRequest request)
ResumeDownload(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, IPC::DataReference resumeData, String path, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
CancelDownload(WebKit::DownloadID downloadID)
+#if PLATFORM(QT)
+ StartTransfer(WebKit::DownloadID downloadID, String destination)
+#endif
#if USE(NETWORK_SESSION)
ContinueCanAuthenticateAgainstProtectionSpace(WebKit::DownloadID downloadID, bool canAuthenticate)
ContinueWillSendRequest(WebKit::DownloadID downloadID, WebCore::ResourceRequest request)
diff --git a/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp b/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp
index 751fbb11c..da6fb1902 100644
--- a/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp
+++ b/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp
@@ -77,7 +77,7 @@ void NetworkProcessCreationParameters::encode(IPC::ArgumentEncoder& encoder) con
IPC::encode(encoder, networkATSContext.get());
#endif
#endif
-#if USE(SOUP)
+#if USE(SOUP) || PLATFORM(QT)
encoder << cookiePersistentStoragePath;
encoder << cookiePersistentStorageType;
encoder.encodeEnum(cookieAcceptPolicy);
@@ -149,7 +149,7 @@ bool NetworkProcessCreationParameters::decode(IPC::ArgumentDecoder& decoder, Net
#endif
#endif
-#if USE(SOUP)
+#if USE(SOUP) || PLATFORM(QT)
if (!decoder.decode(result.cookiePersistentStoragePath))
return false;
if (!decoder.decode(result.cookiePersistentStorageType))
diff --git a/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h b/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h
index a605d0ed3..dfd188a47 100644
--- a/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h
+++ b/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h
@@ -31,7 +31,7 @@
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
-#if USE(SOUP)
+#if USE(SOUP) || PLATFORM(QT)
#include "HTTPCookieAcceptPolicy.h"
#endif
@@ -90,7 +90,7 @@ struct NetworkProcessCreationParameters {
#endif
#endif
-#if USE(SOUP)
+#if USE(SOUP) || PLATFORM(QT)
String cookiePersistentStoragePath;
uint32_t cookiePersistentStorageType;
HTTPCookieAcceptPolicy cookieAcceptPolicy;
diff --git a/Source/WebKit2/NetworkProcess/RemoteNetworkingContext.h b/Source/WebKit2/NetworkProcess/RemoteNetworkingContext.h
index 327f2c308..e44a5d078 100644
--- a/Source/WebKit2/NetworkProcess/RemoteNetworkingContext.h
+++ b/Source/WebKit2/NetworkProcess/RemoteNetworkingContext.h
@@ -69,6 +69,13 @@ private:
#if PLATFORM(COCOA)
bool m_localFileContentSniffingEnabled = false;
#endif
+
+#if PLATFORM(QT)
+ QObject* originatingObject() const override { return nullptr; }
+ QNetworkAccessManager* networkAccessManager() const override;
+ bool mimeSniffingEnabled() const override { return true; }
+ bool thirdPartyCookiePolicyPermission(const QUrl&) const override { return true; }
+#endif
};
}
diff --git a/Source/WebKit2/NetworkProcess/qt/NetworkProcessMainQt.cpp b/Source/WebKit2/NetworkProcess/qt/NetworkProcessMainQt.cpp
new file mode 100644
index 000000000..d3799bb24
--- /dev/null
+++ b/Source/WebKit2/NetworkProcess/qt/NetworkProcessMainQt.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2016 Konstantin Tokarev <annulen@yandex.ru>
+ * Copyright (C) 2014 Igalia S.L.
+ * Copyright (C) 2013 Company 100 Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkProcess.h"
+
+#include "ChildProcessMain.h"
+
+#include <QCoreApplication>
+#include <QNetworkProxyFactory>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+class EnvHttpProxyFactory : public QNetworkProxyFactory {
+public:
+ EnvHttpProxyFactory() { }
+
+ bool initializeFromEnvironment();
+
+ QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery& = QNetworkProxyQuery());
+
+private:
+ QList<QNetworkProxy> m_httpProxy;
+ QList<QNetworkProxy> m_httpsProxy;
+};
+
+bool EnvHttpProxyFactory::initializeFromEnvironment()
+{
+ bool wasSetByEnvironment = false;
+
+ QUrl proxyUrl = QUrl::fromUserInput(QString::fromLocal8Bit(qgetenv("http_proxy")));
+ if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) {
+ int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080;
+ m_httpProxy << QNetworkProxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyPort);
+ wasSetByEnvironment = true;
+ } else
+ m_httpProxy << QNetworkProxy::NoProxy;
+
+ proxyUrl = QUrl::fromUserInput(QString::fromLocal8Bit(qgetenv("https_proxy")));
+ if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) {
+ int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080;
+ m_httpsProxy << QNetworkProxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyPort);
+ wasSetByEnvironment = true;
+ } else
+ m_httpsProxy << QNetworkProxy::NoProxy;
+
+ return wasSetByEnvironment;
+}
+
+QList<QNetworkProxy> EnvHttpProxyFactory::queryProxy(const QNetworkProxyQuery& query)
+{
+ QString protocol = query.protocolTag().toLower();
+ bool localHost = false;
+
+ if (!query.peerHostName().compare(QLatin1String("localhost"), Qt::CaseInsensitive) || !query.peerHostName().compare(QLatin1String("127.0.0.1"), Qt::CaseInsensitive))
+ localHost = true;
+ if (protocol == QLatin1String("http") && !localHost)
+ return m_httpProxy;
+ if (protocol == QLatin1String("https") && !localHost)
+ return m_httpsProxy;
+
+ QList<QNetworkProxy> proxies;
+ proxies << QNetworkProxy::NoProxy;
+ return proxies;
+}
+
+static void initializeProxy()
+{
+ QList<QNetworkProxy> proxylist = QNetworkProxyFactory::systemProxyForQuery();
+ if (proxylist.count() == 1) {
+ QNetworkProxy proxy = proxylist.first();
+ if (proxy == QNetworkProxy::NoProxy || proxy == QNetworkProxy::DefaultProxy) {
+ auto proxyFactory = std::make_unique<EnvHttpProxyFactory>();
+ if (proxyFactory->initializeFromEnvironment()) {
+ QNetworkProxyFactory::setApplicationProxyFactory(proxyFactory.release());
+ return;
+ }
+ }
+ }
+ QNetworkProxyFactory::setUseSystemConfiguration(true);
+}
+
+class NetworkProcessMain final: public ChildProcessMainBase {
+public:
+
+ bool platformInitialize() final
+ {
+ initializeProxy();
+ return true;
+ }
+};
+
+Q_DECL_EXPORT int NetworkProcessMainQt(int argc, char** argv)
+{
+ QCoreApplication app(argc, argv);
+ return ChildProcessMain<NetworkProcess, ChildProcessMainBase>(argc, argv);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/NetworkProcess/qt/NetworkProcessQt.cpp b/Source/WebKit2/NetworkProcess/qt/NetworkProcessQt.cpp
new file mode 100644
index 000000000..f822b3d20
--- /dev/null
+++ b/Source/WebKit2/NetworkProcess/qt/NetworkProcessQt.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2016 Konstantin Tokarev <annulen@yandex.ru>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkProcess.h"
+
+#include "NetworkProcessCreationParameters.h"
+#include "QtNetworkAccessManager.h"
+
+#include <QNetworkDiskCache>
+#include <WebCore/CertificateInfo.h>
+#include <WebCore/CookieJarQt.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreationParameters& parameters)
+{
+ if (!parameters.cookiePersistentStoragePath.isEmpty()) {
+ WebCore::SharedCookieJarQt* jar = WebCore::SharedCookieJarQt::create(parameters.cookiePersistentStoragePath);
+ m_networkAccessManager.setCookieJar(jar);
+ // Do not let QNetworkAccessManager delete the jar.
+ jar->setParent(0);
+ }
+
+ if (!parameters.diskCacheDirectory.isEmpty()) {
+ QNetworkDiskCache* diskCache = new QNetworkDiskCache();
+ diskCache->setCacheDirectory(parameters.diskCacheDirectory);
+ // The m_networkAccessManager takes ownership of the diskCache object upon the following call.
+ m_networkAccessManager.setCache(diskCache);
+ }
+}
+
+void NetworkProcess::platformTerminate()
+{
+}
+
+void NetworkProcess::allowSpecificHTTPSCertificateForHost(const CertificateInfo&, const String&)
+{
+}
+
+void NetworkProcess::clearCacheForAllOrigins(uint32_t)
+{
+}
+
+void NetworkProcess::clearDiskCache(std::chrono::system_clock::time_point, std::function<void()>)
+{
+}
+
+void NetworkProcess::platformSetCacheModel(CacheModel)
+{
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/NetworkProcess/qt/QtNetworkAccessManager.cpp b/Source/WebKit2/NetworkProcess/qt/QtNetworkAccessManager.cpp
new file mode 100644
index 000000000..5e38a7717
--- /dev/null
+++ b/Source/WebKit2/NetworkProcess/qt/QtNetworkAccessManager.cpp
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2011 Zeno Albisser <zeno@webkit.org>
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "QtNetworkAccessManager.h"
+
+#include "WebPage.h"
+#include "WebPageProxyMessages.h"
+#include "WebProcess.h"
+#include <QAuthenticator>
+#include <QNetworkProxy>
+#include <QNetworkReply>
+#include <QNetworkRequest>
+
+namespace WebKit {
+
+QtNetworkAccessManager::QtNetworkAccessManager()
+ : QNetworkAccessManager()
+{
+ connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), SLOT(onAuthenticationRequired(QNetworkReply*, QAuthenticator*)));
+ connect(this, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)), SLOT(onProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)));
+#ifndef QT_NO_SSL
+ connect(this, SIGNAL(sslErrors(QNetworkReply*, QList<QSslError>)), SLOT(onSslErrors(QNetworkReply*, QList<QSslError>)));
+#endif
+}
+
+WebPage* QtNetworkAccessManager::obtainOriginatingWebPage(const QNetworkRequest& request)
+{
+ // QTFIXME: Old process model
+ if (!m_webProcess)
+ return nullptr;
+
+ QObject* originatingObject = request.originatingObject();
+ if (!originatingObject)
+ return 0;
+
+ qulonglong pageID = originatingObject->property("pageID").toULongLong();
+ return m_webProcess->webPage(pageID);
+}
+
+void QtNetworkAccessManager::onProxyAuthenticationRequired(const QNetworkProxy& proxy, QAuthenticator* authenticator)
+{
+ // FIXME: Check if there is a better way to get a reference to the page.
+ WebPage* webPage = m_webProcess->focusedWebPage();
+
+ if (!webPage)
+ return;
+
+ String hostname = proxy.hostName();
+ uint16_t port = static_cast<uint16_t>(proxy.port());
+ String prefilledUsername = authenticator->user();
+ String username;
+ String password;
+
+ if (webPage->sendSync(
+ Messages::WebPageProxy::ProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername),
+ Messages::WebPageProxy::ProxyAuthenticationRequiredRequest::Reply(username, password))) {
+ if (!username.isEmpty())
+ authenticator->setUser(username);
+ if (!password.isEmpty())
+ authenticator->setPassword(password);
+ }
+
+}
+
+void QtNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator)
+{
+ WebPage* webPage = obtainOriginatingWebPage(reply->request());
+
+ // FIXME: This check can go away once our Qt version is up-to-date. See: QTBUG-23512.
+ if (!webPage)
+ return;
+
+ String hostname = reply->url().toString(QUrl::RemovePath | QUrl::RemoveQuery | QUrl::RemoveFragment | QUrl::StripTrailingSlash);
+ String realm = authenticator->realm();
+ String prefilledUsername = authenticator->user();
+ String username;
+ String password;
+
+ if (webPage->sendSync(
+ Messages::WebPageProxy::AuthenticationRequiredRequest(hostname, realm, prefilledUsername),
+ Messages::WebPageProxy::AuthenticationRequiredRequest::Reply(username, password))) {
+ if (!username.isEmpty())
+ authenticator->setUser(username);
+ if (!password.isEmpty())
+ authenticator->setPassword(password);
+ }
+}
+
+void QtNetworkAccessManager::onSslErrors(QNetworkReply* reply, const QList<QSslError>& qSslErrors)
+{
+#ifndef QT_NO_SSL
+ WebPage* webPage = obtainOriginatingWebPage(reply->request());
+
+ // FIXME: This check can go away once our Qt version is up-to-date. See: QTBUG-23512.
+ if (!webPage)
+ return;
+
+ String hostname = reply->url().host();
+ bool ignoreErrors = false;
+
+ if (webPage->sendSync(
+ Messages::WebPageProxy::CertificateVerificationRequest(hostname),
+ Messages::WebPageProxy::CertificateVerificationRequest::Reply(ignoreErrors))) {
+ if (ignoreErrors)
+ reply->ignoreSslErrors(qSslErrors);
+ }
+#endif
+}
+
+}
+
+#include "moc_QtNetworkAccessManager.cpp"
diff --git a/Source/WebKit2/NetworkProcess/qt/QtNetworkAccessManager.h b/Source/WebKit2/NetworkProcess/qt/QtNetworkAccessManager.h
new file mode 100644
index 000000000..5b958f13e
--- /dev/null
+++ b/Source/WebKit2/NetworkProcess/qt/QtNetworkAccessManager.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 Zeno Albisser <zeno@webkit.org>
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef QtNetworkAccessManager_h
+#define QtNetworkAccessManager_h
+
+#include <QMultiHash>
+#include <QNetworkAccessManager>
+#include <QNetworkProxy>
+#include <QString>
+
+namespace WebKit {
+
+class WebPage;
+class WebProcess;
+
+class QtNetworkAccessManager : public QNetworkAccessManager {
+ Q_OBJECT
+public:
+ QtNetworkAccessManager();
+
+private Q_SLOTS:
+ void onAuthenticationRequired(QNetworkReply *, QAuthenticator *);
+ void onProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator *);
+ void onSslErrors(QNetworkReply*, const QList<QSslError>&);
+
+private:
+ WebPage* obtainOriginatingWebPage(const QNetworkRequest&);
+
+ WebProcess* m_webProcess { nullptr };
+};
+
+} // namespace WebKit
+
+#endif // QtNetworkAccessManager_h
diff --git a/Source/WebKit2/NetworkProcess/qt/RemoteNetworkingContextQt.cpp b/Source/WebKit2/NetworkProcess/qt/RemoteNetworkingContextQt.cpp
new file mode 100644
index 000000000..96da15886
--- /dev/null
+++ b/Source/WebKit2/NetworkProcess/qt/RemoteNetworkingContextQt.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 University of Szeged. All rights reserved.
+ * Copyright (C) 2013 Company 100 Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RemoteNetworkingContext.h"
+
+#include "NetworkProcess.h"
+#include <WebCore/NetworkStorageSession.h>
+#include <WebCore/NotImplemented.h>
+#include <WebCore/ResourceHandle.h>
+#include <wtf/NeverDestroyed.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+RemoteNetworkingContext::~RemoteNetworkingContext()
+{
+}
+
+bool RemoteNetworkingContext::isValid() const
+{
+ return true;
+}
+
+void RemoteNetworkingContext::ensurePrivateBrowsingSession(SessionID)
+{
+ notImplemented();
+}
+
+NetworkStorageSession& RemoteNetworkingContext::storageSession() const
+{
+ return NetworkStorageSession::defaultStorageSession();
+}
+
+QNetworkAccessManager* RemoteNetworkingContext::networkAccessManager() const
+{
+ return &NetworkProcess::singleton().networkAccessManager();
+}
+
+}