<!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>[153355] trunk/Source</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/153355">153355</a></dd>
<dt>Author</dt> <dd>kseo@webkit.org</dd>
<dt>Date</dt> <dd>2013-07-25 16:23:42 -0700 (Thu, 25 Jul 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WK2][Soup] Add private browsing support
https://bugs.webkit.org/show_bug.cgi?id=118657

Reviewed by Gustavo Noronha Silva.

Source/WebCore:

Support private browsing by adding a method to create a private
browsing soup session. This private browsing session uses a
non-persistent cookie jar and does not use the disk cache feature.

No new tests. Covered by existing private browsing tests.

* platform/network/NetworkStorageSession.h:
(WebCore::NetworkStorageSession::isPrivateBrowsingSession):
Add USE(SOUP) guard to isPrivateBrowsingSession() and m_isPrivate.

* platform/network/ResourceHandle.h:
Add a factory method to create a private browsing session for soup.

* platform/network/soup/CookieJarSoup.cpp:
(WebCore::createPrivateBrowsingCookieJar):
* platform/network/soup/CookieJarSoup.h:
Add a method to create a non-persistent cookie jar for private browsing.

* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::NetworkStorageSession):
Initialize m_isPrivate to false.
(WebCore::NetworkStorageSession::createPrivateBrowsingSession):
Implement the method by invoking ResourceHandle::createPrivateBrowsingSession.

* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::createSoupSession):
Extract common soup session creation code so that both defaultSession
and createPrivateBrowsingSession can use this function to create a soup
session.
(WebCore::ResourceHandle::defaultSession):
Change to use createSoupSession.
(WebCore::ResourceHandle::createPrivateBrowsingSession):
Create a session which uses a non-persistent cookie jar.

Source/WebKit2:

Support private browsing in WK2 by implementing private browsing
related methods in WebFrameNetworkingContext.

* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setPrivateBrowsingEnabled):
Add USE(SOUP) guard.

* WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
Add private browsing support methods. Copied from the Mac port.
(WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
(WebKit::WebFrameNetworkingContext::destroyPrivateBrowsingSession):
(WebKit::WebFrameNetworkingContext::storageSession):
Check if the frame enables private browsing and return the private
browsing session.
* WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensurePrivateBrowsingSession):
Add USE(SOUP) guard.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkNetworkStorageSessionh">trunk/Source/WebCore/platform/network/NetworkStorageSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleh">trunk/Source/WebCore/platform/network/ResourceHandle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupCookieJarSoupcpp">trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupCookieJarSouph">trunk/Source/WebCore/platform/network/soup/CookieJarSoup.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupNetworkStorageSessionSoupcpp">trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupResourceHandleSoupcpp">trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlecpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportsoupWebFrameNetworkingContextcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportsoupWebFrameNetworkingContexth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcesscpp">trunk/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (153354 => 153355)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-07-25 23:14:51 UTC (rev 153354)
+++ trunk/Source/WebCore/ChangeLog        2013-07-25 23:23:42 UTC (rev 153355)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2013-07-25  Kwang Yul Seo  &lt;skyul@company100.net&gt;
+
+        [WK2][Soup] Add private browsing support
+        https://bugs.webkit.org/show_bug.cgi?id=118657
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Support private browsing by adding a method to create a private
+        browsing soup session. This private browsing session uses a
+        non-persistent cookie jar and does not use the disk cache feature.
+
+        No new tests. Covered by existing private browsing tests.
+
+        * platform/network/NetworkStorageSession.h:
+        (WebCore::NetworkStorageSession::isPrivateBrowsingSession):
+        Add USE(SOUP) guard to isPrivateBrowsingSession() and m_isPrivate.
+
+        * platform/network/ResourceHandle.h:
+        Add a factory method to create a private browsing session for soup.
+
+        * platform/network/soup/CookieJarSoup.cpp:
+        (WebCore::createPrivateBrowsingCookieJar):
+        * platform/network/soup/CookieJarSoup.h:
+        Add a method to create a non-persistent cookie jar for private browsing.
+
+        * platform/network/soup/NetworkStorageSessionSoup.cpp:
+        (WebCore::NetworkStorageSession::NetworkStorageSession):
+        Initialize m_isPrivate to false.
+        (WebCore::NetworkStorageSession::createPrivateBrowsingSession):
+        Implement the method by invoking ResourceHandle::createPrivateBrowsingSession.
+
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::createSoupSession):
+        Extract common soup session creation code so that both defaultSession
+        and createPrivateBrowsingSession can use this function to create a soup
+        session.
+        (WebCore::ResourceHandle::defaultSession):
+        Change to use createSoupSession.
+        (WebCore::ResourceHandle::createPrivateBrowsingSession):
+        Create a session which uses a non-persistent cookie jar.
+
</ins><span class="cx"> 2013-07-25  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Null check m_frame in maximum and minimumScrollPosition
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkNetworkStorageSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (153354 => 153355)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h        2013-07-25 23:14:51 UTC (rev 153354)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h        2013-07-25 23:23:42 UTC (rev 153355)
</span><span class="lines">@@ -45,15 +45,18 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(NetworkStorageSession); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     static NetworkStorageSession&amp; defaultStorageSession();
</span><del>-    static PassOwnPtr&lt;NetworkStorageSession&gt; createPrivateBrowsingSession(const String&amp; identifierBase);
</del><ins>+    static PassOwnPtr&lt;NetworkStorageSession&gt; createPrivateBrowsingSession(const String&amp; identifierBase = String());
</ins><span class="cx"> 
</span><span class="cx">     static void switchToNewTestingSession();
</span><span class="cx"> 
</span><ins>+#if PLATFORM(MAC) || USE(CFNETWORK) || USE(SOUP)
+    bool isPrivateBrowsingSession() const { return m_isPrivate; }
+#endif
+
</ins><span class="cx"> #if PLATFORM(MAC) || USE(CFNETWORK)
</span><span class="cx">     // May be null, in which case a Foundation default should be used.
</span><span class="cx">     CFURLStorageSessionRef platformSession() { return m_platformSession.get(); }
</span><span class="cx">     RetainPtr&lt;CFHTTPCookieStorageRef&gt; cookieStorage() const;
</span><del>-    bool isPrivateBrowsingSession() const { return m_isPrivate; }
</del><span class="cx"> #elif USE(SOUP)
</span><span class="cx">     void setSoupSession(SoupSession* session) { m_session = session; }
</span><span class="cx">     SoupSession* soupSession() const { return m_session; }
</span><span class="lines">@@ -68,13 +71,16 @@
</span><span class="cx">     NetworkStorageSession(RetainPtr&lt;CFURLStorageSessionRef&gt;);
</span><span class="cx">     NetworkStorageSession();
</span><span class="cx">     RetainPtr&lt;CFURLStorageSessionRef&gt; m_platformSession;
</span><del>-    bool m_isPrivate;
</del><span class="cx"> #elif USE(SOUP)
</span><span class="cx">     NetworkStorageSession(SoupSession*);
</span><span class="cx">     SoupSession* m_session;
</span><span class="cx"> #else
</span><span class="cx">     RefPtr&lt;NetworkingContext&gt; m_context;
</span><span class="cx"> #endif
</span><ins>+
+#if PLATFORM(MAC) || USE(CFNETWORK) || USE(SOUP)
+    bool m_isPrivate;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(WIN) &amp;&amp; USE(CFNETWORK)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (153354 => 153355)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandle.h        2013-07-25 23:14:51 UTC (rev 153354)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h        2013-07-25 23:23:42 UTC (rev 153355)
</span><span class="lines">@@ -168,6 +168,7 @@
</span><span class="cx">     bool cancelledOrClientless();
</span><span class="cx">     void ensureReadBuffer();
</span><span class="cx">     static SoupSession* defaultSession();
</span><ins>+    static SoupSession* createPrivateBrowsingSession();
</ins><span class="cx">     static uint64_t getSoupRequestInitiatingPageID(SoupRequest*);
</span><span class="cx">     static void setHostAllowsAnyHTTPSCertificate(const String&amp;);
</span><span class="cx">     static void setClientCertificate(const String&amp; host, GTlsCertificate*);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupCookieJarSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp (153354 => 153355)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp        2013-07-25 23:14:51 UTC (rev 153354)
+++ trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp        2013-07-25 23:23:42 UTC (rev 153355)
</span><span class="lines">@@ -56,6 +56,15 @@
</span><span class="cx">     return jar;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+SoupCookieJar* createPrivateBrowsingCookieJar()
+{
+    SoupCookieJar* jar = soup_cookie_jar_new();
+
+    soup_cookie_jar_set_accept_policy(jar, SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY);
+
+    return jar;
+}
+
</ins><span class="cx"> void setSoupCookieJar(SoupCookieJar* jar)
</span><span class="cx"> {
</span><span class="cx">     defaultCookieJar() = jar;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupCookieJarSouph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/CookieJarSoup.h (153354 => 153355)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/CookieJarSoup.h        2013-07-25 23:14:51 UTC (rev 153354)
+++ trunk/Source/WebCore/platform/network/soup/CookieJarSoup.h        2013-07-25 23:23:42 UTC (rev 153355)
</span><span class="lines">@@ -34,6 +34,8 @@
</span><span class="cx"> SoupCookieJar* soupCookieJar();
</span><span class="cx"> void setSoupCookieJar(SoupCookieJar*);
</span><span class="cx"> 
</span><ins>+SoupCookieJar* createPrivateBrowsingCookieJar();
+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupNetworkStorageSessionSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp (153354 => 153355)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp        2013-07-25 23:14:51 UTC (rev 153354)
+++ trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp        2013-07-25 23:23:42 UTC (rev 153355)
</span><span class="lines">@@ -30,11 +30,13 @@
</span><span class="cx"> #include &quot;ResourceHandle.h&quot;
</span><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</span><span class="cx"> #include &lt;wtf/PassOwnPtr.h&gt;
</span><ins>+#include &lt;wtf/text/StringConcatenate.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> NetworkStorageSession::NetworkStorageSession(SoupSession* session)
</span><span class="cx">     : m_session(session)
</span><ins>+    , m_isPrivate(false)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -54,8 +56,10 @@
</span><span class="cx"> 
</span><span class="cx"> PassOwnPtr&lt;NetworkStorageSession&gt; NetworkStorageSession::createPrivateBrowsingSession(const String&amp;)
</span><span class="cx"> {
</span><del>-    ASSERT_NOT_REACHED();
-    return nullptr;
</del><ins>+    OwnPtr&lt;NetworkStorageSession&gt; session = adoptPtr(new NetworkStorageSession(ResourceHandle::createPrivateBrowsingSession()));
+    session-&gt;m_isPrivate = true;
+
+    return session.release();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkStorageSession::switchToNewTestingSession()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupResourceHandleSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (153354 => 153355)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp        2013-07-25 23:14:51 UTC (rev 153354)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp        2013-07-25 23:23:42 UTC (rev 153355)
</span><span class="lines">@@ -1366,9 +1366,8 @@
</span><span class="cx">     handle-&gt;didReceiveAuthenticationChallenge(AuthenticationChallenge(session, soupMessage, soupAuth, retrying, handle.get()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SoupSession* ResourceHandle::defaultSession()
</del><ins>+static SoupSession* createSoupSession()
</ins><span class="cx"> {
</span><del>-    static SoupSession* session = 0;
</del><span class="cx">     // Values taken from http://www.browserscope.org/  following
</span><span class="cx">     // the rule &quot;Do What Every Other Modern Browser Is Doing&quot;. They seem
</span><span class="cx">     // to significantly improve page loading time compared to soup's
</span><span class="lines">@@ -1376,26 +1375,37 @@
</span><span class="cx">     static const int maxConnections = 35;
</span><span class="cx">     static const int maxConnectionsPerHost = 6;
</span><span class="cx"> 
</span><del>-    if (!session) {
-        session = soup_session_async_new();
-        g_object_set(session,
-                     SOUP_SESSION_MAX_CONNS, maxConnections,
-                     SOUP_SESSION_MAX_CONNS_PER_HOST, maxConnectionsPerHost,
-                     SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_DECODER,
-                     SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_SNIFFER,
-                     SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
-                     SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
-                     NULL);
-        g_signal_connect(session, &quot;authenticate&quot;, G_CALLBACK(authenticateCallback), 0);
</del><ins>+    SoupSession* session = soup_session_async_new();
+    g_object_set(session,
+        SOUP_SESSION_MAX_CONNS, maxConnections,
+        SOUP_SESSION_MAX_CONNS_PER_HOST, maxConnectionsPerHost,
+        SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_DECODER,
+        SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_SNIFFER,
+        SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
+        SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
+        NULL);
+    g_signal_connect(session, &quot;authenticate&quot;, G_CALLBACK(authenticateCallback), 0);
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEB_TIMING)
</span><del>-        g_signal_connect(session, &quot;request-started&quot;, G_CALLBACK(requestStartedCallback), 0);
</del><ins>+    g_signal_connect(session, &quot;request-started&quot;, G_CALLBACK(requestStartedCallback), 0);
</ins><span class="cx"> #endif
</span><del>-    }
</del><span class="cx"> 
</span><span class="cx">     return session;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+SoupSession* ResourceHandle::defaultSession()
+{
+    static SoupSession* session = createSoupSession();
+    return session;
+}
+
+SoupSession* ResourceHandle::createPrivateBrowsingSession()
+{
+    SoupSession* session = createSoupSession();
+    soup_session_add_feature(session, SOUP_SESSION_FEATURE(createPrivateBrowsingCookieJar()));
+    return session;
+}
+
</ins><span class="cx"> uint64_t ResourceHandle::getSoupRequestInitiatingPageID(SoupRequest* request)
</span><span class="cx"> {
</span><span class="cx">     uint64_t* initiatingPageIDPtr = static_cast&lt;uint64_t*&gt;(g_object_get_data(G_OBJECT(request), gSoupRequestInitiatingPageIDKey));
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (153354 => 153355)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2013-07-25 23:14:51 UTC (rev 153354)
+++ trunk/Source/WebKit2/ChangeLog        2013-07-25 23:23:42 UTC (rev 153355)
</span><span class="lines">@@ -1,5 +1,32 @@
</span><span class="cx"> 2013-07-25  Kwang Yul Seo  &lt;skyul@company100.net&gt;
</span><span class="cx"> 
</span><ins>+        [WK2][Soup] Add private browsing support
+        https://bugs.webkit.org/show_bug.cgi?id=118657
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Support private browsing in WK2 by implementing private browsing
+        related methods in WebFrameNetworkingContext.
+
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
+        Add USE(SOUP) guard.
+
+        * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
+        Add private browsing support methods. Copied from the Mac port.
+        (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
+        (WebKit::WebFrameNetworkingContext::destroyPrivateBrowsingSession):
+        (WebKit::WebFrameNetworkingContext::storageSession):
+        Check if the frame enables private browsing and return the private
+        browsing session.
+        * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::ensurePrivateBrowsingSession):
+        Add USE(SOUP) guard.
+
+2013-07-25  Kwang Yul Seo  &lt;skyul@company100.net&gt;
+
</ins><span class="cx">         Build fix: use of long long in CoreIPC::ArgumentEncoder and CoreIPC::ArgumentDecoder
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=118228
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (153354 => 153355)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp        2013-07-25 23:14:51 UTC (rev 153354)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp        2013-07-25 23:23:42 UTC (rev 153355)
</span><span class="lines">@@ -304,7 +304,7 @@
</span><span class="cx"> void InjectedBundle::setPrivateBrowsingEnabled(WebPageGroupProxy* pageGroup, bool enabled)
</span><span class="cx"> {
</span><span class="cx">     // FIXME (NetworkProcess): This test-only function doesn't work with NetworkProcess, &lt;https://bugs.webkit.org/show_bug.cgi?id=115274&gt;.
</span><del>-#if PLATFORM(MAC) || USE(CFNETWORK)
</del><ins>+#if PLATFORM(MAC) || USE(CFNETWORK) || USE(SOUP)
</ins><span class="cx">     if (enabled)
</span><span class="cx">         WebFrameNetworkingContext::ensurePrivateBrowsingSession();
</span><span class="cx">     else
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportsoupWebFrameNetworkingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp (153354 => 153355)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp        2013-07-25 23:14:51 UTC (rev 153354)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp        2013-07-25 23:23:42 UTC (rev 153355)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2012 Igalia S.L.
</span><ins>+ * Copyright (C) 2013 Company 100 Inc.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -28,11 +29,32 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;WebFrame.h&quot;
</span><span class="cx"> #include &quot;WebPage.h&quot;
</span><ins>+#include &lt;WebCore/Settings.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><ins>+static NetworkStorageSession* privateSession;
+
+void WebFrameNetworkingContext::ensurePrivateBrowsingSession()
+{
+    ASSERT(isMainThread());
+
+    if (privateSession)
+        return;
+
+    privateSession = NetworkStorageSession::createPrivateBrowsingSession().leakPtr();
+}
+
+void WebFrameNetworkingContext::destroyPrivateBrowsingSession()
+{
+    ASSERT(isMainThread());
+
+    delete privateSession;
+    privateSession = 0;
+}
+
</ins><span class="cx"> WebFrameNetworkingContext::WebFrameNetworkingContext(WebFrame* frame)
</span><span class="cx">     : FrameNetworkingContext(frame-&gt;coreFrame())
</span><span class="cx">     , m_initiatingPageID(0)
</span><span class="lines">@@ -43,6 +65,9 @@
</span><span class="cx"> 
</span><span class="cx"> NetworkStorageSession&amp; WebFrameNetworkingContext::storageSession() const
</span><span class="cx"> {
</span><ins>+    if (frame() &amp;&amp; frame()-&gt;settings() &amp;&amp; frame()-&gt;settings()-&gt;privateBrowsingEnabled())
+        return *privateSession;
+
</ins><span class="cx">     return NetworkStorageSession::defaultStorageSession();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportsoupWebFrameNetworkingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h (153354 => 153355)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h        2013-07-25 23:14:51 UTC (rev 153354)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h        2013-07-25 23:23:42 UTC (rev 153355)
</span><span class="lines">@@ -41,6 +41,9 @@
</span><span class="cx">         return adoptRef(new WebFrameNetworkingContext(frame));
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    static void ensurePrivateBrowsingSession();
+    static void destroyPrivateBrowsingSession();
+
</ins><span class="cx"> private:
</span><span class="cx">     WebFrameNetworkingContext(WebFrame*);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (153354 => 153355)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2013-07-25 23:14:51 UTC (rev 153354)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2013-07-25 23:23:42 UTC (rev 153355)
</span><span class="lines">@@ -453,7 +453,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebProcess::ensurePrivateBrowsingSession()
</span><span class="cx"> {
</span><del>-#if PLATFORM(MAC) || USE(CFNETWORK)
</del><ins>+#if PLATFORM(MAC) || USE(CFNETWORK) || USE(SOUP)
</ins><span class="cx">     WebFrameNetworkingContext::ensurePrivateBrowsingSession();
</span><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>