diff options
Diffstat (limited to 'Source/WebKit2/Shared/Network')
10 files changed, 0 insertions, 1029 deletions
diff --git a/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h b/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h deleted file mode 100644 index fda8107e1..000000000 --- a/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. - * - * 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 CustomProtocolManager_h -#define CustomProtocolManager_h - -#if ENABLE(CUSTOM_PROTOCOLS) - -#include "Connection.h" -#include "NetworkProcessSupplement.h" -#include "WebProcessSupplement.h" -#include "WorkQueue.h" -#include <wtf/text/WTFString.h> - -#if PLATFORM(MAC) -#include <wtf/HashMap.h> -#include <wtf/HashSet.h> -#include <wtf/RetainPtr.h> -#include <wtf/Threading.h> -OBJC_CLASS WKCustomProtocol; -#endif - - -namespace IPC { -class DataReference; -} // namespace IPC - -namespace WebCore { -class ResourceError; -class ResourceResponse; -} // namespace WebCore - -namespace WebKit { - -class ChildProcess; -class CustomProtocolManagerImpl; -struct NetworkProcessCreationParameters; - -class CustomProtocolManager : public WebProcessSupplement, public NetworkProcessSupplement, public IPC::Connection::WorkQueueMessageReceiver { - WTF_MAKE_NONCOPYABLE(CustomProtocolManager); -public: - explicit CustomProtocolManager(ChildProcess*); - - static const char* supplementName(); - - ChildProcess* childProcess() const { return m_childProcess; } - - void registerScheme(const String&); - void unregisterScheme(const String&); - bool supportsScheme(const String&); - -#if PLATFORM(MAC) - void addCustomProtocol(WKCustomProtocol *); - void removeCustomProtocol(WKCustomProtocol *); -#endif - -private: - // ChildProcessSupplement - void initializeConnection(IPC::Connection*) override; - - // WebProcessSupplement - void initialize(const WebProcessCreationParameters&) override; - -#if ENABLE(NETWORK_PROCESS) - // NetworkProcessSupplement - void initialize(const NetworkProcessCreationParameters&) override; -#endif - - // IPC::MessageReceiver - virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override; - - void didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&); - void didLoadData(uint64_t customProtocolID, const IPC::DataReference&); - void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&, uint32_t cacheStoragePolicy); - void didFinishLoading(uint64_t customProtocolID); - - ChildProcess* m_childProcess; - RefPtr<WorkQueue> m_messageQueue; - -#if PLATFORM(MAC) - HashSet<String> m_registeredSchemes; - Mutex m_registeredSchemesMutex; - - typedef HashMap<uint64_t, RetainPtr<WKCustomProtocol>> CustomProtocolMap; - CustomProtocolMap m_customProtocolMap; - Mutex m_customProtocolMapMutex; - - // WKCustomProtocol objects can be removed from the m_customProtocolMap from multiple threads. - // We return a RetainPtr here because it is unsafe to return a raw pointer since the object might immediately be destroyed from a different thread. - RetainPtr<WKCustomProtocol> protocolForID(uint64_t customProtocolID); -#else - // FIXME: Move mac specific code to CustomProtocolManagerImpl. - std::unique_ptr<CustomProtocolManagerImpl> m_impl; -#endif -}; - -} // namespace WebKit - -#endif // ENABLE(CUSTOM_PROTOCOLS) - -#endif // CustomProtocolManager_h diff --git a/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.messages.in b/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.messages.in deleted file mode 100644 index 2376d929d..000000000 --- a/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.messages.in +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (C) 2012 Apple Inc. All rights reserved. -# -# 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. - -#if ENABLE(CUSTOM_PROTOCOLS) - -messages -> CustomProtocolManager { - DidFailWithError(uint64_t customProtocolID, WebCore::ResourceError error) - DidLoadData(uint64_t customProtocolID, IPC::DataReference data) - DidReceiveResponse(uint64_t customProtocolID, WebCore::ResourceResponse response, uint32_t cacheStoragePolicy) - DidFinishLoading(uint64_t customProtocolID) - - RegisterScheme(String name) - UnregisterScheme(String name) -} - -#endif // ENABLE(CUSTOM_PROTOCOLS) diff --git a/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp b/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp deleted file mode 100644 index 98c55e1ba..000000000 --- a/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (C) 2014 Igalia S.L. - * - * 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 "CustomProtocolManagerImpl.h" - -#if ENABLE(CUSTOM_PROTOCOLS) - -#include "ChildProcess.h" -#include "CustomProtocolManagerProxyMessages.h" -#include "DataReference.h" -#include "WebCoreArgumentCoders.h" -#include "WebKitSoupRequestGeneric.h" -#include "WebKitSoupRequestInputStream.h" -#include <WebCore/ResourceError.h> -#include <WebCore/ResourceRequest.h> -#include <WebCore/ResourceResponse.h> -#include <WebCore/SoupNetworkSession.h> - -namespace WebKit { - -static uint64_t generateCustomProtocolID() -{ - static uint64_t uniqueCustomProtocolID = 0; - return ++uniqueCustomProtocolID; -} - -struct WebSoupRequestAsyncData { - WebSoupRequestAsyncData(GTask* task, WebKitSoupRequestGeneric* requestGeneric) - : task(task) - , request(requestGeneric) - , cancellable(g_task_get_cancellable(task)) - { - // If the struct contains a null request, it is because the request failed. - g_object_add_weak_pointer(G_OBJECT(request), reinterpret_cast<void**>(&request)); - } - - ~WebSoupRequestAsyncData() - { - if (request) - g_object_remove_weak_pointer(G_OBJECT(request), reinterpret_cast<void**>(&request)); - } - - bool requestFailed() - { - return g_cancellable_is_cancelled(cancellable.get()) || !request; - } - - GRefPtr<GTask> releaseTask() - { - GTask* returnValue = task; - task = nullptr; - return adoptGRef(returnValue); - } - - GTask* task; - WebKitSoupRequestGeneric* request; - GRefPtr<GCancellable> cancellable; - GRefPtr<GInputStream> stream; -}; - -CustomProtocolManagerImpl::CustomProtocolManagerImpl(ChildProcess* childProcess) - : m_childProcess(childProcess) - , m_schemes(adoptGRef(g_ptr_array_new_with_free_func(g_free))) -{ -} - -CustomProtocolManagerImpl::~CustomProtocolManagerImpl() -{ -} - -void CustomProtocolManagerImpl::registerScheme(const String& scheme) -{ - if (m_schemes->len) - g_ptr_array_remove_index_fast(m_schemes.get(), m_schemes->len - 1); - g_ptr_array_add(m_schemes.get(), g_strdup(scheme.utf8().data())); - g_ptr_array_add(m_schemes.get(), nullptr); - - SoupSession* session = WebCore::SoupNetworkSession::defaultSession().soupSession(); - SoupRequestClass* genericRequestClass = static_cast<SoupRequestClass*>(g_type_class_ref(WEBKIT_TYPE_SOUP_REQUEST_GENERIC)); - genericRequestClass->schemes = const_cast<const char**>(reinterpret_cast<char**>(m_schemes->pdata)); - static_cast<WebKitSoupRequestGenericClass*>(g_type_class_ref(WEBKIT_TYPE_SOUP_REQUEST_GENERIC))->customProtocolManager = this; - soup_session_add_feature_by_type(session, WEBKIT_TYPE_SOUP_REQUEST_GENERIC); -} - -bool CustomProtocolManagerImpl::supportsScheme(const String& scheme) -{ - if (scheme.isNull()) - return false; - - CString cScheme = scheme.utf8(); - for (unsigned i = 0; i < m_schemes->len; ++i) { - if (cScheme == static_cast<char*>(g_ptr_array_index(m_schemes.get(), i))) - return true; - } - - return false; -} - -void CustomProtocolManagerImpl::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError& error) -{ - WebSoupRequestAsyncData* data = m_customProtocolMap.get(customProtocolID); - ASSERT(data); - - GRefPtr<GTask> task = data->releaseTask(); - ASSERT(task.get()); - g_task_return_new_error(task.get(), g_quark_from_string(error.domain().utf8().data()), - error.errorCode(), "%s", error.localizedDescription().utf8().data()); - - m_customProtocolMap.remove(customProtocolID); -} - -void CustomProtocolManagerImpl::didLoadData(uint64_t customProtocolID, const IPC::DataReference& dataReference) -{ - WebSoupRequestAsyncData* data = m_customProtocolMap.get(customProtocolID); - // The data might have been removed from the request map if a previous chunk failed - // and a new message was sent by the UI process before being notified about the failure. - if (!data) - return; - - if (!data->stream) { - GRefPtr<GTask> task = data->releaseTask(); - ASSERT(task.get()); - - goffset soupContentLength = soup_request_get_content_length(SOUP_REQUEST(g_task_get_source_object(task.get()))); - uint64_t contentLength = soupContentLength == -1 ? 0 : static_cast<uint64_t>(soupContentLength); - if (!dataReference.size()) { - // Empty reply, just create and empty GMemoryInputStream. - data->stream = g_memory_input_stream_new(); - } else if (dataReference.size() == contentLength) { - // We don't expect more data, so we can just create a GMemoryInputStream with all the data. - data->stream = g_memory_input_stream_new_from_data(g_memdup(dataReference.data(), dataReference.size()), contentLength, g_free); - } else { - // We expect more data chunks from the UI process. - data->stream = webkitSoupRequestInputStreamNew(contentLength); - webkitSoupRequestInputStreamAddData(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get()), dataReference.data(), dataReference.size()); - } - g_task_return_pointer(task.get(), data->stream.get(), g_object_unref); - return; - } - - if (data->requestFailed()) { - // ResourceRequest failed or it was cancelled. It doesn't matter here the error or if it was cancelled, - // because that's already handled by the resource handle client, we just want to notify the UI process - // to stop reading data from the user input stream. If UI process already sent all the data we simply - // finish silently. - if (!webkitSoupRequestInputStreamFinished(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get()))) - m_childProcess->send(Messages::CustomProtocolManagerProxy::StopLoading(customProtocolID), 0); - - return; - } - - webkitSoupRequestInputStreamAddData(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get()), dataReference.data(), dataReference.size()); -} - -void CustomProtocolManagerImpl::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse& response) -{ - WebSoupRequestAsyncData* data = m_customProtocolMap.get(customProtocolID); - ASSERT(data); - ASSERT(data->task); - - WebKitSoupRequestGeneric* request = WEBKIT_SOUP_REQUEST_GENERIC(g_task_get_source_object(data->task)); - webkitSoupRequestGenericSetContentLength(request, response.expectedContentLength() ? response.expectedContentLength() : -1); - webkitSoupRequestGenericSetContentType(request, !response.mimeType().isEmpty() ? response.mimeType().utf8().data() : 0); -} - -void CustomProtocolManagerImpl::didFinishLoading(uint64_t customProtocolID) -{ - ASSERT(m_customProtocolMap.contains(customProtocolID)); - m_customProtocolMap.remove(customProtocolID); -} - -void CustomProtocolManagerImpl::send(GTask* task) -{ - uint64_t customProtocolID = generateCustomProtocolID(); - WebKitSoupRequestGeneric* request = WEBKIT_SOUP_REQUEST_GENERIC(g_task_get_source_object(task)); - m_customProtocolMap.set(customProtocolID, std::make_unique<WebSoupRequestAsyncData>(task, request)); - - WebCore::ResourceRequest resourceRequest(SOUP_REQUEST(request)); - m_childProcess->send(Messages::CustomProtocolManagerProxy::StartLoading(customProtocolID, resourceRequest), 0); -} - -GInputStream* CustomProtocolManagerImpl::finish(GTask* task, GError** error) -{ - gpointer inputStream = g_task_propagate_pointer(task, error); - return inputStream ? G_INPUT_STREAM(inputStream) : 0; -} - -} // namespace WebKit - -#endif // ENABLE(CUSTOM_PROTOCOLS) diff --git a/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h b/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h deleted file mode 100644 index 1d44241d6..000000000 --- a/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2014 Igalia S.L. - * - * 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. - */ - -#ifndef CustomProtocolManagerImpl_h -#define CustomProtocolManagerImpl_h - -#if ENABLE(CUSTOM_PROTOCOLS) - -#include <wtf/HashMap.h> -#include <wtf/gobject/GRefPtr.h> -#include <wtf/text/WTFString.h> - -typedef struct _GTask GTask; -typedef struct _GInputStream GInputStream; - -namespace IPC { -class DataReference; -} // namespace IPC - -namespace WebCore { -class ResourceError; -class ResourceResponse; -} // namespace WebCore - -namespace WebKit { - -class ChildProcess; -struct WebSoupRequestAsyncData; - -class CustomProtocolManagerImpl { - WTF_MAKE_NONCOPYABLE(CustomProtocolManagerImpl); -public: - explicit CustomProtocolManagerImpl(ChildProcess*); - ~CustomProtocolManagerImpl(); - - void registerScheme(const String&); - bool supportsScheme(const String&); - - void didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&); - void didLoadData(uint64_t customProtocolID, const IPC::DataReference&); - void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&); - void didFinishLoading(uint64_t customProtocolID); - - // SoupRequest implementation. - void send(GTask*); - GInputStream* finish(GTask*, GError**); - -private: - ChildProcess* m_childProcess; - GRefPtr<GPtrArray> m_schemes; - HashMap<uint64_t, std::unique_ptr<WebSoupRequestAsyncData>> m_customProtocolMap; -}; - -} // namespace WebKit - -#endif // ENABLE(CUSTOM_PROTOCOLS) - -#endif // CustomProtocolManagerImpl_h diff --git a/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp b/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp deleted file mode 100644 index 6b71ac06f..000000000 --- a/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Igalia S.L. - * - * 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" - -#if ENABLE(CUSTOM_PROTOCOLS) - -#include "ChildProcess.h" -#include "CustomProtocolManagerImpl.h" -#include "CustomProtocolManagerMessages.h" -#include "WebProcessCreationParameters.h" -#include <WebCore/NotImplemented.h> - -#if ENABLE(NETWORK_PROCESS) -#include "NetworkProcessCreationParameters.h" -#endif - -namespace WebKit { - -const char* CustomProtocolManager::supplementName() -{ - return "CustomProtocolManager"; -} - -CustomProtocolManager::CustomProtocolManager(ChildProcess* childProcess) - : m_childProcess(childProcess) - , m_messageQueue(WorkQueue::create("com.apple.WebKit.CustomProtocolManager")) - , m_impl(std::make_unique<CustomProtocolManagerImpl>(childProcess)) -{ -} - -void CustomProtocolManager::initializeConnection(IPC::Connection* connection) -{ - connection->addWorkQueueMessageReceiver(Messages::CustomProtocolManager::messageReceiverName(), m_messageQueue.get(), this); -} - -void CustomProtocolManager::initialize(const WebProcessCreationParameters& parameters) -{ -#if ENABLE(NETWORK_PROCESS) - ASSERT(parameters.urlSchemesRegisteredForCustomProtocols.isEmpty() || !parameters.usesNetworkProcess); - if (parameters.usesNetworkProcess) { - m_childProcess->parentProcessConnection()->removeWorkQueueMessageReceiver(Messages::CustomProtocolManager::messageReceiverName()); - m_messageQueue = nullptr; - return; - } -#endif - for (size_t i = 0; i < parameters.urlSchemesRegisteredForCustomProtocols.size(); ++i) - registerScheme(parameters.urlSchemesRegisteredForCustomProtocols[i]); -} - -#if ENABLE(NETWORK_PROCESS) -void CustomProtocolManager::initialize(const NetworkProcessCreationParameters& parameters) -{ - for (size_t i = 0; i < parameters.urlSchemesRegisteredForCustomProtocols.size(); ++i) - registerScheme(parameters.urlSchemesRegisteredForCustomProtocols[i]); -} -#endif - -void CustomProtocolManager::registerScheme(const String& scheme) -{ - m_impl->registerScheme(scheme); -} - -void CustomProtocolManager::unregisterScheme(const String&) -{ - notImplemented(); -} - -bool CustomProtocolManager::supportsScheme(const String& scheme) -{ - return m_impl->supportsScheme(scheme); -} - -void CustomProtocolManager::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError& error) -{ - m_impl->didFailWithError(customProtocolID, error); -} - -void CustomProtocolManager::didLoadData(uint64_t customProtocolID, const IPC::DataReference& dataReference) -{ - m_impl->didLoadData(customProtocolID, dataReference); -} - -void CustomProtocolManager::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse& response, uint32_t) -{ - m_impl->didReceiveResponse(customProtocolID, response); -} - -void CustomProtocolManager::didFinishLoading(uint64_t customProtocolID) -{ - m_impl->didFinishLoading(customProtocolID); -} - -} // namespace WebKit - -#endif // ENABLE(CUSTOM_PROTOCOLS) diff --git a/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp b/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp deleted file mode 100644 index a26a5a1f5..000000000 --- a/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * 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 "NetworkProcessCreationParameters.h" - -#if ENABLE(NETWORK_PROCESS) - -#include "ArgumentCoders.h" - -namespace WebKit { - -NetworkProcessCreationParameters::NetworkProcessCreationParameters() -{ -} - -void NetworkProcessCreationParameters::encode(IPC::ArgumentEncoder& encoder) const -{ - encoder << privateBrowsingEnabled; - encoder.encodeEnum(cacheModel); - encoder << diskCacheDirectory; - encoder << diskCacheDirectoryExtensionHandle; - encoder << shouldUseTestingNetworkSession; -#if ENABLE(CUSTOM_PROTOCOLS) - encoder << urlSchemesRegisteredForCustomProtocols; -#endif -#if PLATFORM(MAC) - encoder << parentProcessName; - encoder << uiProcessBundleIdentifier; - encoder << nsURLCacheMemoryCapacity; - encoder << nsURLCacheDiskCapacity; - encoder << httpProxy; - encoder << httpsProxy; -#endif -#if USE(SOUP) - encoder << cookiePersistentStoragePath; - encoder << cookiePersistentStorageType; - encoder.encodeEnum(cookieAcceptPolicy); - encoder << ignoreTLSErrors; - encoder << languages; -#endif -} - -bool NetworkProcessCreationParameters::decode(IPC::ArgumentDecoder& decoder, NetworkProcessCreationParameters& result) -{ - if (!decoder.decode(result.privateBrowsingEnabled)) - return false; - if (!decoder.decodeEnum(result.cacheModel)) - return false; - if (!decoder.decode(result.diskCacheDirectory)) - return false; - if (!decoder.decode(result.diskCacheDirectoryExtensionHandle)) - return false; - if (!decoder.decode(result.shouldUseTestingNetworkSession)) - return false; -#if ENABLE(CUSTOM_PROTOCOLS) - if (!decoder.decode(result.urlSchemesRegisteredForCustomProtocols)) - return false; -#endif -#if PLATFORM(MAC) - if (!decoder.decode(result.parentProcessName)) - return false; - if (!decoder.decode(result.uiProcessBundleIdentifier)) - return false; - if (!decoder.decode(result.nsURLCacheMemoryCapacity)) - return false; - if (!decoder.decode(result.nsURLCacheDiskCapacity)) - return false; - if (!decoder.decode(result.httpProxy)) - return false; - if (!decoder.decode(result.httpsProxy)) - return false; -#endif - -#if USE(SOUP) - if (!decoder.decode(result.cookiePersistentStoragePath)) - return false; - if (!decoder.decode(result.cookiePersistentStorageType)) - return false; - if (!decoder.decodeEnum(result.cookieAcceptPolicy)) - return false; - if (!decoder.decode(result.ignoreTLSErrors)) - return false; - if (!decoder.decode(result.languages)) - return false; -#endif - - return true; -} - -} // namespace WebKit - -#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h b/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h deleted file mode 100644 index 1ba8d8ec4..000000000 --- a/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * 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 NetworkProcessCreationParameters_h -#define NetworkProcessCreationParameters_h - -#if ENABLE(NETWORK_PROCESS) - -#include "CacheModel.h" -#include "SandboxExtension.h" -#include <wtf/Vector.h> -#include <wtf/text/WTFString.h> - -#if USE(SOUP) -#include "HTTPCookieAcceptPolicy.h" -#endif - -namespace IPC { - class ArgumentDecoder; - class ArgumentEncoder; -} - -namespace WebKit { - -struct NetworkProcessCreationParameters { - NetworkProcessCreationParameters(); - - void encode(IPC::ArgumentEncoder&) const; - static bool decode(IPC::ArgumentDecoder&, NetworkProcessCreationParameters&); - - bool privateBrowsingEnabled; - CacheModel cacheModel; - - String diskCacheDirectory; - SandboxExtension::Handle diskCacheDirectoryExtensionHandle; - - bool shouldUseTestingNetworkSession; - -#if ENABLE(CUSTOM_PROTOCOLS) - Vector<String> urlSchemesRegisteredForCustomProtocols; -#endif - -#if PLATFORM(MAC) - String parentProcessName; - String uiProcessBundleIdentifier; - uint64_t nsURLCacheMemoryCapacity; - uint64_t nsURLCacheDiskCapacity; - - String httpProxy; - String httpsProxy; -#endif - -#if USE(SOUP) - String cookiePersistentStoragePath; - uint32_t cookiePersistentStorageType; - HTTPCookieAcceptPolicy cookieAcceptPolicy; - bool ignoreTLSErrors; - Vector<String> languages; -#endif -}; - -} // namespace WebKit - -#endif // ENABLE(NETWORK_PROCESS) - -#endif // NetworkProcessCreationParameters_h diff --git a/Source/WebKit2/Shared/Network/NetworkProcessSupplement.h b/Source/WebKit2/Shared/Network/NetworkProcessSupplement.h deleted file mode 100644 index d6fbe5bfd..000000000 --- a/Source/WebKit2/Shared/Network/NetworkProcessSupplement.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * 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 NetworkProcessSupplement_h -#define NetworkProcessSupplement_h - -#include "ChildProcessSupplement.h" - -namespace WebKit { - -struct NetworkProcessCreationParameters; - -class NetworkProcessSupplement : public ChildProcessSupplement { -#if ENABLE(NETWORK_PROCESS) -public: - virtual void initialize(const NetworkProcessCreationParameters&) - { - } -#endif -}; - -} // namespace WebKit - -#endif // NetworkProcessSupplement_h diff --git a/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp b/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp deleted file mode 100644 index 54cabf40f..000000000 --- a/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * 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 "NetworkResourceLoadParameters.h" - -#include "ArgumentCoders.h" -#include "DataReference.h" -#include "DecoderAdapter.h" -#include "EncoderAdapter.h" -#include "WebCoreArgumentCoders.h" - -#if ENABLE(NETWORK_PROCESS) - -using namespace WebCore; - -namespace WebKit { -NetworkResourceLoadParameters::NetworkResourceLoadParameters() - : identifier(0) - , webPageID(0) - , webFrameID(0) - , sessionID(0) - , priority(ResourceLoadPriorityVeryLow) - , contentSniffingPolicy(SniffContent) - , allowStoredCredentials(DoNotAllowStoredCredentials) - , clientCredentialPolicy(DoNotAskClientForAnyCredentials) - , shouldClearReferrerOnHTTPSToHTTPRedirect(true) - , isMainResource(false) -{ -} - -void NetworkResourceLoadParameters::encode(IPC::ArgumentEncoder& encoder) const -{ - encoder << identifier; - encoder << webPageID; - encoder << webFrameID; - encoder << sessionID; - encoder << request; - - encoder << static_cast<bool>(request.httpBody()); - if (request.httpBody()) { - EncoderAdapter httpBodyEncoderAdapter; - request.httpBody()->encode(httpBodyEncoderAdapter); - encoder << httpBodyEncoderAdapter.dataReference(); - - const Vector<FormDataElement>& elements = request.httpBody()->elements(); - size_t fileCount = 0; - for (size_t i = 0, count = elements.size(); i < count; ++i) { - if (elements[i].m_type == FormDataElement::encodedFile) - ++fileCount; - } - - SandboxExtension::HandleArray requestBodySandboxExtensions; - requestBodySandboxExtensions.allocate(fileCount); - size_t extensionIndex = 0; - for (size_t i = 0, count = elements.size(); i < count; ++i) { - const FormDataElement& element = elements[i]; - if (element.m_type == FormDataElement::encodedFile) { - const String& path = element.m_shouldGenerateFile ? element.m_generatedFilename : element.m_filename; - SandboxExtension::createHandle(path, SandboxExtension::ReadOnly, requestBodySandboxExtensions[extensionIndex++]); - } - } - encoder << requestBodySandboxExtensions; - } - - if (request.url().isLocalFile()) { - SandboxExtension::Handle requestSandboxExtension; - SandboxExtension::createHandle(request.url().fileSystemPath(), SandboxExtension::ReadOnly, requestSandboxExtension); - encoder << requestSandboxExtension; - } - - encoder.encodeEnum(priority); - encoder.encodeEnum(contentSniffingPolicy); - encoder.encodeEnum(allowStoredCredentials); - encoder.encodeEnum(clientCredentialPolicy); - encoder << shouldClearReferrerOnHTTPSToHTTPRedirect; - encoder << isMainResource; -} - -bool NetworkResourceLoadParameters::decode(IPC::ArgumentDecoder& decoder, NetworkResourceLoadParameters& result) -{ - if (!decoder.decode(result.identifier)) - return false; - - if (!decoder.decode(result.webPageID)) - return false; - - if (!decoder.decode(result.webFrameID)) - return false; - - if (!decoder.decode(result.sessionID)) - return false; - - if (!decoder.decode(result.request)) - return false; - - bool hasHTTPBody; - if (!decoder.decode(hasHTTPBody)) - return false; - - if (hasHTTPBody) { - IPC::DataReference formData; - if (!decoder.decode(formData)) - return false; - DecoderAdapter httpBodyDecoderAdapter(formData.data(), formData.size()); - result.request.setHTTPBody(FormData::decode(httpBodyDecoderAdapter)); - - if (!decoder.decode(result.requestBodySandboxExtensions)) - return false; - } - - if (result.request.url().isLocalFile()) { - if (!decoder.decode(result.resourceSandboxExtension)) - return false; - } - - if (!decoder.decodeEnum(result.priority)) - return false; - if (!decoder.decodeEnum(result.contentSniffingPolicy)) - return false; - if (!decoder.decodeEnum(result.allowStoredCredentials)) - return false; - if (!decoder.decodeEnum(result.clientCredentialPolicy)) - return false; - if (!decoder.decode(result.shouldClearReferrerOnHTTPSToHTTPRedirect)) - return false; - if (!decoder.decode(result.isMainResource)) - return false; - - return true; -} - -} // namespace WebKit - -#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h b/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h deleted file mode 100644 index cbf4531db..000000000 --- a/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. - * - * 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 NetworkResourceLoadParameters_h -#define NetworkResourceLoadParameters_h - -#include "SandboxExtension.h" -#include <WebCore/ResourceHandle.h> -#include <WebCore/ResourceLoaderOptions.h> -#include <WebCore/ResourceRequest.h> - -#if ENABLE(NETWORK_PROCESS) - -namespace IPC { - class ArgumentDecoder; - class ArgumentEncoder; -} - -namespace WebKit { - -typedef uint64_t ResourceLoadIdentifier; - -class NetworkResourceLoadParameters { -public: - NetworkResourceLoadParameters(); - - void encode(IPC::ArgumentEncoder&) const; - static bool decode(IPC::ArgumentDecoder&, NetworkResourceLoadParameters&); - - ResourceLoadIdentifier identifier; - uint64_t webPageID; - uint64_t webFrameID; - uint64_t sessionID; - WebCore::ResourceRequest request; - SandboxExtension::HandleArray requestBodySandboxExtensions; // Created automatically for the sender. - SandboxExtension::Handle resourceSandboxExtension; // Created automatically for the sender. - WebCore::ResourceLoadPriority priority; - WebCore::ContentSniffingPolicy contentSniffingPolicy; - WebCore::StoredCredentials allowStoredCredentials; - WebCore::ClientCredentialPolicy clientCredentialPolicy; - bool shouldClearReferrerOnHTTPSToHTTPRedirect; - bool isMainResource; -}; - -} // namespace WebKit - -#endif // ENABLE(NETWORK_PROCESS) - -#endif // NetworkResourceLoadParameters_h |