+2006-10-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - move all WebFrameLoadDelegate methods across client interface
+
+ * Loader/WebFrameLoader.m:
+ (-[WebFrameLoader clientRedirectCancelledOrFinished:]):
+ (-[WebFrameLoader clientRedirectedTo:delay:fireDate:lockHistory:isJavaScriptFormAction:]):
+ (-[WebFrameLoader continueFragmentScrollAfterNavigationPolicy:formState:]):
+ (-[WebFrameLoader closeOldDataSources]):
+ (-[WebFrameLoader _notifyIconChanged:]):
+ (-[WebFrameLoader prepareForLoadStart]):
+ (-[WebFrameLoader didChangeTitleForDocument:]):
+ (-[WebFrameLoader transitionToCommitted:]):
+ (-[WebFrameLoader checkLoadCompleteForThisFrame]):
+ * Loader/WebFrameLoaderClient.h:
+ * WebView/WebFrame.m:
+ (-[WebFrame _dispatchDidCancelClientRedirectForFrame]):
+ (-[WebFrame _dispatchWillPerformClientRedirectToURL:delay:fireDate:]):
+ (-[WebFrame _dispatchDidChangeLocationWithinPageForFrame]):
+ (-[WebFrame _dispatchWillCloseFrame]):
+ (-[WebFrame _dispatchDidReceiveIcon:]):
+ (-[WebFrame _dispatchDidStartProvisionalLoadForFrame]):
+ (-[WebFrame _dispatchDidReceiveTitle:]):
+ (-[WebFrame _dispatchDidCommitLoadForFrame]):
+ (-[WebFrame _dispatchDidFailProvisionalLoadWithError:]):
+ (-[WebFrame _dispatchDidFailLoadWithError:]):
+ (-[WebFrame _dispatchDidFinishLoadForFrame]):
+
2006-10-08 Darin Adler <darin@apple.com>
Reviewed by Maciej.
#import <WebKitSystemInterface.h>
#import "WebDataSourceInternal.h"
-#import "WebDefaultUIDelegate.h"
#import "WebDocumentLoaderMac.h"
#import "WebFrameInternal.h"
-#import "WebFrameLoadDelegate.h"
#import "WebFrameViewInternal.h"
#import "WebHTMLView.h"
#import "WebIconDatabasePrivate.h"
#import "WebNSURLRequestExtras.h"
#import "WebResourcePrivate.h"
#import "WebScriptDebugServerPrivate.h"
-#import "WebUIDelegate.h"
#import "WebViewInternal.h"
@implementation WebFrameLoader
// Note that -webView:didCancelClientRedirectForFrame: is called on the frame load delegate even if
// the redirect succeeded. We should either rename this API, or add a new method, like
// -webView:didFinishClientRedirectForFrame:
- [[[client webView] _frameLoadDelegateForwarder] webView:[client webView]
- didCancelClientRedirectForFrame:client];
+ [client _dispatchDidCancelClientRedirectForFrame];
+
if (!cancelWithLoadInProgress)
quickRedirectComing = NO;
{
LOG(Redirect, "%@(%p) Client redirect to: %@, [self dataSource] = %p, lockHistory = %d, isJavaScriptFormAction = %d", [client name], self, URL, [self dataSource], (int)lockHistory, (int)isJavaScriptFormAction);
- [[[client webView] _frameLoadDelegateForwarder] webView:[client webView]
- willPerformClientRedirectToURL:URL
- delay:seconds
- fireDate:date
- forFrame:client];
+ [client _dispatchWillPerformClientRedirectToURL:URL delay:seconds fireDate:date];
// Remember that we sent a redirect notification to the frame load delegate so that when we commit
// the next provisional load, we can send a corresponding -webView:didCancelClientRedirectForFrame:
// we'll not go through a real load and reach Completed state
[self checkLoadComplete];
}
-
- [[[client webView] _frameLoadDelegateForwarder] webView:[client webView]
- didChangeLocationWithinPageForFrame:client];
-
+
+ [client _dispatchDidChangeLocationWithinPageForFrame];
[client _didFinishLoad];
}
[[(WebFrameBridge *)child frameLoader] closeOldDataSources];
if (documentLoader)
- [[[client webView] _frameLoadDelegateForwarder] webView:[client webView] willCloseFrame:client];
+ [client _dispatchWillCloseFrame];
+
[[client webView] setMainFrameDocumentReady:NO]; // stop giving out the actual DOMDocument to observers
}
NSImage *icon = [[WebIconDatabase sharedIconDatabase] iconForURL:[[[self activeDataSource] _URL] _web_originalDataAsString] withSize:WebIconSmallSize];
- [[[client webView] _frameLoadDelegateForwarder] webView:[client webView]
- didReceiveIcon:icon
- forFrame:client];
+ [client _dispatchDidReceiveIcon:icon];
[[client webView] _didChangeValueForKey:_WebMainFrameIconKey];
}
{
[[client webView] _progressStarted:client];
[[client webView] _didStartProvisionalLoadForFrame:client];
- [[[client webView] _frameLoadDelegateForwarder] webView:[client webView]
- didStartProvisionalLoadForFrame:client];
+ [client _dispatchDidStartProvisionalLoadForFrame];
}
- (BOOL)subframeIsLoading
// This must go through the WebFrame because it has the right notion of the current b/f item.
[client _setTitle:[loader title] forURL:URLForHistory];
[[client webView] setMainFrameDocumentReady:YES]; // update observers with new DOMDocument
- [[[client webView] _frameLoadDelegateForwarder] webView:[client webView]
- didReceiveTitle:[loader title] forFrame:client];
+
+ [client _dispatchDidReceiveTitle:[loader title]];
}
}
}
// Tell the client we've committed this URL.
ASSERT([[client frameView] documentView] != nil);
[[client webView] _didCommitLoadForFrame:client];
- [[[client webView] _frameLoadDelegateForwarder] webView:[client webView] didCommitLoadForFrame:client];
+ [client _dispatchDidCommitLoadForFrame];
// If we have a title let the WebView know about it.
if (ptitle)
- [[[client webView] _frameLoadDelegateForwarder] webView:[client webView]
- didReceiveTitle:ptitle
- forFrame:client];
+ [client _dispatchDidReceiveTitle:ptitle];
}
- (void)checkLoadCompleteForThisFrame
LOG(Loading, "%@: checking complete in WebFrameStateProvisional, load done", [client name]);
[[client webView] _didFailProvisionalLoadWithError:error forFrame:client];
delegateIsHandlingProvisionalLoadError = YES;
- [[[client webView] _frameLoadDelegateForwarder] webView:[client webView]
- didFailProvisionalLoadWithError:error
- forFrame:client];
+ [client _dispatchDidFailProvisionalLoadWithError:error];
+
delegateIsHandlingProvisionalLoadError = NO;
[[client _internalLoadDelegate] webFrame:client didFinishLoadWithError:error];
NSError *error = [ds _mainDocumentError];
if (error != nil) {
[[client webView] _didFailLoadWithError:error forFrame:client];
- [[[client webView] _frameLoadDelegateForwarder] webView:[client webView]
- didFailLoadWithError:error
- forFrame:client];
+ [client _dispatchDidFailLoadWithError:error];
[[client _internalLoadDelegate] webFrame:client didFinishLoadWithError:error];
} else {
[[client webView] _didFinishLoadForFrame:client];
- [[[client webView] _frameLoadDelegateForwarder] webView:[client webView]
- didFinishLoadForFrame:client];
+ [client _dispatchDidFinishLoadForFrame];
[[client _internalLoadDelegate] webFrame:client didFinishLoadWithError:nil];
}
- (void)_downloadWithLoadingConnection:(NSURLConnection *)connection request:(NSURLRequest *)request response:(NSURLResponse *)response proxy:(id)proxy;
-- (void)_dispatchDidHandleOnloadEventsForFrame;
-- (void)_dispatchDidReceiveServerRedirectForProvisionalLoadForFrame;
- (id)_dispatchIdentifierForInitialRequest:(NSURLRequest *)request fromDocumentLoader:(WebDocumentLoader *)loader;
- (NSURLRequest *)_dispatchResource:(id)identifier willSendRequest:(NSURLRequest *)clientRequest redirectResponse:(NSURLResponse *)redirectResponse fromDocumentLoader:(WebDocumentLoader *)loader;
- (void)_dispatchDidReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)currentWebChallenge forResource:(id)identifier fromDocumentLoader:(WebDocumentLoader *)loader;
- (void)_dispatchResource:(id)identifier didFinishLoadingFromDocumentLoader:(WebDocumentLoader *)loader;
- (void)_dispatchResource:(id)identifier didFailLoadingWithError:error fromDocumentLoader:(WebDocumentLoader *)loader;
+- (void)_dispatchDidHandleOnloadEventsForFrame;
+- (void)_dispatchDidReceiveServerRedirectForProvisionalLoadForFrame;
+- (void)_dispatchDidCancelClientRedirectForFrame;
+- (void)_dispatchWillPerformClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date;
+- (void)_dispatchDidChangeLocationWithinPageForFrame;
+- (void)_dispatchWillCloseFrame;
+- (void)_dispatchDidReceiveIcon:(NSImage *)icon;
+- (void)_dispatchDidStartProvisionalLoadForFrame;
+- (void)_dispatchDidReceiveTitle:(NSString *)title;
+- (void)_dispatchDidCommitLoadForFrame;
+- (void)_dispatchDidFailProvisionalLoadWithError:(NSError *)error;
+- (void)_dispatchDidFailLoadWithError:(NSError *)error;
+- (void)_dispatchDidFinishLoadForFrame;
+
+
@end
WebView *webView = [self webView];
[[webView _resourceLoadDelegateForwarder] webView:webView resource:identifier didFailLoadingWithError:error fromDataSource:dataSource(loader)];
}
-
+
+- (void)_dispatchDidCancelClientRedirectForFrame
+{
+ WebView *webView = [self webView];
+ [[webView _frameLoadDelegateForwarder] webView:webView didCancelClientRedirectForFrame:self];
+}
+
+- (void)_dispatchWillPerformClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date
+{
+ WebView *webView = [self webView];
+ [[webView _frameLoadDelegateForwarder] webView:webView
+ willPerformClientRedirectToURL:URL
+ delay:seconds
+ fireDate:date
+ forFrame:self];
+}
+
+- (void)_dispatchDidChangeLocationWithinPageForFrame
+{
+ WebView *webView = [self webView];
+ [[webView _frameLoadDelegateForwarder] webView:webView didChangeLocationWithinPageForFrame:self];
+}
+
+- (void)_dispatchWillCloseFrame
+{
+ WebView *webView = [self webView];
+ [[webView _frameLoadDelegateForwarder] webView:webView willCloseFrame:self];
+}
+
+- (void)_dispatchDidReceiveIcon:(NSImage *)icon
+{
+ WebView *webView = [self webView];
+ [[webView _frameLoadDelegateForwarder] webView:webView didReceiveIcon:icon forFrame:self];
+}
+
+- (void)_dispatchDidStartProvisionalLoadForFrame
+{
+ WebView *webView = [self webView];
+ [[webView _frameLoadDelegateForwarder] webView:webView didStartProvisionalLoadForFrame:self];
+}
+
+- (void)_dispatchDidReceiveTitle:(NSString *)title
+{
+ WebView *webView = [self webView];
+ [[webView _frameLoadDelegateForwarder] webView:webView didReceiveTitle:title forFrame:self];
+}
+
+- (void)_dispatchDidCommitLoadForFrame
+{
+ WebView *webView = [self webView];
+ [[webView _frameLoadDelegateForwarder] webView:webView didCommitLoadForFrame:self];
+}
+
+- (void)_dispatchDidFailProvisionalLoadWithError:(NSError *)error
+{
+ WebView *webView = [self webView];
+ [[webView _frameLoadDelegateForwarder] webView:webView didFailProvisionalLoadWithError:error forFrame:self];
+}
+
+- (void)_dispatchDidFailLoadWithError:(NSError *)error
+{
+ WebView *webView = [self webView];
+ [[webView _frameLoadDelegateForwarder] webView:webView didFailLoadWithError:error forFrame:self];
+}
+
+- (void)_dispatchDidFinishLoadForFrame
+{
+ WebView *webView = [self webView];
+ [[webView _frameLoadDelegateForwarder] webView:webView didFinishLoadForFrame:self];
+}
+
- (void)_detachedFromParent1
{
[self _saveScrollPositionAndViewStateToItem:_private->currentItem];