<!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>[149711] trunk/Source/WebKit/blackberry</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/149711">149711</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2013-05-07 22:08:32 -0700 (Tue, 07 May 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Clean up load interface in WebPage
https://bugs.webkit.org/show_bug.cgi?id=115622
Patch by Xuefei Ren &lt;xren@blackberry.com&gt; on 2013-05-07
Reviewed by Rob Buis.

Internal PR:315535
Internal reviewed by  Mary Wu

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::load):
(BlackBerry::WebKit::WebPage::loadFile):
(BlackBerry::WebKit::WebPage::load):
* Api/WebPage.h:
* Api/WebPage_p.h:
(WebPagePrivate):
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::startDownload):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitblackberryApiWebPagecpp">trunk/Source/WebKit/blackberry/Api/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKitblackberryApiWebPageh">trunk/Source/WebKit/blackberry/Api/WebPage.h</a></li>
<li><a href="#trunkSourceWebKitblackberryApiWebPage_ph">trunk/Source/WebKit/blackberry/Api/WebPage_p.h</a></li>
<li><a href="#trunkSourceWebKitblackberryChangeLog">trunk/Source/WebKit/blackberry/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitblackberryWebCoreSupportFrameLoaderClientBlackBerrycpp">trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitblackberryApiWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (149710 => 149711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp        2013-05-08 03:18:12 UTC (rev 149710)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp        2013-05-08 05:08:32 UTC (rev 149711)
</span><span class="lines">@@ -671,12 +671,12 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-void WebPagePrivate::load(const BlackBerry::Platform::String&amp; url, const BlackBerry::Platform::String&amp; networkToken, const BlackBerry::Platform::String&amp; method, Platform::NetworkRequest::CachePolicy cachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally, bool needReferer, bool forceDownload, const BlackBerry::Platform::String&amp; overrideContentType, const BlackBerry::Platform::String&amp; suggestedSaveName)
</del><ins>+void WebPagePrivate::load(const Platform::NetworkRequest&amp; netReq, bool needReferer)
</ins><span class="cx"> {
</span><span class="cx">     stopCurrentLoad();
</span><span class="cx">     DeferredTaskLoadManualScript::finishOrCancel(this);
</span><span class="cx"> 
</span><del>-    String urlString(url);
</del><ins>+    String urlString(netReq.getUrlRef());
</ins><span class="cx">     if (urlString.startsWith(&quot;vs:&quot;, false)) {
</span><span class="cx">         urlString = urlString.substring(3);
</span><span class="cx">         m_mainFrame-&gt;setInViewSourceMode(true);
</span><span class="lines">@@ -693,31 +693,26 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (isInitial)
-        NetworkManager::instance()-&gt;setInitialURL(kurl);
-
</del><span class="cx">     ResourceRequest request(kurl);
</span><del>-    request.setToken(networkToken);
-    if (isInitial || mustHandleInternally)
-        request.setMustHandleInternally(true);
-    request.setHTTPMethod(method);
-    request.setCachePolicy(toWebCoreCachePolicy(cachePolicy));
-    if (!overrideContentType.empty())
-        request.setOverrideContentType(overrideContentType);
</del><ins>+    request.setHTTPMethod(netReq.getMethodRef());
+    request.setCachePolicy(toWebCoreCachePolicy(netReq.getCachePolicy()));
+    if (!netReq.getOverrideContentType().empty())
+        request.setOverrideContentType(netReq.getOverrideContentType());
</ins><span class="cx"> 
</span><del>-    if (data)
-        request.setHTTPBody(FormData::create(data, dataLength));
</del><ins>+    Platform::NetworkRequest::HeaderList&amp; list = netReq.getHeaderListRef();
+    if (!list.empty()) {
+        for (unsigned i = 0; i &lt; list.size(); i++)
+            request.addHTTPHeaderField(list[i].first.c_str(), list[i].second.c_str());
+    }
</ins><span class="cx"> 
</span><del>-    for (unsigned i = 0; i + 1 &lt; headersLength; i += 2)
-        request.addHTTPHeaderField(headers[i], headers[i + 1]);
</del><span class="cx">     if (needReferer &amp;&amp; focusedOrMainFrame() &amp;&amp; focusedOrMainFrame()-&gt;document())
</span><span class="cx">         request.addHTTPHeaderField(&quot;Referer&quot;, focusedOrMainFrame()-&gt;document()-&gt;url().string().utf8().data());
</span><span class="cx"> 
</span><del>-    if (forceDownload)
</del><ins>+    if (Platform::NetworkRequest::TargetIsDownload == netReq.getTargetType())
</ins><span class="cx">         request.setForceDownload(true);
</span><ins>+    if (!netReq.getSuggestedSaveName().empty())
+        request.setSuggestedSaveName(netReq.getSuggestedSaveName());
</ins><span class="cx"> 
</span><del>-    request.setSuggestedSaveName(suggestedSaveName);
-
</del><span class="cx">     m_mainFrame-&gt;loader()-&gt;load(FrameLoadRequest(m_mainFrame, request));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -729,18 +724,15 @@
</span><span class="cx">     else if (!fileUrl.startsWith(&quot;file:///&quot;))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    d-&gt;load(fileUrl, BlackBerry::Platform::String::emptyString(), BlackBerry::Platform::String(&quot;GET&quot;, 3), Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, false, false, false, false, overrideContentType.c_str());
</del><ins>+    Platform::NetworkRequest netRequest;
+    netRequest.setRequestUrl(path);
+    netRequest.setOverrideContentType(overrideContentType);
+    d-&gt;load(netRequest, false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::load(const Platform::NetworkRequest&amp; request, bool needReferer, bool forceDownload)
</del><ins>+void WebPage::load(const Platform::NetworkRequest&amp; request, bool needReferer)
</ins><span class="cx"> {
</span><del>-    vector&lt;const char*&gt; headers;
-    Platform::NetworkRequest::HeaderList&amp; list = request.getHeaderListRef();
-    for (unsigned i = 0; i &lt; list.size(); i++) {
-        headers.push_back(list[i].first.c_str());
-        headers.push_back(list[i].second.c_str());
-    }
-    d-&gt;load(request.getUrlRef(), BlackBerry::Platform::String::emptyString(), &quot;GET&quot;, Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, headers.empty() ? 0 : &amp;headers[0], headers.size(), false, false, needReferer, forceDownload, BlackBerry::Platform::String::emptyString(), request.getSuggestedSaveName());
</del><ins>+    d-&gt;load(request, needReferer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPagePrivate::loadString(const BlackBerry::Platform::String&amp; string, const BlackBerry::Platform::String&amp; baseURL, const BlackBerry::Platform::String&amp; contentType, const BlackBerry::Platform::String&amp; failingURL)
</span></span></pre></div>
<a id="trunkSourceWebKitblackberryApiWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/blackberry/Api/WebPage.h (149710 => 149711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/blackberry/Api/WebPage.h        2013-05-08 03:18:12 UTC (rev 149710)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.h        2013-05-08 05:08:32 UTC (rev 149711)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx"> 
</span><span class="cx">     void loadString(const BlackBerry::Platform::String&amp;, const BlackBerry::Platform::String&amp; baseURL, const BlackBerry::Platform::String&amp; contentType = &quot;text/html&quot;, const BlackBerry::Platform::String&amp; failingURL = BlackBerry::Platform::String::emptyString());
</span><span class="cx"> 
</span><del>-    void load(const Platform::NetworkRequest&amp;, bool needReferer = false, bool forceDownload = false);
</del><ins>+    void load(const Platform::NetworkRequest&amp;, bool needReferer = false);
</ins><span class="cx"> 
</span><span class="cx">     bool executeJavaScript(const BlackBerry::Platform::String&amp; script, JavaScriptDataType&amp; returnType, BlackBerry::Platform::String&amp; returnValue);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitblackberryApiWebPage_ph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (149710 => 149711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h        2013-05-08 03:18:12 UTC (rev 149710)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h        2013-05-08 05:08:32 UTC (rev 149711)
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx">     bool handleMouseEvent(WebCore::PlatformMouseEvent&amp;);
</span><span class="cx">     bool handleWheelEvent(WebCore::PlatformWheelEvent&amp;);
</span><span class="cx"> 
</span><del>-    void load(const BlackBerry::Platform::String&amp; url, const BlackBerry::Platform::String&amp; networkToken, const BlackBerry::Platform::String&amp; method, Platform::NetworkRequest::CachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally = false, bool needReferer = false, bool forceDownload = false, const BlackBerry::Platform::String&amp; overrideContentType = BlackBerry::Platform::String::emptyString(), const BlackBerry::Platform::String&amp; suggestedSaveName = BlackBerry::Platform::String::emptyString());
</del><ins>+    void load(const Platform::NetworkRequest&amp; platformRequest, bool needReferer = false);
</ins><span class="cx">     void loadString(const BlackBerry::Platform::String&amp;, const BlackBerry::Platform::String&amp; baseURL, const BlackBerry::Platform::String&amp; mimeType, const BlackBerry::Platform::String&amp; failingURL);
</span><span class="cx">     bool executeJavaScript(const BlackBerry::Platform::String&amp; script, JavaScriptDataType&amp; returnType, BlackBerry::Platform::String&amp; returnValue);
</span><span class="cx">     bool executeJavaScriptInIsolatedWorld(const WebCore::ScriptSourceCode&amp;, JavaScriptDataType&amp; returnType, BlackBerry::Platform::String&amp; returnValue);
</span></span></pre></div>
<a id="trunkSourceWebKitblackberryChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/blackberry/ChangeLog (149710 => 149711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/blackberry/ChangeLog        2013-05-08 03:18:12 UTC (rev 149710)
+++ trunk/Source/WebKit/blackberry/ChangeLog        2013-05-08 05:08:32 UTC (rev 149711)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2013-05-07  Xuefei Ren  &lt;xren@blackberry.com&gt;
+
+        Clean up load interface in WebPage
+        https://bugs.webkit.org/show_bug.cgi?id=115622
+        Reviewed by Rob Buis.
+
+        Internal PR:315535
+        Internal reviewed by  Mary Wu
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::load):
+        (BlackBerry::WebKit::WebPage::loadFile):
+        (BlackBerry::WebKit::WebPage::load):
+        * Api/WebPage.h:
+        * Api/WebPage_p.h:
+        (WebPagePrivate):
+        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+        (WebCore::FrameLoaderClientBlackBerry::startDownload):
+
</ins><span class="cx"> 2013-05-07  Mike Fenton  &lt;mifenton@rim.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [BlackBerry] Increase the padding size for caret based scrolling.
</span></span></pre></div>
<a id="trunkSourceWebKitblackberryWebCoreSupportFrameLoaderClientBlackBerrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (149710 => 149711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp        2013-05-08 03:18:12 UTC (rev 149710)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp        2013-05-08 05:08:32 UTC (rev 149711)
</span><span class="lines">@@ -1187,7 +1187,13 @@
</span><span class="cx"> 
</span><span class="cx"> void FrameLoaderClientBlackBerry::startDownload(const ResourceRequest&amp; request, const String&amp; suggestedName)
</span><span class="cx"> {
</span><del>-    m_webPagePrivate-&gt;load(request.url().string(), BlackBerry::Platform::String::emptyString(), &quot;GET&quot;, NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, false, false, true, &quot;&quot;, suggestedName);
</del><ins>+    if (suggestedName.empty())
+        m_webPagePrivate-&gt;m_mainFrame-&gt;loader()-&gt;load(FrameLoadRequest(m_webPagePrivate-&gt;m_mainFrame, request));
+    else {
+        ResourceRequest requestCopy = request;
+        requestCopy.setSuggestedSaveName(suggestedName);
+        m_webPagePrivate-&gt;m_mainFrame-&gt;loader()-&gt;load(FrameLoadRequest(m_webPagePrivate-&gt;m_mainFrame, requestCopy));
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameLoaderClientBlackBerry::convertMainResourceLoadToDownload(DocumentLoader* documentLoader, const ResourceRequest&amp; request, const ResourceResponse&amp; response)
</span></span></pre>
</div>
</div>

</body>
</html>