Commit 810b5594 authored by tristan's avatar tristan
Browse files

* WebCoreSupport/WebFrameLoaderClient.mm:

        (WebFrameLoaderClient::download):
        asked the webframeloaderclient for its webview's history and
        injected the originated url into the created WebDownload



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21579 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9e87bdef
2007-05-18 Tristan O'Tierney <tristan@apple.com>
Reviewed by Brady E.
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::download):
asked the webframeloaderclient for its webview's history and
injected the originated url into the created WebDownload
2007-05-18 John Sullivan <sullivan@apple.com>
 
Reviewed by Kevin Decker
......
......@@ -100,6 +100,22 @@
using namespace WebCore;
// SPI for NSURLDownload
// Needed for <rdar://problem/5121850>
@interface NSURLDownload (NSURLDownloadPrivate)
- (void)_setOriginatingURL:(NSURL *)url;
- (NSURL *)_originatingURL;
@end
// FIXME: This is unnecessary after <rdar://problem/5208329>
@interface WebHistoryItem (WebHistoryItemPrivate)
- (BOOL)_wasUserGesture;
@end
@interface WebFramePolicyListener : NSObject <WebPolicyDecisionListener, WebFormSubmissionListener>
{
Frame* m_frame;
......@@ -236,11 +252,31 @@ void WebFrameLoaderClient::download(ResourceHandle* handle, const ResourceReques
{
id proxy = handle->releaseProxy();
ASSERT(proxy);
[WebDownload _downloadWithLoadingConnection:handle->connection()
request:request.nsURLRequest()
response:response.nsURLResponse()
delegate:[getWebView(m_webFrame.get()) downloadDelegate]
proxy:proxy];
WebView *webView = getWebView(m_webFrame.get());
WebDownload *download = [WebDownload _downloadWithLoadingConnection:handle->connection()
request:request.nsURLRequest()
response:response.nsURLResponse()
delegate:[webView downloadDelegate]
proxy:proxy];
NSURL *originalURL = nil;
WebBackForwardList *history = [webView backForwardList];
WebHistoryItem *currentItem = nil;
int backListCount = [history backListCount];
int backCount = 0;
// find the first item in the history that was originated
// by the user
while (backListCount > 0 && !originalURL) {
currentItem = [history itemAtIndex:backCount--];
if (![currentItem respondsToSelector:@selector(_wasUserGesture)] || [currentItem _wasUserGesture])
originalURL = [currentItem URL];
}
ASSERT(originalURL);
if ([download respondsToSelector:@selector(_setOriginatingURL:)])
[download _setOriginatingURL:originalURL];
}
bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader* loader, const ResourceRequest& request, const ResourceResponse& response, int length)
......
......@@ -1317,6 +1317,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
......@@ -1331,6 +1332,7 @@
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
projectRoot = "";
shouldCheckCompatibility = 1;
targets = (
9398100A0824BF01008DF038 /* WebKit */,
);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment