<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[162449] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/162449">162449</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-21 10:30:18 -0800 (Tue, 21 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[SOUP] Implement CUSTOM PROTOCOLS
https://bugs.webkit.org/show_bug.cgi?id=125583

Reviewed by Anders Carlsson.

Add new classes to implement CustomProtocols for soup. The
implementation is the same, but using the CustomProtocol API and
messages. The current implementation can be removed once all ports
using soup switch to using CustomProtocols.

* GNUmakefile.am: Add new include paths.
* GNUmakefile.list.am: Add new files to compilation.
* PlatformGTK.cmake: Add new files to compilation.
* Shared/API/c/soup/WKBaseSoup.h:
* Shared/APIObject.h:
* Shared/Network/CustomProtocols/CustomProtocolManager.h:
* Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp: Added.
(WebKit::generateCustomProtocolID):
(WebKit::WebSoupRequestAsyncData::WebSoupRequestAsyncData):
(WebKit::WebSoupRequestAsyncData::~WebSoupRequestAsyncData):
(WebKit::WebSoupRequestAsyncData::requestFailed):
(WebKit::WebSoupRequestAsyncData::releaseTask):
(WebKit::CustomProtocolManagerImpl::CustomProtocolManagerImpl):
(WebKit::CustomProtocolManagerImpl::~CustomProtocolManagerImpl):
(WebKit::CustomProtocolManagerImpl::registerScheme):
(WebKit::CustomProtocolManagerImpl::supportsScheme):
(WebKit::CustomProtocolManagerImpl::didFailWithError):
(WebKit::CustomProtocolManagerImpl::didLoadData):
(WebKit::CustomProtocolManagerImpl::didReceiveResponse):
(WebKit::CustomProtocolManagerImpl::didFinishLoading):
(WebKit::CustomProtocolManagerImpl::send):
(WebKit::CustomProtocolManagerImpl::finish):
* Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h: Added.
* Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:
(WebKit::CustomProtocolManager::CustomProtocolManager):
(WebKit::CustomProtocolManager::initialize):
(WebKit::CustomProtocolManager::registerScheme):
(WebKit::CustomProtocolManager::supportsScheme):
(WebKit::CustomProtocolManager::didFailWithError):
(WebKit::CustomProtocolManager::didLoadData):
(WebKit::CustomProtocolManager::didReceiveResponse):
(WebKit::CustomProtocolManager::didFinishLoading):
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/API/C/soup/WKAPICastSoup.h:
* UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp: Copied from Source/WebKit2/UIProcess/soup/WebContextSoup.cpp.
(WKSoupCustomProtocolRequestManagerGetTypeID):
(WKSoupCustomProtocolRequestManagerSetClient):
* UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h: Added.
* UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h:
* UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:
(WebKit::CustomProtocolManagerProxy::CustomProtocolManagerProxy):
* UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp:
(WebKit::CustomProtocolManagerProxy::CustomProtocolManagerProxy):
(WebKit::CustomProtocolManagerProxy::startLoading):
(WebKit::CustomProtocolManagerProxy::stopLoading):
* UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp: Added.
(WebKit::WebSoupCustomProtocolRequestManager::supplementName):
(WebKit::WebSoupCustomProtocolRequestManager::create):
(WebKit::WebSoupCustomProtocolRequestManager::WebSoupCustomProtocolRequestManager):
(WebKit::WebSoupCustomProtocolRequestManager::~WebSoupCustomProtocolRequestManager):
(WebKit::WebSoupCustomProtocolRequestManager::initializeClient):
(WebKit::WebSoupCustomProtocolRequestManager::contextDestroyed):
(WebKit::WebSoupCustomProtocolRequestManager::processDidClose):
(WebKit::WebSoupCustomProtocolRequestManager::refWebContextSupplement):
(WebKit::WebSoupCustomProtocolRequestManager::derefWebContextSupplement):
(WebKit::WebSoupCustomProtocolRequestManager::registerSchemeForCustomProtocol):
(WebKit::WebSoupCustomProtocolRequestManager::unregisterSchemeForCustomProtocol):
(WebKit::WebSoupCustomProtocolRequestManager::startLoading):
(WebKit::WebSoupCustomProtocolRequestManager::stopLoading):
(WebKit::WebSoupCustomProtocolRequestManager::didReceiveResponse):
(WebKit::WebSoupCustomProtocolRequestManager::didLoadData):
(WebKit::WebSoupCustomProtocolRequestManager::didFailWithError):
(WebKit::WebSoupCustomProtocolRequestManager::didFinishLoading):
* UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h: Added.
(WebKit::WebSoupCustomProtocolRequestManager::registeredSchemesForCustomProtocols):
* UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp: Added.
(WebKit::WebSoupCustomProtocolRequestManagerClient::startLoading):
(WebKit::WebSoupCustomProtocolRequestManagerClient::stopLoading):
* UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h: Added.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::NetworkProcessProxy):
* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext):
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::WebProcessProxy):
* UIProcess/gtk/WebContextGtk.cpp:
(WebKit::WebContext::platformInitializeWebProcess):
* UIProcess/soup/WebContextSoup.cpp:
(WebKit::WebContext::platformInitializeNetworkProcess):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess):
* WebProcess/soup/WebKitSoupRequestGeneric.cpp:
(webkitSoupRequestGenericSendAsync):
(webkitSoupRequestGenericSendFinish):
* WebProcess/soup/WebKitSoupRequestGeneric.h:
* WebProcess/soup/WebProcessSoup.cpp:
(WebKit::WebProcess::platformInitializeWebProcess):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2GNUmakefileam">trunk/Source/WebKit2/GNUmakefile.am</a></li>
<li><a href="#trunkSourceWebKit2GNUmakefilelistam">trunk/Source/WebKit2/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceWebKit2PlatformGTKcmake">trunk/Source/WebKit2/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIcsoupWKBaseSouph">trunk/Source/WebKit2/Shared/API/c/soup/WKBaseSoup.h</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIObjecth">trunk/Source/WebKit2/Shared/APIObject.h</a></li>
<li><a href="#trunkSourceWebKit2SharedNetworkCustomProtocolsCustomProtocolManagerh">trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h</a></li>
<li><a href="#trunkSourceWebKit2SharedNetworkCustomProtocolssoupCustomProtocolManagerSoupcpp">trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebProcessCreationParameterscpp">trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebProcessCreationParametersh">trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICsoupWKAPICastSouph">trunk/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkCustomProtocolsCustomProtocolManagerProxyh">trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkCustomProtocolsmacCustomProtocolManagerProxyMacmm">trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupCustomProtocolManagerProxySoupcpp">trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkNetworkProcessProxycpp">trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebContextcpp">trunk/Source/WebKit2/UIProcess/WebContext.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessProxycpp">trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessgtkWebContextGtkcpp">trunk/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcesssoupWebContextSoupcpp">trunk/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcesscpp">trunk/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcesssoupWebKitSoupRequestGenericcpp">trunk/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcesssoupWebKitSoupRequestGenerich">trunk/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcesssoupWebProcessSoupcpp">trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2SharedNetworkCustomProtocolssoupCustomProtocolManagerImplcpp">trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedNetworkCustomProtocolssoupCustomProtocolManagerImplh">trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICsoupWKSoupCustomProtocolRequestManagercpp">trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICsoupWKSoupCustomProtocolRequestManagerh">trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupWebSoupCustomProtocolRequestManagercpp">trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupWebSoupCustomProtocolRequestManagerh">trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupWebSoupCustomProtocolRequestManagerClientcpp">trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupWebSoupCustomProtocolRequestManagerClienth">trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -1,3 +1,109 @@
</span><ins>+2014-01-21  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [SOUP] Implement CUSTOM PROTOCOLS
+        https://bugs.webkit.org/show_bug.cgi?id=125583
+
+        Reviewed by Anders Carlsson.
+
+        Add new classes to implement CustomProtocols for soup. The
+        implementation is the same, but using the CustomProtocol API and
+        messages. The current implementation can be removed once all ports
+        using soup switch to using CustomProtocols.
+
+        * GNUmakefile.am: Add new include paths.
+        * GNUmakefile.list.am: Add new files to compilation.
+        * PlatformGTK.cmake: Add new files to compilation.
+        * Shared/API/c/soup/WKBaseSoup.h:
+        * Shared/APIObject.h:
+        * Shared/Network/CustomProtocols/CustomProtocolManager.h:
+        * Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp: Added.
+        (WebKit::generateCustomProtocolID):
+        (WebKit::WebSoupRequestAsyncData::WebSoupRequestAsyncData):
+        (WebKit::WebSoupRequestAsyncData::~WebSoupRequestAsyncData):
+        (WebKit::WebSoupRequestAsyncData::requestFailed):
+        (WebKit::WebSoupRequestAsyncData::releaseTask):
+        (WebKit::CustomProtocolManagerImpl::CustomProtocolManagerImpl):
+        (WebKit::CustomProtocolManagerImpl::~CustomProtocolManagerImpl):
+        (WebKit::CustomProtocolManagerImpl::registerScheme):
+        (WebKit::CustomProtocolManagerImpl::supportsScheme):
+        (WebKit::CustomProtocolManagerImpl::didFailWithError):
+        (WebKit::CustomProtocolManagerImpl::didLoadData):
+        (WebKit::CustomProtocolManagerImpl::didReceiveResponse):
+        (WebKit::CustomProtocolManagerImpl::didFinishLoading):
+        (WebKit::CustomProtocolManagerImpl::send):
+        (WebKit::CustomProtocolManagerImpl::finish):
+        * Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h: Added.
+        * Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:
+        (WebKit::CustomProtocolManager::CustomProtocolManager):
+        (WebKit::CustomProtocolManager::initialize):
+        (WebKit::CustomProtocolManager::registerScheme):
+        (WebKit::CustomProtocolManager::supportsScheme):
+        (WebKit::CustomProtocolManager::didFailWithError):
+        (WebKit::CustomProtocolManager::didLoadData):
+        (WebKit::CustomProtocolManager::didReceiveResponse):
+        (WebKit::CustomProtocolManager::didFinishLoading):
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/API/C/soup/WKAPICastSoup.h:
+        * UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp: Copied from Source/WebKit2/UIProcess/soup/WebContextSoup.cpp.
+        (WKSoupCustomProtocolRequestManagerGetTypeID):
+        (WKSoupCustomProtocolRequestManagerSetClient):
+        * UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h: Added.
+        * UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h:
+        * UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:
+        (WebKit::CustomProtocolManagerProxy::CustomProtocolManagerProxy):
+        * UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp:
+        (WebKit::CustomProtocolManagerProxy::CustomProtocolManagerProxy):
+        (WebKit::CustomProtocolManagerProxy::startLoading):
+        (WebKit::CustomProtocolManagerProxy::stopLoading):
+        * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp: Added.
+        (WebKit::WebSoupCustomProtocolRequestManager::supplementName):
+        (WebKit::WebSoupCustomProtocolRequestManager::create):
+        (WebKit::WebSoupCustomProtocolRequestManager::WebSoupCustomProtocolRequestManager):
+        (WebKit::WebSoupCustomProtocolRequestManager::~WebSoupCustomProtocolRequestManager):
+        (WebKit::WebSoupCustomProtocolRequestManager::initializeClient):
+        (WebKit::WebSoupCustomProtocolRequestManager::contextDestroyed):
+        (WebKit::WebSoupCustomProtocolRequestManager::processDidClose):
+        (WebKit::WebSoupCustomProtocolRequestManager::refWebContextSupplement):
+        (WebKit::WebSoupCustomProtocolRequestManager::derefWebContextSupplement):
+        (WebKit::WebSoupCustomProtocolRequestManager::registerSchemeForCustomProtocol):
+        (WebKit::WebSoupCustomProtocolRequestManager::unregisterSchemeForCustomProtocol):
+        (WebKit::WebSoupCustomProtocolRequestManager::startLoading):
+        (WebKit::WebSoupCustomProtocolRequestManager::stopLoading):
+        (WebKit::WebSoupCustomProtocolRequestManager::didReceiveResponse):
+        (WebKit::WebSoupCustomProtocolRequestManager::didLoadData):
+        (WebKit::WebSoupCustomProtocolRequestManager::didFailWithError):
+        (WebKit::WebSoupCustomProtocolRequestManager::didFinishLoading):
+        * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h: Added.
+        (WebKit::WebSoupCustomProtocolRequestManager::registeredSchemesForCustomProtocols):
+        * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp: Added.
+        (WebKit::WebSoupCustomProtocolRequestManagerClient::startLoading):
+        (WebKit::WebSoupCustomProtocolRequestManagerClient::stopLoading):
+        * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h: Added.
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::NetworkProcessProxy):
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::WebContext):
+        * UIProcess/WebPageProxy.cpp:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::WebProcessProxy):
+        * UIProcess/gtk/WebContextGtk.cpp:
+        (WebKit::WebContext::platformInitializeWebProcess):
+        * UIProcess/soup/WebContextSoup.cpp:
+        (WebKit::WebContext::platformInitializeNetworkProcess):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::WebProcess):
+        * WebProcess/soup/WebKitSoupRequestGeneric.cpp:
+        (webkitSoupRequestGenericSendAsync):
+        (webkitSoupRequestGenericSendFinish):
+        * WebProcess/soup/WebKitSoupRequestGeneric.h:
+        * WebProcess/soup/WebProcessSoup.cpp:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+
</ins><span class="cx"> 2014-01-21  Adrian Perez de Castro  &lt;aperez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Allow passing extra data to web extensions
</span></span></pre></div>
<a id="trunkSourceWebKit2GNUmakefileam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/GNUmakefile.am (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/GNUmakefile.am        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/GNUmakefile.am        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -104,6 +104,7 @@
</span><span class="cx">         -I$(srcdir)/Source/WebKit2/Shared/gtk \
</span><span class="cx">         -I$(srcdir)/Source/WebKit2/Shared/Network \
</span><span class="cx">         -I$(srcdir)/Source/WebKit2/Shared/Network/CustomProtocols \
</span><ins>+        -I$(srcdir)/Source/WebKit2/Shared/Network/CustomProtocols/soup \
</ins><span class="cx">         -I$(srcdir)/Source/WebKit2/Shared/Plugins \
</span><span class="cx">         -I$(srcdir)/Source/WebKit2/Shared/Plugins/Netscape \
</span><span class="cx">         -I$(srcdir)/Source/WebKit2/Shared/Plugins/Netscape/x11 \
</span><span class="lines">@@ -122,6 +123,7 @@
</span><span class="cx">         -I$(srcdir)/Source/WebKit2/UIProcess/Launcher/gtk \
</span><span class="cx">         -I$(srcdir)/Source/WebKit2/UIProcess/Network \
</span><span class="cx">         -I$(srcdir)/Source/WebKit2/UIProcess/Network/CustomProtocols \
</span><ins>+        -I$(srcdir)/Source/WebKit2/UIProcess/Network/CustomProtocols/soup \
</ins><span class="cx">         -I$(srcdir)/Source/WebKit2/UIProcess/Notifications \
</span><span class="cx">         -I$(srcdir)/Source/WebKit2/UIProcess/Plugins \
</span><span class="cx">         -I$(srcdir)/Source/WebKit2/UIProcess/Plugins/unix \
</span></span></pre></div>
<a id="trunkSourceWebKit2GNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/GNUmakefile.list.am (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/GNUmakefile.list.am        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/GNUmakefile.list.am        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -403,6 +403,8 @@
</span><span class="cx">         Source/WebKit2/Shared/NativeWebMouseEvent.h \
</span><span class="cx">         Source/WebKit2/Shared/NativeWebWheelEvent.h \
</span><span class="cx">         Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h \
</span><ins>+        Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h \
+        Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp \
</ins><span class="cx">         Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp \
</span><span class="cx">         Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp \
</span><span class="cx">         Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h \
</span><span class="lines">@@ -523,6 +525,8 @@
</span><span class="cx">         Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.h \
</span><span class="cx">         Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.cpp \
</span><span class="cx">         Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h \
</span><ins>+        Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp \
+        Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h \
</ins><span class="cx">         Source/WebKit2/UIProcess/API/C/WebKit2_C.h \
</span><span class="cx">         Source/WebKit2/UIProcess/API/C/WKAPICast.h \
</span><span class="cx">         Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h \
</span><span class="lines">@@ -839,6 +843,10 @@
</span><span class="cx">         Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h \
</span><span class="cx">         Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h \
</span><span class="cx">         Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp \
</span><ins>+        Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp \
+        Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h \
+        Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp \
+        Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h \
</ins><span class="cx">         Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp \
</span><span class="cx">         Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h \
</span><span class="cx">         Source/WebKit2/UIProcess/Network/soup/NetworkProcessProxySoup.cpp \
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformGTK.cmake (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformGTK.cmake        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/PlatformGTK.cmake        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> 
</span><span class="cx">     Shared/Downloads/soup/DownloadSoup.cpp
</span><span class="cx"> 
</span><ins>+    Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp
</ins><span class="cx">     Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp
</span><span class="cx"> 
</span><span class="cx">     Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
</span><span class="lines">@@ -78,6 +79,7 @@
</span><span class="cx">     UIProcess/API/C/soup/WKContextSoup.cpp
</span><span class="cx">     UIProcess/API/C/soup/WKCookieManagerSoup.cpp
</span><span class="cx">     UIProcess/API/C/soup/WKSoupRequestManager.cpp
</span><ins>+    UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp
</ins><span class="cx"> 
</span><span class="cx">     UIProcess/API/gtk/PageClientImpl.cpp
</span><span class="cx">     UIProcess/API/gtk/PageClientImpl.h
</span><span class="lines">@@ -236,6 +238,8 @@
</span><span class="cx">     UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp
</span><span class="cx"> 
</span><span class="cx">     UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp
</span><ins>+    UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp
+    UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp
</ins><span class="cx"> 
</span><span class="cx">     UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp
</span><span class="cx">     UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp
</span><span class="lines">@@ -397,6 +401,7 @@
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/API/C/soup&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/API/cpp/gtk&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/API/gtk&quot;
</span><ins>+    &quot;${WEBKIT2_DIR}/UIProcess/Network/CustomProtocols/soup&quot;
</ins><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/gtk&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/soup&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk&quot;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIcsoupWKBaseSouph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/API/c/soup/WKBaseSoup.h (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/c/soup/WKBaseSoup.h        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/Shared/API/c/soup/WKBaseSoup.h        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -31,5 +31,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> typedef const struct OpaqueWKSoupRequestManager* WKSoupRequestManagerRef;
</span><ins>+typedef const struct OpaqueWKSoupCustomProtocolRequestManager* WKSoupCustomProtocolRequestManagerRef;
</ins><span class="cx"> 
</span><span class="cx"> #endif /* WKBaseSoup_h */
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/APIObject.h (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/APIObject.h        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/Shared/APIObject.h        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -158,6 +158,7 @@
</span><span class="cx">         View,
</span><span class="cx"> #if USE(SOUP)
</span><span class="cx">         SoupRequestManager,
</span><ins>+        SoupCustomProtocolRequestManager,
</ins><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(EFL)
</span><span class="cx">         PopupMenuItem,
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedNetworkCustomProtocolsCustomProtocolManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -32,13 +32,13 @@
</span><span class="cx"> #include &quot;NetworkProcessSupplement.h&quot;
</span><span class="cx"> #include &quot;WebProcessSupplement.h&quot;
</span><span class="cx"> #include &quot;WorkQueue.h&quot;
</span><del>-#include &lt;wtf/HashSet.h&gt;
-#include &lt;wtf/Threading.h&gt;
</del><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><ins>+#include &lt;wtf/HashSet.h&gt;
</ins><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><ins>+#include &lt;wtf/Threading.h&gt;
</ins><span class="cx"> OBJC_CLASS WKCustomProtocol;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> class ChildProcess;
</span><ins>+class CustomProtocolManagerImpl;
</ins><span class="cx"> struct NetworkProcessCreationParameters;
</span><span class="cx"> 
</span><span class="cx"> class CustomProtocolManager : public WebProcessSupplement, public NetworkProcessSupplement, public IPC::Connection::WorkQueueMessageReceiver {
</span><span class="lines">@@ -95,12 +96,13 @@
</span><span class="cx">     void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&amp;, uint32_t cacheStoragePolicy);
</span><span class="cx">     void didFinishLoading(uint64_t customProtocolID);
</span><span class="cx"> 
</span><del>-    HashSet&lt;String&gt; m_registeredSchemes;
-    Mutex m_registeredSchemesMutex;
</del><span class="cx">     ChildProcess* m_childProcess;
</span><span class="cx">     RefPtr&lt;WorkQueue&gt; m_messageQueue;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><ins>+    HashSet&lt;String&gt; m_registeredSchemes;
+    Mutex m_registeredSchemesMutex;
+
</ins><span class="cx">     typedef HashMap&lt;uint64_t, RetainPtr&lt;WKCustomProtocol&gt;&gt; CustomProtocolMap;
</span><span class="cx">     CustomProtocolMap m_customProtocolMap;
</span><span class="cx">     Mutex m_customProtocolMapMutex;
</span><span class="lines">@@ -108,6 +110,9 @@
</span><span class="cx">     // WKCustomProtocol objects can be removed from the m_customProtocolMap from multiple threads.
</span><span class="cx">     // 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.
</span><span class="cx">     RetainPtr&lt;WKCustomProtocol&gt; protocolForID(uint64_t customProtocolID);
</span><ins>+#else
+    // FIXME: Move mac specific code to CustomProtocolManagerImpl.
+    std::unique_ptr&lt;CustomProtocolManagerImpl&gt; m_impl;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedNetworkCustomProtocolssoupCustomProtocolManagerImplcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp (0 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp                                (rev 0)
+++ trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -0,0 +1,208 @@
</span><ins>+/*
+ * 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 &quot;config.h&quot;
+#include &quot;CustomProtocolManagerImpl.h&quot;
+
+#if ENABLE(CUSTOM_PROTOCOLS)
+
+#include &quot;ChildProcess.h&quot;
+#include &quot;CustomProtocolManagerProxyMessages.h&quot;
+#include &quot;DataReference.h&quot;
+#include &quot;WebCoreArgumentCoders.h&quot;
+#include &quot;WebKitSoupRequestGeneric.h&quot;
+#include &quot;WebKitSoupRequestInputStream.h&quot;
+#include &lt;WebCore/ResourceError.h&gt;
+#include &lt;WebCore/ResourceRequest.h&gt;
+#include &lt;WebCore/ResourceResponse.h&gt;
+#include &lt;WebCore/SoupNetworkSession.h&gt;
+#include &lt;WebCore/SoupURIUtils.h&gt;
+
+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&lt;void**&gt;(&amp;request));
+    }
+
+    ~WebSoupRequestAsyncData()
+    {
+        if (request)
+            g_object_remove_weak_pointer(G_OBJECT(request), reinterpret_cast&lt;void**&gt;(&amp;request));
+    }
+
+    bool requestFailed()
+    {
+        return g_cancellable_is_cancelled(cancellable.get()) || !request;
+    }
+
+    GRefPtr&lt;GTask&gt; releaseTask()
+    {
+        GTask* returnValue = task;
+        task = nullptr;
+        return adoptGRef(returnValue);
+    }
+
+    GTask* task;
+    WebKitSoupRequestGeneric* request;
+    GRefPtr&lt;GCancellable&gt; cancellable;
+    GRefPtr&lt;GInputStream&gt; 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&amp; scheme)
+{
+    if (m_schemes-&gt;len)
+        g_ptr_array_remove_index_fast(m_schemes.get(), m_schemes-&gt;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&lt;SoupRequestClass*&gt;(g_type_class_ref(WEBKIT_TYPE_SOUP_REQUEST_GENERIC));
+    genericRequestClass-&gt;schemes = const_cast&lt;const char**&gt;(reinterpret_cast&lt;char**&gt;(m_schemes-&gt;pdata));
+    static_cast&lt;WebKitSoupRequestGenericClass*&gt;(g_type_class_ref(WEBKIT_TYPE_SOUP_REQUEST_GENERIC))-&gt;customProtocolManager = this;
+    soup_session_add_feature_by_type(session, WEBKIT_TYPE_SOUP_REQUEST_GENERIC);
+}
+
+bool CustomProtocolManagerImpl::supportsScheme(const String&amp; scheme)
+{
+    if (scheme.isNull())
+        return false;
+
+    CString cScheme = scheme.utf8();
+    for (unsigned i = 0; i &lt; m_schemes-&gt;len; ++i) {
+        if (cScheme == static_cast&lt;char*&gt;(g_ptr_array_index(m_schemes.get(), i)))
+            return true;
+    }
+
+    return false;
+}
+
+void CustomProtocolManagerImpl::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&amp; error)
+{
+    WebSoupRequestAsyncData* data = m_customProtocolMap.get(customProtocolID);
+    ASSERT(data);
+
+    GRefPtr&lt;GTask&gt; task = data-&gt;releaseTask();
+    ASSERT(task.get());
+    g_task_return_new_error(task.get(), g_quark_from_string(error.domain().utf8().data()),
+        error.errorCode(), &quot;%s&quot;, error.localizedDescription().utf8().data());
+
+    m_customProtocolMap.remove(customProtocolID);
+}
+
+void CustomProtocolManagerImpl::didLoadData(uint64_t customProtocolID, const IPC::DataReference&amp; 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-&gt;stream) {
+        GRefPtr&lt;GTask&gt; task = data-&gt;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&lt;uint64_t&gt;(soupContentLength);
+        if (!dataReference.size()) {
+            // Empty reply, just create and empty GMemoryInputStream.
+            data-&gt;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-&gt;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-&gt;stream = webkitSoupRequestInputStreamNew(contentLength);
+            webkitSoupRequestInputStreamAddData(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data-&gt;stream.get()), dataReference.data(), dataReference.size());
+        }
+        g_task_return_pointer(task.get(), data-&gt;stream.get(), g_object_unref);
+        return;
+    }
+
+    if (data-&gt;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-&gt;stream.get())))
+            m_childProcess-&gt;send(Messages::CustomProtocolManagerProxy::StopLoading(customProtocolID), 0);
+
+        return;
+    }
+
+    webkitSoupRequestInputStreamAddData(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data-&gt;stream.get()), dataReference.data(), dataReference.size());
+}
+
+void CustomProtocolManagerImpl::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&amp; response)
+{
+    WebSoupRequestAsyncData* data = m_customProtocolMap.get(customProtocolID);
+    ASSERT(data);
+    ASSERT(data-&gt;task);
+
+    WebKitSoupRequestGeneric* request = WEBKIT_SOUP_REQUEST_GENERIC(g_task_get_source_object(data-&gt;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&lt;WebSoupRequestAsyncData&gt;(task, request));
+
+    WebCore::ResourceRequest resourceRequest(WebCore::soupURIToKURL(soup_request_get_uri(SOUP_REQUEST(request))));
+    m_childProcess-&gt;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)
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedNetworkCustomProtocolssoupCustomProtocolManagerImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h (0 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h                                (rev 0)
+++ trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+/*
+ * 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 &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/gobject/GRefPtr.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+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&amp;);
+    bool supportsScheme(const String&amp;);
+
+    void didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&amp;);
+    void didLoadData(uint64_t customProtocolID, const IPC::DataReference&amp;);
+    void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&amp;);
+    void didFinishLoading(uint64_t customProtocolID);
+
+    // SoupRequest implementation.
+    void send(GTask*);
+    GInputStream* finish(GTask*, GError**);
+
+private:
+    ChildProcess* m_childProcess;
+    GRefPtr&lt;GPtrArray&gt; m_schemes;
+    HashMap&lt;uint64_t, std::unique_ptr&lt;WebSoupRequestAsyncData&gt;&gt; m_customProtocolMap;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(CUSTOM_PROTOCOLS)
+
+#endif // CustomProtocolManagerImpl_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedNetworkCustomProtocolssoupCustomProtocolManagerSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -23,15 +23,10 @@
</span><span class="cx"> #if ENABLE(CUSTOM_PROTOCOLS)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ChildProcess.h&quot;
</span><ins>+#include &quot;CustomProtocolManagerImpl.h&quot;
</ins><span class="cx"> #include &quot;CustomProtocolManagerMessages.h&quot;
</span><del>-#include &quot;CustomProtocolManagerProxyMessages.h&quot;
-#include &quot;WebCoreArgumentCoders.h&quot;
</del><span class="cx"> #include &quot;WebProcessCreationParameters.h&quot;
</span><span class="cx"> #include &lt;WebCore/NotImplemented.h&gt;
</span><del>-#include &lt;WebCore/ResourceError.h&gt;
-#include &lt;WebCore/ResourceRequest.h&gt;
-#include &lt;WebCore/ResourceResponse.h&gt;
-#include &lt;WebCore/URL.h&gt;
</del><span class="cx"> 
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span><span class="cx"> #include &quot;NetworkProcessCreationParameters.h&quot;
</span><span class="lines">@@ -47,6 +42,7 @@
</span><span class="cx"> CustomProtocolManager::CustomProtocolManager(ChildProcess* childProcess)
</span><span class="cx">     : m_childProcess(childProcess)
</span><span class="cx">     , m_messageQueue(WorkQueue::create(&quot;com.apple.WebKit.CustomProtocolManager&quot;))
</span><ins>+    , m_impl(std::make_unique&lt;CustomProtocolManagerImpl&gt;(childProcess))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -55,19 +51,31 @@
</span><span class="cx">     connection-&gt;addWorkQueueMessageReceiver(Messages::CustomProtocolManager::messageReceiverName(), m_messageQueue.get(), this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CustomProtocolManager::initialize(const WebProcessCreationParameters&amp;)
</del><ins>+void CustomProtocolManager::initialize(const WebProcessCreationParameters&amp; parameters)
</ins><span class="cx"> {
</span><ins>+#if ENABLE(NETWORK_PROCESS)
+    ASSERT(parameters.urlSchemesRegisteredForCustomProtocols.isEmpty() || !parameters.usesNetworkProcess);
+    if (parameters.usesNetworkProcess) {
+        m_childProcess-&gt;parentProcessConnection()-&gt;removeWorkQueueMessageReceiver(Messages::CustomProtocolManager::messageReceiverName());
+        m_messageQueue = nullptr;
+        return;
+    }
+#endif
+    for (size_t i = 0; i &lt; parameters.urlSchemesRegisteredForCustomProtocols.size(); ++i)
+        registerScheme(parameters.urlSchemesRegisteredForCustomProtocols[i]);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span><del>-void CustomProtocolManager::initialize(const NetworkProcessCreationParameters&amp;)
</del><ins>+void CustomProtocolManager::initialize(const NetworkProcessCreationParameters&amp; parameters)
</ins><span class="cx"> {
</span><ins>+    for (size_t i = 0; i &lt; parameters.urlSchemesRegisteredForCustomProtocols.size(); ++i)
+        registerScheme(parameters.urlSchemesRegisteredForCustomProtocols[i]);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-void CustomProtocolManager::registerScheme(const String&amp;)
</del><ins>+void CustomProtocolManager::registerScheme(const String&amp; scheme)
</ins><span class="cx"> {
</span><del>-    notImplemented();
</del><ins>+    m_impl-&gt;registerScheme(scheme);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CustomProtocolManager::unregisterScheme(const String&amp;)
</span><span class="lines">@@ -75,30 +83,29 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CustomProtocolManager::supportsScheme(const String&amp;)
</del><ins>+bool CustomProtocolManager::supportsScheme(const String&amp; scheme)
</ins><span class="cx"> {
</span><del>-    notImplemented();
-    return false;
</del><ins>+    return m_impl-&gt;supportsScheme(scheme);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CustomProtocolManager::didFailWithError(uint64_t, const WebCore::ResourceError&amp;)
</del><ins>+void CustomProtocolManager::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&amp; error)
</ins><span class="cx"> {
</span><del>-    notImplemented();
</del><ins>+    m_impl-&gt;didFailWithError(customProtocolID, error);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CustomProtocolManager::didLoadData(uint64_t, const IPC::DataReference&amp;)
</del><ins>+void CustomProtocolManager::didLoadData(uint64_t customProtocolID, const IPC::DataReference&amp; dataReference)
</ins><span class="cx"> {
</span><del>-    notImplemented();
</del><ins>+    m_impl-&gt;didLoadData(customProtocolID, dataReference);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CustomProtocolManager::didReceiveResponse(uint64_t, const WebCore::ResourceResponse&amp;, uint32_t)
</del><ins>+void CustomProtocolManager::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&amp; response, uint32_t)
</ins><span class="cx"> {
</span><del>-    notImplemented();
</del><ins>+    m_impl-&gt;didReceiveResponse(customProtocolID, response);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CustomProtocolManager::didFinishLoading(uint64_t)
</del><ins>+void CustomProtocolManager::didFinishLoading(uint64_t customProtocolID)
</ins><span class="cx"> {
</span><del>-    notImplemented();
</del><ins>+    m_impl-&gt;didFinishLoading(customProtocolID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebProcessCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -73,7 +73,9 @@
</span><span class="cx">     encoder &lt;&lt; urlSchemesRegisteredForCustomProtocols;
</span><span class="cx"> #endif
</span><span class="cx"> #if USE(SOUP)
</span><ins>+#if !ENABLE(CUSTOM_PROTOCOLS)
</ins><span class="cx">     encoder &lt;&lt; urlSchemesRegistered;
</span><ins>+#endif
</ins><span class="cx">     encoder &lt;&lt; cookiePersistentStoragePath;
</span><span class="cx">     encoder &lt;&lt; cookiePersistentStorageType;
</span><span class="cx">     encoder.encodeEnum(cookieAcceptPolicy);
</span><span class="lines">@@ -163,8 +165,10 @@
</span><span class="cx">         return false;
</span><span class="cx"> #endif
</span><span class="cx"> #if USE(SOUP)
</span><ins>+#if !ENABLE(CUSTOM_PROTOCOLS)
</ins><span class="cx">     if (!decoder.decode(parameters.urlSchemesRegistered))
</span><span class="cx">         return false;
</span><ins>+#endif
</ins><span class="cx">     if (!decoder.decode(parameters.cookiePersistentStoragePath))
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(parameters.cookiePersistentStorageType))
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebProcessCreationParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -82,7 +82,9 @@
</span><span class="cx">     Vector&lt;String&gt; urlSchemesRegisteredForCustomProtocols;
</span><span class="cx"> #endif
</span><span class="cx"> #if USE(SOUP)
</span><ins>+#if !ENABLE(CUSTOM_PROTOCOLS)
</ins><span class="cx">     Vector&lt;String&gt; urlSchemesRegistered;
</span><ins>+#endif
</ins><span class="cx">     String cookiePersistentStoragePath;
</span><span class="cx">     uint32_t cookiePersistentStorageType;
</span><span class="cx">     HTTPCookieAcceptPolicy cookieAcceptPolicy;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICsoupWKAPICastSouph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -32,9 +32,14 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><ins>+class WebSoupCustomProtocolRequestManager;
</ins><span class="cx"> class WebSoupRequestManagerProxy;
</span><span class="cx"> 
</span><ins>+#if ENABLE(CUSTOM_PROTOCOLS)
+WK_ADD_API_MAPPING(WKSoupCustomProtocolRequestManagerRef, WebSoupCustomProtocolRequestManager)
+#else
</ins><span class="cx"> WK_ADD_API_MAPPING(WKSoupRequestManagerRef, WebSoupRequestManagerProxy)
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICsoupWKSoupCustomProtocolRequestManagercppfromrev162448trunkSourceWebKit2UIProcesssoupWebContextSoupcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp (from rev 162448, trunk/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp) (0 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * 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 &quot;config.h&quot;
+#include &quot;WKSoupCustomProtocolRequestManager.h&quot;
+
+#include &quot;WKAPICast.h&quot;
+#include &quot;WebSoupCustomProtocolRequestManager.h&quot;
+
+using namespace WebKit;
+
+WKTypeID WKSoupCustomProtocolRequestManagerGetTypeID()
+{
+#if ENABLE(CUSTOM_PROTOCOLS)
+    return toAPI(WebSoupCustomProtocolRequestManager::APIType);
+#else
+    return 0;
+#endif
+}
+
+void WKSoupCustomProtocolRequestManagerSetClient(WKSoupCustomProtocolRequestManagerRef soupRequestManagerRef, const WKSoupCustomProtocolRequestManagerClientBase* wkClient)
+{
+#if ENABLE(CUSTOM_PROTOCOLS)
+    toImpl(soupRequestManagerRef)-&gt;initializeClient(wkClient);
+#else
+    UNUSED_PARAM(soupRequestManagerRef);
+    UNUSED_PARAM(wkClient);
+#endif
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICsoupWKSoupCustomProtocolRequestManagerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h (0 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * 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 WKSoupCustomProtocolRequestManager_h
+#define WKSoupCustomProtocolRequestManager_h
+
+#include &lt;WebKit2/WKBase.h&gt;
+
+#ifdef __cplusplus
+extern &quot;C&quot; {
+#endif
+
+typedef void (*WKSoupCustomProtocolRequestManagerStartLoadingCallback)(WKSoupCustomProtocolRequestManagerRef soupManagerRef, uint64_t customProtocolID, WKURLRequestRef requestRef, const void* clientInfo);
+typedef void (*WKSoupCustomProtocolRequestManagerStopLoadingCallback)(WKSoupCustomProtocolRequestManagerRef soupManagerRef, uint64_t customProtocolID, const void* clientInfo);
+
+typedef struct WKSoupCustomProtocolRequestManagerClientBase {
+    int                                                    version;
+    const void*                                            clientInfo;
+} WKSoupCustomProtocolRequestManagerClientBase;
+
+typedef struct WKSoupCustomProtocolRequestManagerClientV0 {
+    WKSoupCustomProtocolRequestManagerClientBase           base;
+
+    WKSoupCustomProtocolRequestManagerStartLoadingCallback startLoading;
+    WKSoupCustomProtocolRequestManagerStopLoadingCallback  stopLoading;
+} WKSoupCustomProtocolRequestManagerClientV0;
+
+WK_EXPORT WKTypeID WKSoupCustomProtocolRequestManagerGetTypeID();
+
+WK_EXPORT void WKSoupCustomProtocolRequestManagerSetClient(WKSoupCustomProtocolRequestManagerRef, const WKSoupCustomProtocolRequestManagerClientBase*);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKSoupCustomProtocolRequestManager_h */
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkCustomProtocolsCustomProtocolManagerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -43,10 +43,11 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> class ChildProcessProxy;
</span><ins>+class WebContext;
</ins><span class="cx"> 
</span><span class="cx"> class CustomProtocolManagerProxy : public IPC::MessageReceiver {
</span><span class="cx"> public:
</span><del>-    explicit CustomProtocolManagerProxy(ChildProcessProxy*);
</del><ins>+    explicit CustomProtocolManagerProxy(ChildProcessProxy*, WebContext&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest&amp;);
</span><span class="cx">     void stopLoading(uint64_t customProtocolID);
</span><span class="lines">@@ -56,6 +57,7 @@
</span><span class="cx">     virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&amp;) override;
</span><span class="cx"> 
</span><span class="cx">     ChildProcessProxy* m_childProcessProxy;
</span><ins>+    WebContext&amp; m_webContext;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     typedef HashMap&lt;uint64_t, RetainPtr&lt;WKCustomProtocolLoader&gt;&gt; LoaderMap;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkCustomProtocolsmacCustomProtocolManagerProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -122,8 +122,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-CustomProtocolManagerProxy::CustomProtocolManagerProxy(ChildProcessProxy* childProcessProxy)
</del><ins>+CustomProtocolManagerProxy::CustomProtocolManagerProxy(ChildProcessProxy* childProcessProxy, WebContext&amp; webContext)
</ins><span class="cx">     : m_childProcessProxy(childProcessProxy)
</span><ins>+    , m_webContext(webContext)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_childProcessProxy);
</span><span class="cx">     m_childProcessProxy-&gt;addMessageReceiver(Messages::CustomProtocolManagerProxy::messageReceiverName(), *this);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupCustomProtocolManagerProxySoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -25,26 +25,28 @@
</span><span class="cx"> #include &quot;ChildProcessProxy.h&quot;
</span><span class="cx"> #include &quot;CustomProtocolManagerMessages.h&quot;
</span><span class="cx"> #include &quot;CustomProtocolManagerProxyMessages.h&quot;
</span><del>-#include &lt;WebCore/NotImplemented.h&gt;
</del><ins>+#include &quot;WebContext.h&quot;
+#include &quot;WebSoupCustomProtocolRequestManager.h&quot;
</ins><span class="cx"> #include &lt;WebCore/ResourceRequest.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-CustomProtocolManagerProxy::CustomProtocolManagerProxy(ChildProcessProxy* childProcessProxy)
</del><ins>+CustomProtocolManagerProxy::CustomProtocolManagerProxy(ChildProcessProxy* childProcessProxy, WebContext&amp; webContext)
</ins><span class="cx">     : m_childProcessProxy(childProcessProxy)
</span><ins>+    , m_webContext(webContext)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_childProcessProxy);
</span><span class="cx">     m_childProcessProxy-&gt;addMessageReceiver(Messages::CustomProtocolManagerProxy::messageReceiverName(), *this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CustomProtocolManagerProxy::startLoading(uint64_t, const WebCore::ResourceRequest&amp;)
</del><ins>+void CustomProtocolManagerProxy::startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest&amp; request)
</ins><span class="cx"> {
</span><del>-    notImplemented();
</del><ins>+    m_webContext.supplement&lt;WebSoupCustomProtocolRequestManager&gt;()-&gt;startLoading(customProtocolID, request);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CustomProtocolManagerProxy::stopLoading(uint64_t)
</del><ins>+void CustomProtocolManagerProxy::stopLoading(uint64_t customProtocolID)
</ins><span class="cx"> {
</span><del>-    notImplemented();
</del><ins>+    m_webContext.supplement&lt;WebSoupCustomProtocolRequestManager&gt;()-&gt;stopLoading(customProtocolID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupWebSoupCustomProtocolRequestManagercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp (0 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -0,0 +1,148 @@
</span><ins>+/*
+ * 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 &quot;config.h&quot;
+#include &quot;WebSoupCustomProtocolRequestManager.h&quot;
+
+#if ENABLE(CUSTOM_PROTOCOLS)
+
+#include &quot;APIData.h&quot;
+#include &quot;CustomProtocolManagerMessages.h&quot;
+#include &quot;WebContext.h&quot;
+#include &lt;WebCore/ResourceError.h&gt;
+#include &lt;WebCore/ResourceRequest.h&gt;
+#include &lt;WebCore/ResourceResponse.h&gt;
+
+#if PLATFORM(GTK)
+#include &lt;WebCore/ErrorsGtk.h&gt;
+#endif
+
+namespace WebKit {
+
+const char* WebSoupCustomProtocolRequestManager::supplementName()
+{
+    return &quot;WebSoupCustomProtocolRequestManager&quot;;
+}
+
+PassRefPtr&lt;WebSoupCustomProtocolRequestManager&gt; WebSoupCustomProtocolRequestManager::create(WebContext* context)
+{
+    return adoptRef(new WebSoupCustomProtocolRequestManager(context));
+}
+
+WebSoupCustomProtocolRequestManager::WebSoupCustomProtocolRequestManager(WebContext* context)
+    : WebContextSupplement(context)
+{
+}
+
+WebSoupCustomProtocolRequestManager::~WebSoupCustomProtocolRequestManager()
+{
+}
+
+void WebSoupCustomProtocolRequestManager::initializeClient(const WKSoupCustomProtocolRequestManagerClientBase* client)
+{
+    m_client.initialize(client);
+}
+
+// WebContextSupplement
+void WebSoupCustomProtocolRequestManager::contextDestroyed()
+{
+}
+
+void WebSoupCustomProtocolRequestManager::processDidClose(WebProcessProxy*)
+{
+}
+
+void WebSoupCustomProtocolRequestManager::refWebContextSupplement()
+{
+    API::Object::ref();
+}
+
+void WebSoupCustomProtocolRequestManager::derefWebContextSupplement()
+{
+    API::Object::deref();
+}
+
+void WebSoupCustomProtocolRequestManager::registerSchemeForCustomProtocol(const String&amp; scheme)
+{
+    if (!context())
+        return;
+
+    context()-&gt;registerSchemeForCustomProtocol(scheme);
+
+    ASSERT(!m_registeredSchemes.contains(scheme));
+    m_registeredSchemes.append(scheme);
+}
+
+void WebSoupCustomProtocolRequestManager::unregisterSchemeForCustomProtocol(const String&amp; scheme)
+{
+    if (!context())
+        return;
+
+    context()-&gt;unregisterSchemeForCustomProtocol(scheme);
+
+    ASSERT(m_registeredSchemes.contains(scheme));
+    m_registeredSchemes.remove(m_registeredSchemes.find(scheme));
+}
+
+void WebSoupCustomProtocolRequestManager::startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest&amp; request)
+{
+    if (!m_client.startLoading(this, customProtocolID, request))
+        didFailWithError(customProtocolID, WebCore::cannotShowURLError(request));
+}
+
+void WebSoupCustomProtocolRequestManager::stopLoading(uint64_t customProtocolID)
+{
+    m_client.stopLoading(this, customProtocolID);
+}
+
+void WebSoupCustomProtocolRequestManager::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&amp; response)
+{
+    if (!context())
+        return;
+
+    context()-&gt;networkingProcessConnection()-&gt;send(Messages::CustomProtocolManager::DidReceiveResponse(customProtocolID, response, 0), 0);
+}
+
+void WebSoupCustomProtocolRequestManager::didLoadData(uint64_t customProtocolID, const API::Data* data)
+{
+    if (!context())
+        return;
+
+    context()-&gt;networkingProcessConnection()-&gt;send(Messages::CustomProtocolManager::DidLoadData(customProtocolID, data-&gt;dataReference()), 0);
+}
+
+void WebSoupCustomProtocolRequestManager::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&amp; error)
+{
+    if (!context())
+        return;
+
+    context()-&gt;networkingProcessConnection()-&gt;send(Messages::CustomProtocolManager::DidFailWithError(customProtocolID, error), 0);
+}
+
+void WebSoupCustomProtocolRequestManager::didFinishLoading(uint64_t customProtocolID)
+{
+    if (!context())
+        return;
+
+    context()-&gt;networkingProcessConnection()-&gt;send(Messages::CustomProtocolManager::DidFinishLoading(customProtocolID), 0);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(CUSTOM_PROTOCOLS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupWebSoupCustomProtocolRequestManagerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h (0 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -0,0 +1,88 @@
</span><ins>+/*
+ * 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.
+ */
+
+#ifndef WebSoupCustomProtocolRequestManager_h
+#define WebSoupCustomProtocolRequestManager_h
+
+#if ENABLE(CUSTOM_PROTOCOLS)
+
+#include &quot;APIObject.h&quot;
+#include &quot;WebContextSupplement.h&quot;
+#include &quot;WebSoupCustomProtocolRequestManagerClient.h&quot;
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace API {
+class Data;
+}
+
+namespace WebCore {
+class ResourceError;
+class ResourceRequest;
+class ResourceResponse;
+}
+
+namespace WebKit {
+
+class WebContext;
+
+class WebSoupCustomProtocolRequestManager : public API::ObjectImpl&lt;API::Object::Type::SoupCustomProtocolRequestManager&gt;, public WebContextSupplement {
+public:
+    static const char* supplementName();
+
+    static PassRefPtr&lt;WebSoupCustomProtocolRequestManager&gt; create(WebContext*);
+    virtual ~WebSoupCustomProtocolRequestManager();
+
+    void initializeClient(const WKSoupCustomProtocolRequestManagerClientBase*);
+
+    void registerSchemeForCustomProtocol(const String&amp; scheme);
+    void unregisterSchemeForCustomProtocol(const String&amp; scheme);
+
+    void startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest&amp;);
+    void stopLoading(uint64_t customProtocolID);
+
+    void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&amp;);
+    void didLoadData(uint64_t customProtocolID, const API::Data*);
+    void didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&amp;);
+    void didFinishLoading(uint64_t customProtocolID);
+
+    const Vector&lt;String&gt;&amp; registeredSchemesForCustomProtocols() const { return m_registeredSchemes; }
+
+    using API::Object::ref;
+    using API::Object::deref;
+
+private:
+    WebSoupCustomProtocolRequestManager(WebContext*);
+
+    // WebContextSupplement
+    virtual void contextDestroyed() OVERRIDE;
+    virtual void processDidClose(WebProcessProxy*) OVERRIDE;
+    virtual void refWebContextSupplement() OVERRIDE;
+    virtual void derefWebContextSupplement() OVERRIDE;
+
+    WebSoupCustomProtocolRequestManagerClient m_client;
+    Vector&lt;String&gt; m_registeredSchemes;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(CUSTOM_PROTOCOLS)
+
+#endif // WebSoupCustomProtocolRequestManager_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupWebSoupCustomProtocolRequestManagerClientcppfromrev162448trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupCustomProtocolManagerProxySoupcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp (from rev 162448, trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp) (0 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+/*
+ * 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 &quot;config.h&quot;
+#include &quot;WebSoupCustomProtocolRequestManagerClient.h&quot;
+
+#if ENABLE(CUSTOM_PROTOCOLS)
+
+namespace WebKit {
+
+bool WebSoupCustomProtocolRequestManagerClient::startLoading(WebSoupCustomProtocolRequestManager* soupRequestManager, uint64_t customProtocolID, const WebCore::ResourceRequest&amp; request)
+{
+    if (!m_client.startLoading)
+        return false;
+
+    RefPtr&lt;API::URLRequest&gt; urlRequest = API::URLRequest::create(request);
+    m_client.startLoading(toAPI(soupRequestManager), customProtocolID, toAPI(urlRequest.get()), m_client.base.clientInfo);
+    return true;
+}
+
+void WebSoupCustomProtocolRequestManagerClient::stopLoading(WebSoupCustomProtocolRequestManager* soupRequestManager, uint64_t customProtocolID)
+{
+    if (m_client.stopLoading)
+        m_client.stopLoading(toAPI(soupRequestManager), customProtocolID, m_client.base.clientInfo);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(CUSTOM_PROTOCOLS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupWebSoupCustomProtocolRequestManagerClienthfromrev162448trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupCustomProtocolManagerProxySoupcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h (from rev 162448, trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp) (0 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * 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.
+ */
+
+#ifndef WebSoupCustomProtocolRequestManagerClient_h
+#define WebSoupCustomProtocolRequestManagerClient_h
+
+#if ENABLE(CUSTOM_PROTOCOLS)
+
+#include &quot;APIClient.h&quot;
+#include &quot;WKAPICast.h&quot;
+#include &quot;WKSoupCustomProtocolRequestManager.h&quot;
+
+namespace API {
+
+template&lt;&gt; struct ClientTraits&lt;WKSoupCustomProtocolRequestManagerClientBase&gt; {
+    typedef std::tuple&lt;WKSoupCustomProtocolRequestManagerClientV0&gt; Versions;
+};
+}
+
+namespace WebCore {
+class ResourceRequest;
+}
+
+namespace WebKit {
+
+class WebSoupCustomProtocolRequestManager;
+
+class WebSoupCustomProtocolRequestManagerClient : public API::Client&lt;WKSoupCustomProtocolRequestManagerClientBase&gt; {
+public:
+    bool startLoading(WebSoupCustomProtocolRequestManager*, uint64_t customProtocolID, const WebCore::ResourceRequest&amp;);
+    void stopLoading(WebSoupCustomProtocolRequestManager*, uint64_t customProtocolID);
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(CUSTOM_PROTOCOLS)
+
+#endif // WebSoupCustomProtocolRequestManagerClient_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkNetworkProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx">     : m_webContext(webContext)
</span><span class="cx">     , m_numPendingConnectionRequests(0)
</span><span class="cx"> #if ENABLE(CUSTOM_PROTOCOLS)
</span><del>-    , m_customProtocolManagerProxy(this)
</del><ins>+    , m_customProtocolManagerProxy(this, webContext)
</ins><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx">     connect();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebContext.cpp        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -92,8 +92,12 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(SOUP)
</span><ins>+#if ENABLE(CUSTOM_PROTOCOLS)
+#include &quot;WebSoupCustomProtocolRequestManager.h&quot;
+#else
</ins><span class="cx"> #include &quot;WebSoupRequestManagerProxy.h&quot;
</span><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> #include &lt;wtf/RefCountedLeakCounter.h&gt;
</span><span class="lines">@@ -173,8 +177,12 @@
</span><span class="cx">     addSupplement&lt;WebDatabaseManagerProxy&gt;();
</span><span class="cx"> #endif
</span><span class="cx"> #if USE(SOUP)
</span><ins>+#if ENABLE(CUSTOM_PROTOCOLS)
+    addSupplement&lt;WebSoupCustomProtocolRequestManager&gt;();
+#else
</ins><span class="cx">     addSupplement&lt;WebSoupRequestManagerProxy&gt;();
</span><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> #if ENABLE(BATTERY_STATUS)
</span><span class="cx">     addSupplement&lt;WebBatteryManagerProxy&gt;();
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx"> #include &quot;ArgumentCodersGtk.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if USE(SOUP)
</del><ins>+#if USE(SOUP) &amp;&amp; !ENABLE(CUSTOM_PROTOCOLS)
</ins><span class="cx"> #include &quot;WebSoupRequestManagerProxy.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -4357,7 +4357,7 @@
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx"> 
</span><del>-#if USE(SOUP)
</del><ins>+#if USE(SOUP) &amp;&amp; !ENABLE(CUSTOM_PROTOCOLS)
</ins><span class="cx"> void WebPageProxy::didReceiveURIRequest(String uriString, uint64_t requestID)
</span><span class="cx"> {
</span><span class="cx">     m_process-&gt;context().supplement&lt;WebSoupRequestManagerProxy&gt;()-&gt;didReceiveURIRequest(uriString, this, requestID);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -1136,7 +1136,7 @@
</span><span class="cx">     void notifyRevealedSelection();
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span><del>-#if USE(SOUP)
</del><ins>+#if USE(SOUP) &amp;&amp; !ENABLE(CUSTOM_PROTOCOLS)
</ins><span class="cx">     void didReceiveURIRequest(String uriString, uint64_t requestID);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -321,9 +321,11 @@
</span><span class="cx">     LoadRecentSearches(String name) -&gt; (Vector&lt;String&gt; result)
</span><span class="cx"> 
</span><span class="cx"> #if USE(SOUP)
</span><ins>+#if !ENABLE(CUSTOM_PROTOCOLS)
</ins><span class="cx">     # Soup custom URI request messages
</span><span class="cx">     DidReceiveURIRequest(String uriString, uint64_t requestID);
</span><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     SavePDFToFileInDownloadsFolder(String suggestedFilename, String originatingURLString, IPC::DataReference data)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx">     , m_context(context)
</span><span class="cx">     , m_mayHaveUniversalFileReadSandboxExtension(false)
</span><span class="cx"> #if ENABLE(CUSTOM_PROTOCOLS)
</span><del>-    , m_customProtocolManagerProxy(this)
</del><ins>+    , m_customProtocolManagerProxy(this, context)
</ins><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     , m_processSuppressionEnabled(false)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessgtkWebContextGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx"> #include &quot;WebInspectorServer.h&quot;
</span><span class="cx"> #include &quot;WebProcessCreationParameters.h&quot;
</span><span class="cx"> #include &quot;WebProcessMessages.h&quot;
</span><del>-#include &quot;WebSoupRequestManagerProxy.h&quot;
</del><span class="cx"> #include &lt;WebCore/FileSystem.h&gt;
</span><span class="cx"> #include &lt;WebCore/NotImplemented.h&gt;
</span><span class="cx"> #include &lt;WebCore/SchemeRegistry.h&gt;
</span><span class="lines">@@ -44,6 +43,12 @@
</span><span class="cx"> #include &quot;NetworkProcessMessages.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(CUSTOM_PROTOCOLS)
+#include &quot;WebSoupCustomProtocolRequestManager.h&quot;
+#else
+#include &quot;WebSoupRequestManagerProxy.h&quot;
+#endif
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> static void initInspectorServer()
</span><span class="lines">@@ -99,7 +104,11 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!usesNetworkProcess()) {
</span><ins>+#if ENABLE(CUSTOM_PROTOCOLS)
+        parameters.urlSchemesRegisteredForCustomProtocols = supplement&lt;WebSoupCustomProtocolRequestManager&gt;()-&gt;registeredSchemesForCustomProtocols();
+#else
</ins><span class="cx">         parameters.urlSchemesRegistered = supplement&lt;WebSoupRequestManagerProxy&gt;()-&gt;registeredURISchemes();
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">         supplement&lt;WebCookieManagerProxy&gt;()-&gt;getCookiePersistentStorage(parameters.cookiePersistentStoragePath, parameters.cookiePersistentStorageType);
</span><span class="cx">         parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcesssoupWebContextSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;NetworkProcessCreationParameters.h&quot;
</span><span class="cx"> #include &quot;WebCookieManagerProxy.h&quot;
</span><ins>+#include &quot;WebSoupCustomProtocolRequestManager.h&quot;
</ins><span class="cx"> #include &lt;WebCore/Language.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -39,6 +40,9 @@
</span><span class="cx">     parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;
</span><span class="cx">     parameters.ignoreTLSErrors = m_ignoreTLSErrors;
</span><span class="cx">     parameters.languages = WebCore::userPreferredLanguages();
</span><ins>+#if ENABLE(CUSTOM_PROTOCOLS)
+    parameters.urlSchemesRegisteredForCustomProtocols = supplement&lt;WebSoupCustomProtocolRequestManager&gt;()-&gt;registeredSchemesForCustomProtocols();
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx"> #include &quot;WebResourceLoadScheduler.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if USE(SOUP)
</del><ins>+#if USE(SOUP) &amp;&amp; !ENABLE(CUSTOM_PROTOCOLS)
</ins><span class="cx"> #include &quot;WebSoupRequestManager.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -201,7 +201,7 @@
</span><span class="cx"> #if ENABLE(NETWORK_INFO)
</span><span class="cx">     addSupplement&lt;WebNetworkInfoManager&gt;();
</span><span class="cx"> #endif
</span><del>-#if USE(SOUP)
</del><ins>+#if USE(SOUP) &amp;&amp; !ENABLE(CUSTOM_PROTOCOLS)
</ins><span class="cx">     addSupplement&lt;WebSoupRequestManager&gt;();
</span><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesssoupWebKitSoupRequestGenericcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.cpp (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.cpp        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -20,9 +20,12 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;WebKitSoupRequestGeneric.h&quot;
</span><span class="cx"> 
</span><ins>+#include &lt;wtf/text/CString.h&gt;
+
+#if !ENABLE(CUSTOM_PROTOCOLS)
</ins><span class="cx"> #include &quot;WebProcess.h&quot;
</span><span class="cx"> #include &quot;WebSoupRequestManager.h&quot;
</span><del>-#include &lt;wtf/text/CString.h&gt;
</del><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> using namespace WebKit;
</span><span class="cx"> 
</span><span class="lines">@@ -48,13 +51,25 @@
</span><span class="cx"> 
</span><span class="cx"> static void webkitSoupRequestGenericSendAsync(SoupRequest* request, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer userData)
</span><span class="cx"> {
</span><ins>+#if ENABLE(CUSTOM_PROTOCOLS)
+    CustomProtocolManagerImpl* customProtocolManager = WEBKIT_SOUP_REQUEST_GENERIC_GET_CLASS(request)-&gt;customProtocolManager;
+    ASSERT(customProtocolManager);
+    customProtocolManager-&gt;send(g_task_new(request, cancellable, callback, userData));
+#else
</ins><span class="cx">     WebProcess::shared().supplement&lt;WebSoupRequestManager&gt;()-&gt;send(g_task_new(request, cancellable, callback, userData));
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static GInputStream* webkitSoupRequestGenericSendFinish(SoupRequest* request, GAsyncResult* result, GError** error)
</span><span class="cx"> {
</span><span class="cx">     g_return_val_if_fail(g_task_is_valid(result, request), 0);
</span><ins>+#if ENABLE(CUSTOM_PROTOCOLS)
+    CustomProtocolManagerImpl* customProtocolManager = WEBKIT_SOUP_REQUEST_GENERIC_GET_CLASS(request)-&gt;customProtocolManager;
+    ASSERT(customProtocolManager);
+    return customProtocolManager-&gt;finish(G_TASK(result), error);
+#else
</ins><span class="cx">     return WebProcess::shared().supplement&lt;WebSoupRequestManager&gt;()-&gt;finish(G_TASK(result), error);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static goffset webkitSoupRequestGenericGetContentLength(SoupRequest* request)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesssoupWebKitSoupRequestGenerich"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.h (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.h        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.h        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -23,6 +23,10 @@
</span><span class="cx"> #include &lt;glib-object.h&gt;
</span><span class="cx"> #include &lt;libsoup/soup.h&gt;
</span><span class="cx"> 
</span><ins>+#if ENABLE(CUSTOM_PROTOCOLS)
+#include &quot;CustomProtocolManagerImpl.h&quot;
+#endif
+
</ins><span class="cx"> G_BEGIN_DECLS
</span><span class="cx"> 
</span><span class="cx"> #define WEBKIT_TYPE_SOUP_REQUEST_GENERIC            (webkit_soup_request_generic_get_type())
</span><span class="lines">@@ -44,6 +48,10 @@
</span><span class="cx"> 
</span><span class="cx"> struct _WebKitSoupRequestGenericClass {
</span><span class="cx">     SoupRequestClass parent;
</span><ins>+
+#if ENABLE(CUSTOM_PROTOCOLS)
+    WebKit::CustomProtocolManagerImpl* customProtocolManager;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> GType webkit_soup_request_generic_get_type();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesssoupWebProcessSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp (162448 => 162449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp        2014-01-21 18:22:54 UTC (rev 162448)
+++ trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp        2014-01-21 18:30:18 UTC (rev 162449)
</span><span class="lines">@@ -34,7 +34,6 @@
</span><span class="cx"> #include &quot;CertificateInfo.h&quot;
</span><span class="cx"> #include &quot;WebCookieManager.h&quot;
</span><span class="cx"> #include &quot;WebProcessCreationParameters.h&quot;
</span><del>-#include &quot;WebSoupRequestManager.h&quot;
</del><span class="cx"> #include &lt;WebCore/FileSystem.h&gt;
</span><span class="cx"> #include &lt;WebCore/Language.h&gt;
</span><span class="cx"> #include &lt;WebCore/MemoryCache.h&gt;
</span><span class="lines">@@ -45,6 +44,10 @@
</span><span class="cx"> #include &lt;wtf/gobject/GOwnPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/gobject/GRefPtr.h&gt;
</span><span class="cx"> 
</span><ins>+#if !ENABLE(CUSTOM_PROTOCOLS)
+#include &quot;WebSoupRequestManager.h&quot;
+#endif
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> static uint64_t getCacheDiskFreeSize(SoupCache* cache)
</span><span class="lines">@@ -163,8 +166,10 @@
</span><span class="cx">     if (!parameters.languages.isEmpty())
</span><span class="cx">         setSoupSessionAcceptLanguage(parameters.languages);
</span><span class="cx"> 
</span><ins>+#if !ENABLE(CUSTOM_PROTOCOLS)
</ins><span class="cx">     for (size_t i = 0; i &lt; parameters.urlSchemesRegistered.size(); i++)
</span><span class="cx">         supplement&lt;WebSoupRequestManager&gt;()-&gt;registerURIScheme(parameters.urlSchemesRegistered[i]);
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     setIgnoreTLSErrors(parameters.ignoreTLSErrors);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>