Commit 252d3fe7 authored by mjs's avatar mjs
Browse files

Wrap content policy invocation to look asynchronous.

        * WebView.subproj/WebBaseResourceHandleDelegate.h:
        * WebView.subproj/WebMainResourceClient.m:
        (-[WebMainResourceClient continueAfterContentPolicy:response:]):
        (-[WebMainResourceClient checkContentPolicyForResponse:andCallSelector:]):
        (-[WebMainResourceClient handle:didReceiveResponse:]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 604b1965
2002-11-15 Maciej Stachowiak <mjs@apple.com>
Wrap content policy invocation to look asynchronous.
* WebView.subproj/WebBaseResourceHandleDelegate.h:
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient continueAfterContentPolicy:response:]):
(-[WebMainResourceClient checkContentPolicyForResponse:andCallSelector:]):
(-[WebMainResourceClient handle:didReceiveResponse:]):
2002-11-15 Maciej Stachowiak <mjs@apple.com>
 
Refactor so that all invocations of navigation policy are set up
......
2002-11-15 Maciej Stachowiak <mjs@apple.com>
Wrap content policy invocation to look asynchronous.
* WebView.subproj/WebBaseResourceHandleDelegate.h:
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient continueAfterContentPolicy:response:]):
(-[WebMainResourceClient checkContentPolicyForResponse:andCallSelector:]):
(-[WebMainResourceClient handle:didReceiveResponse:]):
2002-11-15 Maciej Stachowiak <mjs@apple.com>
 
Refactor so that all invocations of navigation policy are set up
......
......@@ -18,8 +18,8 @@
{
@protected
WebDataSource *dataSource;
@private
WebResourceHandle *handle;
@private
WebResourceRequest *request;
WebResourceResponse *response;
id identifier;
......
......@@ -18,8 +18,8 @@
{
@protected
WebDataSource *dataSource;
@private
WebResourceHandle *handle;
@private
WebResourceRequest *request;
WebResourceResponse *response;
id identifier;
......
......@@ -149,26 +149,14 @@ - (void)notifyDelegatesOfInterruptionByPolicyChange
[super notifyDelegatesOfInterruptionByPolicyChange];
}
-(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
-(void)continueAfterContentPolicy:(WebPolicyAction)contentPolicy response:(WebResourceResponse *)r
{
[dataSource _setResponse:r];
LOG(Download, "main content type: %@", [r contentType]);
WebPolicyAction contentPolicy;
if (!defersBeforeCheckingPolicy) {
[[dataSource controller] _setDefersCallbacks:NO];
}
WebResourceRequest *req = [dataSource request];
// Figure out the content policy.
if (![dataSource isDownloading]) {
contentPolicy = [[[dataSource controller] policyDelegate] contentPolicyForMIMEType:[r contentType]
andRequest:req
inFrame:[dataSource webFrame]];
} else {
contentPolicy = WebPolicySave;
}
switch (contentPolicy) {
case WebPolicyShow:
if (![WebController canShowMIMEType:[r contentType]]) {
......@@ -230,7 +218,37 @@ -(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
ERROR("contentPolicyForMIMEType:andRequest:inFrame: returned an invalid content policy.");
}
[super handle:h didReceiveResponse:r];
[super handle:handle didReceiveResponse:r];
}
-(void)checkContentPolicyForResponse:(WebResourceResponse *)r andCallSelector:(SEL)selector
{
WebPolicyAction contentPolicy =
[[[dataSource controller] policyDelegate] contentPolicyForMIMEType:[r contentType]
andRequest:[dataSource request]
inFrame:[dataSource webFrame]];
[self performSelector:selector withObject:(id)contentPolicy withObject:r];
}
-(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
{
[dataSource _setResponse:r];
LOG(Download, "main content type: %@", [r contentType]);
defersBeforeCheckingPolicy = [[dataSource controller] _defersCallbacks];
if (!defersBeforeCheckingPolicy) {
[[dataSource controller] _setDefersCallbacks:YES];
}
// Figure out the content policy.
if (![dataSource isDownloading]) {
[self checkContentPolicyForResponse:r andCallSelector:@selector(continueAfterContentPolicy:response:)];
} else {
[self continueAfterContentPolicy:WebPolicySave response:r];
}
_contentLength = [r contentLength];
}
......
......@@ -149,26 +149,14 @@ - (void)notifyDelegatesOfInterruptionByPolicyChange
[super notifyDelegatesOfInterruptionByPolicyChange];
}
-(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
-(void)continueAfterContentPolicy:(WebPolicyAction)contentPolicy response:(WebResourceResponse *)r
{
[dataSource _setResponse:r];
LOG(Download, "main content type: %@", [r contentType]);
WebPolicyAction contentPolicy;
if (!defersBeforeCheckingPolicy) {
[[dataSource controller] _setDefersCallbacks:NO];
}
WebResourceRequest *req = [dataSource request];
// Figure out the content policy.
if (![dataSource isDownloading]) {
contentPolicy = [[[dataSource controller] policyDelegate] contentPolicyForMIMEType:[r contentType]
andRequest:req
inFrame:[dataSource webFrame]];
} else {
contentPolicy = WebPolicySave;
}
switch (contentPolicy) {
case WebPolicyShow:
if (![WebController canShowMIMEType:[r contentType]]) {
......@@ -230,7 +218,37 @@ -(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
ERROR("contentPolicyForMIMEType:andRequest:inFrame: returned an invalid content policy.");
}
[super handle:h didReceiveResponse:r];
[super handle:handle didReceiveResponse:r];
}
-(void)checkContentPolicyForResponse:(WebResourceResponse *)r andCallSelector:(SEL)selector
{
WebPolicyAction contentPolicy =
[[[dataSource controller] policyDelegate] contentPolicyForMIMEType:[r contentType]
andRequest:[dataSource request]
inFrame:[dataSource webFrame]];
[self performSelector:selector withObject:(id)contentPolicy withObject:r];
}
-(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
{
[dataSource _setResponse:r];
LOG(Download, "main content type: %@", [r contentType]);
defersBeforeCheckingPolicy = [[dataSource controller] _defersCallbacks];
if (!defersBeforeCheckingPolicy) {
[[dataSource controller] _setDefersCallbacks:YES];
}
// Figure out the content policy.
if (![dataSource isDownloading]) {
[self checkContentPolicyForResponse:r andCallSelector:@selector(continueAfterContentPolicy:response:)];
} else {
[self continueAfterContentPolicy:WebPolicySave response:r];
}
_contentLength = [r contentLength];
}
......
Markdown is supported
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