diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-14 02:59:35 -0700 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-14 05:09:11 -0700 |
commit | 64ffa33263f912a9747b9716f04e9cdcb0b857a9 (patch) | |
tree | 9df29fac0594b6f142a302b314ad73d35fb89b09 /CyteKit | |
parent | 0620c39394108145b0c3b729cafe7b2a7f0d5848 (diff) |
Add -[CyteWebViewDelegate webView:didCommitLoadForFrame:].
Diffstat (limited to 'CyteKit')
-rw-r--r-- | CyteKit/WebView.h | 1 | ||||
-rw-r--r-- | CyteKit/WebView.mm | 16 | ||||
-rw-r--r-- | CyteKit/WebViewController.mm | 9 |
3 files changed, 26 insertions, 0 deletions
diff --git a/CyteKit/WebView.h b/CyteKit/WebView.h index 0c96f6f..ba2043b 100644 --- a/CyteKit/WebView.h +++ b/CyteKit/WebView.h @@ -62,6 +62,7 @@ enum CYWebPolicyDecision { - (void) webView:(WebView *)view decidePolicyForNavigationAction:(NSDictionary *)action request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener; - (void) webView:(WebView *)view decidePolicyForNewWindowAction:(NSDictionary *)action request:(NSURLRequest *)request newFrameName:(NSString *)name decisionListener:(id<WebPolicyDecisionListener>)listener; - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view didCommitLoadForFrame:(WebFrame *)frame; - (void) webView:(WebView *)view didDecidePolicy:(CYWebPolicyDecision)decision forNavigationAction:(NSDictionary *)action request:(NSURLRequest *)request frame:(WebFrame *)frame; - (void) webView:(WebView *)view didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame; - (void) webView:(WebView *)view didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame; diff --git a/CyteKit/WebView.mm b/CyteKit/WebView.mm index dbd9129..1329d4f 100644 --- a/CyteKit/WebView.mm +++ b/CyteKit/WebView.mm @@ -198,6 +198,21 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW [super webView:view didClearWindowObject:window forFrame:frame]; } // }}} +// webView:didCommitLoadForFrame: (3.0+) {{{ +static void $UIWebViewWebViewDelegate$webView$didCommitLoadForFrame$(UIWebViewWebViewDelegate *self, SEL sel, WebView *view, WebFrame *frame) { + UIWebView *uiWebView(MSHookIvar<UIWebView *>(self, "uiWebView")); + if ([uiWebView respondsToSelector:@selector(webView:didCommitLoadForFrame:)]) + [uiWebView webView:view didCommitLoadForFrame:frame]; +} + +- (void) webView:(WebView *)view didCommitLoadForFrame:(WebFrame *)frame { + id<CyteWebViewDelegate> delegate([self delegate]); + if ([delegate respondsToSelector:@selector(webView:didCommitLoadForFrame:)]) + [delegate webView:view didCommitLoadForFrame:frame]; + if ([UIWebView instancesRespondToSelector:@selector(webView:didCommitLoadForFrame:)]) + [super webView:view didCommitLoadForFrame:frame]; +} +// }}} // webView:didFailLoadWithError:forFrame: (2.0+) {{{ - (void) webView:(WebView *)view didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { id<CyteWebViewDelegate> delegate([self delegate]); @@ -343,6 +358,7 @@ __attribute__((__constructor__)) static void $() { class_addMethod($UIWebViewWebViewDelegate, @selector(webView:addMessageToConsole:), (IMP) &$UIWebViewWebViewDelegate$webView$addMessageToConsole$, "v16@0:4@8@12"); class_addMethod($UIWebViewWebViewDelegate, @selector(webView:decidePolicyForNewWindowAction:request:newFrameName:decisionListener:), (IMP) &$UIWebViewWebViewDelegate$webView$decidePolicyForNewWindowAction$request$newFrameName$decisionListener$, "v28@0:4@8@12@16@20@24"); class_addMethod($UIWebViewWebViewDelegate, @selector(webView:didClearWindowObject:forFrame:), (IMP) &$UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$, "v20@0:4@8@12@16"); + class_addMethod($UIWebViewWebViewDelegate, @selector(webView:didCommitLoadForFrame:), (IMP) &$UIWebViewWebViewDelegate$webView$didCommitLoadForFrame$, "v16@0:4@8@12"); class_addMethod($UIWebViewWebViewDelegate, @selector(webView:didReceiveTitle:forFrame:), (IMP) &$UIWebViewWebViewDelegate$webView$didReceiveTitle$forFrame$, "v20@0:4@8@12@16"); class_addMethod($UIWebViewWebViewDelegate, @selector(webView:resource:willSendRequest:redirectResponse:fromDataSource:), (IMP) &$UIWebViewWebViewDelegate$webView$resource$willSendRequest$redirectResponse$fromDataSource$, "@28@0:4@8@12@16@20@24"); class_addMethod($UIWebViewWebViewDelegate, @selector(webViewClose:), (IMP) &$UIWebViewWebViewDelegate$webViewClose$, "v12@0:4@8"); diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm index 444e821..c36614c 100644 --- a/CyteKit/WebViewController.mm +++ b/CyteKit/WebViewController.mm @@ -464,6 +464,15 @@ float CYScrollViewDecelerationRateNormal; - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame { } +- (void) webView:(WebView *)view didCommitLoadForFrame:(WebFrame *)frame { +#if LogBrowser + NSLog(@"didCommitLoadForFrame:%@", frame); +#endif + + if ([frame parentFrame] == nil) { + } +} + - (void) webView:(WebView *)view didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { #if LogBrowser NSLog(@"didFailLoadWithError:%@ forFrame:%@", error, frame); |