diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/soup')
4 files changed, 78 insertions, 25 deletions
diff --git a/Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp b/Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp index 08914ed81..f964e4981 100644 --- a/Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp +++ b/Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp @@ -33,7 +33,16 @@ namespace WebKit { void WebCookieManagerProxy::setCookiePersistentStorage(const String& storagePath, uint32_t storageType) { - m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebCookieManager::SetCookiePersistentStorage(storagePath, storageType)); + context()->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebCookieManager::SetCookiePersistentStorage(storagePath, storageType)); + + m_cookiePersistentStoragePath = storagePath; + m_cookiePersistentStorageType = static_cast<SoupCookiePersistentStorageType>(storageType); +} + +void WebCookieManagerProxy::getCookiePersistentStorage(String& storagePath, uint32_t& storageType) const +{ + storagePath = m_cookiePersistentStoragePath; + storageType = static_cast<uint32_t>(m_cookiePersistentStorageType); } } diff --git a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.h b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.h index e247fecd7..60b34937f 100644 --- a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.h +++ b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.h @@ -21,6 +21,7 @@ #define WebSoupRequestManagerClient_h #include "APIClient.h" +#include "WKAPICast.h" #include "WKSoupRequestManager.h" namespace WebKit { diff --git a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp index 33698cd7c..c5e6c6096 100644 --- a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 Igalia S.L. + * Copyright (C) 2013 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -27,55 +28,80 @@ namespace WebKit { +const char* WebSoupRequestManagerProxy::supplementName() +{ + return "WebSoupRequestManagerProxy"; +} + PassRefPtr<WebSoupRequestManagerProxy> WebSoupRequestManagerProxy::create(WebContext* context) { return adoptRef(new WebSoupRequestManagerProxy(context)); } WebSoupRequestManagerProxy::WebSoupRequestManagerProxy(WebContext* context) - : m_webContext(context) + : WebContextSupplement(context) , m_loadFailed(false) { - m_webContext->addMessageReceiver(Messages::WebSoupRequestManagerProxy::messageReceiverName(), this); + WebContextSupplement::context()->addMessageReceiver(Messages::WebSoupRequestManagerProxy::messageReceiverName(), this); } WebSoupRequestManagerProxy::~WebSoupRequestManagerProxy() { } -void WebSoupRequestManagerProxy::invalidate() +void WebSoupRequestManagerProxy::initializeClient(const WKSoupRequestManagerClient* client) { + m_client.initialize(client); } -void WebSoupRequestManagerProxy::initializeClient(const WKSoupRequestManagerClient* client) +// WebContextSupplement + +void WebSoupRequestManagerProxy::contextDestroyed() { - m_client.initialize(client); } -void WebSoupRequestManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) +void WebSoupRequestManagerProxy::processDidClose(WebProcessProxy*) +{ +} + +void WebSoupRequestManagerProxy::refWebContextSupplement() +{ + APIObject::ref(); +} + +void WebSoupRequestManagerProxy::derefWebContextSupplement() { - didReceiveWebSoupRequestManagerProxyMessage(connection, messageID, decoder); + APIObject::deref(); } void WebSoupRequestManagerProxy::registerURIScheme(const String& scheme) { - ASSERT(m_webContext); - m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebSoupRequestManager::RegisterURIScheme(scheme)); + if (!context()) + return; + + context()->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebSoupRequestManager::RegisterURIScheme(scheme)); + + ASSERT(!m_registeredURISchemes.contains(scheme)); + m_registeredURISchemes.append(scheme); } void WebSoupRequestManagerProxy::didHandleURIRequest(const WebData* requestData, uint64_t contentLength, const String& mimeType, uint64_t requestID) { - ASSERT(m_webContext); - m_webContext->sendToAllProcesses(Messages::WebSoupRequestManager::DidHandleURIRequest(requestData->dataReference(), contentLength, mimeType, requestID)); + if (!context()) + return; + + context()->sendToAllProcesses(Messages::WebSoupRequestManager::DidHandleURIRequest(requestData->dataReference(), contentLength, mimeType, requestID)); } void WebSoupRequestManagerProxy::didReceiveURIRequestData(const WebData* requestData, uint64_t requestID) { + if (!context()) + return; + if (m_loadFailed) return; - ASSERT(m_webContext); - m_webContext->sendToAllProcesses(Messages::WebSoupRequestManager::DidReceiveURIRequestData(requestData->dataReference(), requestID)); + context()->sendToAllProcesses(Messages::WebSoupRequestManager::DidReceiveURIRequestData(requestData->dataReference(), requestID)); } void WebSoupRequestManagerProxy::didReceiveURIRequest(const String& uriString, WebPageProxy* initiaingPage, uint64_t requestID) @@ -90,4 +116,13 @@ void WebSoupRequestManagerProxy::didFailToLoadURIRequest(uint64_t requestID) m_client.didFailToLoadURIRequest(this, requestID); } +void WebSoupRequestManagerProxy::didFailURIRequest(const WebCore::ResourceError& error, uint64_t requestID) +{ + if (!context()) + return; + + m_loadFailed = true; + context()->sendToAllProcesses(Messages::WebSoupRequestManager::DidFailURIRequest(error, requestID)); +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.h b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.h index e4b8cce37..f78b967ed 100644 --- a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.h +++ b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 Igalia S.L. + * Copyright (C) 2013 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -22,6 +23,7 @@ #include "APIObject.h" #include "MessageReceiver.h" +#include "WebContextSupplement.h" #include "WebSoupRequestManagerClient.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -32,37 +34,43 @@ namespace WebKit { class WebContext; class WebData; -class WebSoupRequestManagerProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebSoupRequestManagerProxy : public TypedAPIObject<APIObject::TypeSoupRequestManager>, public WebContextSupplement, private CoreIPC::MessageReceiver { public: - static const Type APIType = TypeSoupRequestManager; + static const char* supplementName(); static PassRefPtr<WebSoupRequestManagerProxy> create(WebContext*); virtual ~WebSoupRequestManagerProxy(); - void invalidate(); - void clearContext() { m_webContext = 0; } - void initializeClient(const WKSoupRequestManagerClient*); void registerURIScheme(const String& scheme); void didHandleURIRequest(const WebData*, uint64_t contentLength, const String& mimeType, uint64_t requestID); void didReceiveURIRequestData(const WebData*, uint64_t requestID); - void didFailToLoadURIRequest(uint64_t requestID); - void didReceiveURIRequest(const String& uriString, WebPageProxy*, uint64_t requestID); + void didFailURIRequest(const WebCore::ResourceError&, uint64_t requestID); + + const Vector<String>& registeredURISchemes() const { return m_registeredURISchemes; } + + using APIObject::ref; + using APIObject::deref; private: WebSoupRequestManagerProxy(WebContext*); - virtual Type type() const { return APIType; } + // WebContextSupplement + virtual void contextDestroyed() OVERRIDE; + virtual void processDidClose(WebProcessProxy*) OVERRIDE; + virtual void refWebContextSupplement() OVERRIDE; + virtual void derefWebContextSupplement() OVERRIDE; // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; - void didReceiveWebSoupRequestManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE; + + void didFailToLoadURIRequest(uint64_t requestID); - WebContext* m_webContext; WebSoupRequestManagerClient m_client; bool m_loadFailed; + Vector<String> m_registeredURISchemes; }; } // namespace WebKit |