[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
cblu
cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:27:31 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 8ae06099a7b2a085370e204a22dca1cba8c32e72
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jul 26 00:56:24 2002 +0000
WebKit:
Made policy APIs return a WebPolicy object.
Added click policy.
* Misc.subproj/WebDownloadHandler.m:
(-[WebDownloadHandler receivedData:]):
(-[WebDownloadHandler finishedLoading]):
(-[WebDownloadHandler cancel]):
* WebKit.pbproj/project.pbxproj:
* WebView.subproj/WebController.h:
* WebView.subproj/WebController.m:
(+[WebController defaultURLPolicyForURL:]):
* WebView.subproj/WebControllerPolicyHandler.h:
* WebView.subproj/WebControllerPolicyHandler.m: Added.
(-[WebPolicy initWithPolicyAction:]):
(-[WebPolicy policyAction]):
(+[WebURLPolicy webPolicyWithURLAction:]):
(+[WebFileURLPolicy webPolicyWithFileAction:]):
(+[WebContentPolicy webPolicyWithContentAction:andPath:]):
(-[WebContentPolicy initWithContentPolicyAction:andPath:]):
(-[WebContentPolicy dealloc]):
(-[WebContentPolicy path]):
(-[WebClickPolicy initWithClickPolicyAction:andPath:]):
(+[WebClickPolicy webPolicyWithClickAction:andPath:]):
(-[WebClickPolicy dealloc]):
(-[WebClickPolicy path]):
* WebView.subproj/WebControllerPrivate.m:
(-[WebController _receivedError:forResourceHandle:partialProgress:fromDataSource:]):
* WebView.subproj/WebDataSource.h:
* WebView.subproj/WebDataSource.m:
(-[WebDataSource contentPolicy]):
(-[WebDataSource fileType]):
* WebView.subproj/WebDataSourcePrivate.h:
* WebView.subproj/WebDataSourcePrivate.m:
(-[WebDataSourcePrivate dealloc]):
(-[WebDataSource _setContentPolicy:]):
(-[WebDataSource _commitIfReady]):
(-[WebDataSource _isReadyForData]):
* WebView.subproj/WebDefaultPolicyHandler.m:
(-[WebDefaultPolicyHandler URLPolicyForURL:]):
(-[WebDefaultPolicyHandler fileURLPolicyForMIMEType:dataSource:isDirectory:]):
(-[WebDefaultPolicyHandler unableToImplementFileURLPolicy:error:forDataSource:]):
(-[WebDefaultPolicyHandler unableToImplementURLPolicy:error:forURL:]):
(-[WebDefaultPolicyHandler pluginNotFoundForMIMEType:pluginPageURL:]):
(-[WebDefaultPolicyHandler clickPolicyForElement:button:modifierMask:]):
* WebView.subproj/WebFrame.m:
(-[WebFrame initWithName:webView:provisionalDataSource:controller:]):
* WebView.subproj/WebFramePrivate.m:
(-[WebFrame _shouldShowDataSource:]):
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient receivedProgressWithHandle:complete:]):
(-[WebMainResourceClient receivedError:forHandle:]):
(-[WebMainResourceClient WebResourceHandleDidFinishLoading:data:]):
(-[WebMainResourceClient WebResourceHandle:dataDidBecomeAvailable:]):
WebBrowser:
Made policy APIs return a WebPolicy object.
* BrowserDocument.m:
(-[BrowserDocument _stopNonDownloadingDataSource:]):
(-[BrowserDocument _goToURL:withFrameLoadType:fallbackURLs:]):
* BrowserWebController.m:
(-[BrowserWebController URLPolicyForURL:]):
(-[BrowserWebController unableToImplementURLPolicy:error:forURL:]):
(-[BrowserWebController fileURLPolicyForMIMEType:dataSource:isDirectory:]):
(-[BrowserWebController unableToImplementFileURLPolicy:error:forDataSource:]):
(-[BrowserWebController contentPolicyForMIMEType:dataSource:]):
(-[BrowserWebController unableToImplementContentPolicy:error:forDataSource:]):
(-[BrowserWebController clickPolicyForElement:button:modifierMask:]):
* DownloadMonitor.m:
(-[DownloadMonitor _monitorDownload:withProgress:error:dataSource:complete:]):
* DownloadProgressEntry.m:
(+[DownloadProgressEntry entryWithResource:progress:error:dataSource:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1676 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index d58d792..72b0b44 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,59 @@
+2002-07-25 Chris Blumenberg <cblu at apple.com>
+
+ Made policy APIs return a WebPolicy object.
+ Added click policy.
+
+ * Misc.subproj/WebDownloadHandler.m:
+ (-[WebDownloadHandler receivedData:]):
+ (-[WebDownloadHandler finishedLoading]):
+ (-[WebDownloadHandler cancel]):
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/WebController.h:
+ * WebView.subproj/WebController.m:
+ (+[WebController defaultURLPolicyForURL:]):
+ * WebView.subproj/WebControllerPolicyHandler.h:
+ * WebView.subproj/WebControllerPolicyHandler.m: Added.
+ (-[WebPolicy initWithPolicyAction:]):
+ (-[WebPolicy policyAction]):
+ (+[WebURLPolicy webPolicyWithURLAction:]):
+ (+[WebFileURLPolicy webPolicyWithFileAction:]):
+ (+[WebContentPolicy webPolicyWithContentAction:andPath:]):
+ (-[WebContentPolicy initWithContentPolicyAction:andPath:]):
+ (-[WebContentPolicy dealloc]):
+ (-[WebContentPolicy path]):
+ (-[WebClickPolicy initWithClickPolicyAction:andPath:]):
+ (+[WebClickPolicy webPolicyWithClickAction:andPath:]):
+ (-[WebClickPolicy dealloc]):
+ (-[WebClickPolicy path]):
+ * WebView.subproj/WebControllerPrivate.m:
+ (-[WebController _receivedError:forResourceHandle:partialProgress:fromDataSource:]):
+ * WebView.subproj/WebDataSource.h:
+ * WebView.subproj/WebDataSource.m:
+ (-[WebDataSource contentPolicy]):
+ (-[WebDataSource fileType]):
+ * WebView.subproj/WebDataSourcePrivate.h:
+ * WebView.subproj/WebDataSourcePrivate.m:
+ (-[WebDataSourcePrivate dealloc]):
+ (-[WebDataSource _setContentPolicy:]):
+ (-[WebDataSource _commitIfReady]):
+ (-[WebDataSource _isReadyForData]):
+ * WebView.subproj/WebDefaultPolicyHandler.m:
+ (-[WebDefaultPolicyHandler URLPolicyForURL:]):
+ (-[WebDefaultPolicyHandler fileURLPolicyForMIMEType:dataSource:isDirectory:]):
+ (-[WebDefaultPolicyHandler unableToImplementFileURLPolicy:error:forDataSource:]):
+ (-[WebDefaultPolicyHandler unableToImplementURLPolicy:error:forURL:]):
+ (-[WebDefaultPolicyHandler pluginNotFoundForMIMEType:pluginPageURL:]):
+ (-[WebDefaultPolicyHandler clickPolicyForElement:button:modifierMask:]):
+ * WebView.subproj/WebFrame.m:
+ (-[WebFrame initWithName:webView:provisionalDataSource:controller:]):
+ * WebView.subproj/WebFramePrivate.m:
+ (-[WebFrame _shouldShowDataSource:]):
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient receivedProgressWithHandle:complete:]):
+ (-[WebMainResourceClient receivedError:forHandle:]):
+ (-[WebMainResourceClient WebResourceHandleDidFinishLoading:data:]):
+ (-[WebMainResourceClient WebResourceHandle:dataDidBecomeAvailable:]):
+
2002-07-25 Darin Adler <darin at apple.com>
* WebKit.pbproj/project.pbxproj: Add DeploymentFat build style.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index d58d792..72b0b44 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,59 @@
+2002-07-25 Chris Blumenberg <cblu at apple.com>
+
+ Made policy APIs return a WebPolicy object.
+ Added click policy.
+
+ * Misc.subproj/WebDownloadHandler.m:
+ (-[WebDownloadHandler receivedData:]):
+ (-[WebDownloadHandler finishedLoading]):
+ (-[WebDownloadHandler cancel]):
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/WebController.h:
+ * WebView.subproj/WebController.m:
+ (+[WebController defaultURLPolicyForURL:]):
+ * WebView.subproj/WebControllerPolicyHandler.h:
+ * WebView.subproj/WebControllerPolicyHandler.m: Added.
+ (-[WebPolicy initWithPolicyAction:]):
+ (-[WebPolicy policyAction]):
+ (+[WebURLPolicy webPolicyWithURLAction:]):
+ (+[WebFileURLPolicy webPolicyWithFileAction:]):
+ (+[WebContentPolicy webPolicyWithContentAction:andPath:]):
+ (-[WebContentPolicy initWithContentPolicyAction:andPath:]):
+ (-[WebContentPolicy dealloc]):
+ (-[WebContentPolicy path]):
+ (-[WebClickPolicy initWithClickPolicyAction:andPath:]):
+ (+[WebClickPolicy webPolicyWithClickAction:andPath:]):
+ (-[WebClickPolicy dealloc]):
+ (-[WebClickPolicy path]):
+ * WebView.subproj/WebControllerPrivate.m:
+ (-[WebController _receivedError:forResourceHandle:partialProgress:fromDataSource:]):
+ * WebView.subproj/WebDataSource.h:
+ * WebView.subproj/WebDataSource.m:
+ (-[WebDataSource contentPolicy]):
+ (-[WebDataSource fileType]):
+ * WebView.subproj/WebDataSourcePrivate.h:
+ * WebView.subproj/WebDataSourcePrivate.m:
+ (-[WebDataSourcePrivate dealloc]):
+ (-[WebDataSource _setContentPolicy:]):
+ (-[WebDataSource _commitIfReady]):
+ (-[WebDataSource _isReadyForData]):
+ * WebView.subproj/WebDefaultPolicyHandler.m:
+ (-[WebDefaultPolicyHandler URLPolicyForURL:]):
+ (-[WebDefaultPolicyHandler fileURLPolicyForMIMEType:dataSource:isDirectory:]):
+ (-[WebDefaultPolicyHandler unableToImplementFileURLPolicy:error:forDataSource:]):
+ (-[WebDefaultPolicyHandler unableToImplementURLPolicy:error:forURL:]):
+ (-[WebDefaultPolicyHandler pluginNotFoundForMIMEType:pluginPageURL:]):
+ (-[WebDefaultPolicyHandler clickPolicyForElement:button:modifierMask:]):
+ * WebView.subproj/WebFrame.m:
+ (-[WebFrame initWithName:webView:provisionalDataSource:controller:]):
+ * WebView.subproj/WebFramePrivate.m:
+ (-[WebFrame _shouldShowDataSource:]):
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient receivedProgressWithHandle:complete:]):
+ (-[WebMainResourceClient receivedError:forHandle:]):
+ (-[WebMainResourceClient WebResourceHandleDidFinishLoading:data:]):
+ (-[WebMainResourceClient WebResourceHandle:dataDidBecomeAvailable:]):
+
2002-07-25 Darin Adler <darin at apple.com>
* WebKit.pbproj/project.pbxproj: Add DeploymentFat build style.
diff --git a/WebKit/Misc.subproj/WebDownloadHandler.m b/WebKit/Misc.subproj/WebDownloadHandler.m
index 4d49ae9..fa0a8ef 100644
--- a/WebKit/Misc.subproj/WebDownloadHandler.m
+++ b/WebKit/Misc.subproj/WebDownloadHandler.m
@@ -31,7 +31,7 @@
- (void)receivedData:(NSData *)data
{
- NSString *path = [dataSource downloadPath];
+ NSString *path = [[dataSource contentPolicy] path];
NSString *pathWithoutExtension, *newPathWithoutExtension, *extension;
NSFileManager *fileManager;
NSWorkspace *workspace;
@@ -48,7 +48,7 @@
newPathWithoutExtension = [NSString stringWithFormat:@"%@-%d", pathWithoutExtension, i];
path = [newPathWithoutExtension stringByAppendingPathExtension:extension];
if(![fileManager fileExistsAtPath:path]){
- [dataSource _setDownloadPath:path];
+ //[dataSource _setDownloadPath:path];
break;
}
}
@@ -71,13 +71,13 @@
- (void)finishedLoading
{
- NSString *path = [dataSource downloadPath];
+ NSString *path = [[dataSource contentPolicy] path];
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
[fileHandle closeFile];
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Download complete. Saved to: %s", [path cString]);
- if([dataSource contentPolicy] == WebContentPolicySaveAndOpenExternally){
+ if([[dataSource contentPolicy] policyAction] == WebContentPolicySaveAndOpenExternally){
[workspace openFile:path];
}
}
@@ -86,7 +86,7 @@
{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
- NSString *path = [dataSource downloadPath];
+ NSString *path = [[dataSource contentPolicy] path];
[fileHandle closeFile];
[fileManager removeFileAtPath:path handler:nil];
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 514d23f..6827981 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -344,6 +344,7 @@
F5934C8B02E894F50197FBCF,
F649E40702EE0D1901CA2ACD,
354F260102EF441D0ACA2ACA,
+ 35E371B502F0BAC60ACA2ACA,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -720,6 +721,17 @@
settings = {
};
};
+ 35E371B402F0BAC60ACA2ACA = {
+ isa = PBXFileReference;
+ path = WebControllerPolicyHandler.m;
+ refType = 4;
+ };
+ 35E371B502F0BAC60ACA2ACA = {
+ fileRef = 35E371B402F0BAC60ACA2ACA;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
35F3577E0198AAB80ACA1520 = {
children = (
35F3577F0198AAB80ACA1520,
@@ -1071,6 +1083,7 @@
3944606F020F50ED0ECA1767,
39446064020F50ED0ECA1767,
F5927D4A02D253C401CA2DBB,
+ 35E371B402F0BAC60ACA2ACA,
39446065020F50ED0ECA1767,
39446066020F50ED0ECA1767,
39446070020F50ED0ECA1767,
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index f54c20a..8a5dd00 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -157,13 +157,13 @@
- (void)setContextMenuHandler: (id<WebContextMenuHandler>)handler;
- (id<WebContextMenuHandler>)contextMenuHandler;
-+ (WebURLPolicy)defaultURLPolicyForURL: (NSURL *)url;
+- (void)setLocationChangeHandler:(id <WebLocationChangeHandler>)handler;
+- (id <WebLocationChangeHandler>)locationChangeHandler;
- (void)setPolicyHandler: (id<WebControllerPolicyHandler>)handler;
- (id<WebControllerPolicyHandler>)policyHandler;
-- (void)setLocationChangeHandler:(id <WebLocationChangeHandler>)handler;
-- (id <WebLocationChangeHandler>)locationChangeHandler;
++ (WebURLPolicy *)defaultURLPolicyForURL: (NSURL *)url;
- (void)setDirectsAllLinksToSystemBrowser: (BOOL)flag;
- (BOOL)directsAllLinksToSystemBrowser;
@@ -188,13 +188,6 @@
// frame tree to find the view.
- (WebFrame *)frameForView: (WebView *)aView;
-// Typically called after requestContentPolicyForContentMIMEType: is sent to a
-// locationChangeHander. The content policy of HTML URLs should always be WebContentPolicyShow.
-// Setting the policy to WebContentPolicyIgnore will cancel the load of the URL if it is still
-// pending. The path argument is only used when the policy is either WebContentPolicySave or
-// WebContentPolicySaveAndOpenExternally.
-- (void)haveContentPolicy: (WebContentPolicy)policy andPath: (NSString *)path forDataSource: (WebDataSource *)dataSource;
-
// API to manage animated images.
- (void)stopAnimatedImages;
- (void)startAnimatedImages;
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index a1d1800..9303f9e 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -253,35 +253,12 @@
}
-+ (WebURLPolicy)defaultURLPolicyForURL: (NSURL *)url
++ (WebURLPolicy *)defaultURLPolicyForURL: (NSURL *)url
{
if([WebResourceHandle canInitWithURL:url]){
- return WebURLPolicyUseContentPolicy;
+ return [WebURLPolicy webPolicyWithURLAction:WebURLPolicyUseContentPolicy];
}else{
- return WebURLPolicyOpenExternally;
- }
-}
-
-
-- (void)haveContentPolicy: (WebContentPolicy)policy andPath: (NSString *)path forDataSource: (WebDataSource *)dataSource
-{
- if (policy == WebContentPolicyNone) {
- [NSException raise:NSInvalidArgumentException format:@"Can't set policy of WebContentPolicyNone. Use WebContentPolicyIgnore instead"];
- }
-
- if ([dataSource contentPolicy] != WebContentPolicyNone) {
- [NSException raise:NSGenericException format:@"Content policy can only be set once on for a dataSource."];
- }
-
- if (policy == WebContentPolicyShow &&
- ![[self class] canShowMIMEType:[dataSource contentType]]) {
-
- WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowMIMEType
- inDomain:WebErrorDomainWebKit failingURL:[[dataSource inputURL] absoluteString]];
- [[self policyHandler] unableToImplementContentPolicy:error forDataSource:dataSource];
- } else {
- [dataSource _setContentPolicy:policy];
- [dataSource _setDownloadPath:path];
+ return [WebURLPolicy webPolicyWithURLAction:WebURLPolicyOpenExternally];
}
}
diff --git a/WebKit/WebView.subproj/WebControllerPolicyDelegate.h b/WebKit/WebView.subproj/WebControllerPolicyDelegate.h
index 207a546..64ec1fa 100644
--- a/WebKit/WebView.subproj/WebControllerPolicyDelegate.h
+++ b/WebKit/WebView.subproj/WebControllerPolicyDelegate.h
@@ -7,24 +7,31 @@
#import <Cocoa/Cocoa.h>
-/*
- =============================================================================
+ at class WebDataSource;
+ at class WebError;
- =============================================================================
-*/
+typedef enum {
+ WebPolicyNone,
+ WebPolicyUse,
+ WebPolicyRevealInFinder,
+ WebPolicySave,
+ WebPolicyOpenURL,
+ WebPolicySaveAndOpen,
+ WebPolicyIgnore
+} WebPolicyAction;
typedef enum {
- WebURLPolicyUseContentPolicy,
- WebURLPolicyOpenExternally,
- WebURLPolicyIgnore
-} WebURLPolicy;
+ WebURLPolicyUseContentPolicy = WebPolicyUse,
+ WebURLPolicyOpenExternally = WebPolicyOpenURL,
+ WebURLPolicyIgnore = WebPolicyIgnore
+} WebURLAction;
typedef enum {
- WebFileURLPolicyUseContentPolicy,
- WebFileURLPolicyOpenExternally,
- WebFileURLPolicyReveal,
- WebFileURLPolicyIgnore
-} WebFileURLPolicy;
+ WebFileURLPolicyUseContentPolicy = WebPolicyUse,
+ WebFileURLPolicyOpenExternally = WebPolicyOpenURL,
+ WebFileURLPolicyRevealInFinder = WebPolicyRevealInFinder,
+ WebFileURLPolicyIgnore = WebPolicyIgnore
+} WebFileAction;
typedef enum {
WebContentPolicyNone,
@@ -32,7 +39,50 @@ typedef enum {
WebContentPolicySave,
WebContentPolicySaveAndOpenExternally,
WebContentPolicyIgnore
-} WebContentPolicy;
+} WebContentAction;
+
+typedef enum {
+ WebClickPolicyNone = WebPolicyNone,
+ WebClickPolicyShow,
+ WebClickPolicySave,
+ WebClickPolicySaveAndOpenExternally,
+ WebClickPolicyIgnore
+} WebClickAction;
+
+ at interface WebPolicy : NSObject
+{
+ WebPolicyAction policyAction;
+}
+- initWithPolicyAction: (WebPolicyAction)action;
+- (WebPolicyAction)policyAction;
+ at end
+
+ at interface WebURLPolicy : WebPolicy
++ webPolicyWithURLAction: (WebURLAction)action;
+ at end
+
+ at interface WebFileURLPolicy : WebPolicy
++ webPolicyWithFileAction: (WebFileAction)action;
+ at end
+
+ at interface WebContentPolicy : WebPolicy
+{
+ NSString *path;
+}
++ webPolicyWithContentAction: (WebContentAction)action andPath: (NSString *)thePath;
+- initWithContentPolicyAction: (WebContentAction)action andPath: (NSString *)thePath;
+- (NSString *)path;
+ at end
+
+ at interface WebClickPolicy : WebPolicy
+{
+ NSString *path;
+}
++ webPolicyWithClickAction: (WebClickAction)action andPath: (NSString *)thePath;
+- initWithClickPolicyAction: (WebClickAction)action andPath: (NSString *)thePath;
+- (NSString *)path;
+ at end
+
@protocol WebControllerPolicyHandler <NSObject>
@@ -40,28 +90,31 @@ typedef enum {
// before it is clicked or loaded via a URL bar. Clients can choose to handle the
// URL normally, hand the URL off to launch services, or
// ignore the URL. The default implementation could return +defaultURLPolicyForURL:.
-- (WebURLPolicy)URLPolicyForURL: (NSURL *)url;
+- (WebURLPolicy *)URLPolicyForURL: (NSURL *)url;
-// We may have different errors that cause the the policy to be un-implementable, i.e.
-// launch services failure, etc.
-- (void)unableToImplementURLPolicyForURL: (NSURL *)url error: (WebError *)error;
+// Sent after locationChangeStarted.
+// Implementations typically call haveContentPolicy:forLocationChangeHandler: on WebController
+// after determining the appropriate policy, perhaps by presenting a non-blocking dialog to the user.
+- (WebContentPolicy *)contentPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource;
// Called when the response to URLPolicyForURL is WebURLPolicyUseContentPolicy and the URL is
// a file URL. This allows clients to special-case WebKit's behavior for file URLs.
-- (WebFileURLPolicy)fileURLPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource isDirectory: (BOOL)isDirectory;
+- (WebFileURLPolicy *)fileURLPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource isDirectory: (BOOL)isDirectory;
+
+- (WebClickPolicy *)clickPolicyForElement: (NSDictionary *)elementInformation button: (NSEventType)eventType modifierMask: (unsigned int)eventMask;
+
+// We may have different errors that cause the the policy to be un-implementable, i.e.
+// launch services failure, etc.
+- (void)unableToImplementURLPolicy: (WebPolicy *)policy error: (WebError *)error forURL: (NSURL *)url;
// Called when a WebFileURLPolicy could not be completed. This is usually caused by files not
// existing or not readable.
-- (void)unableToImplementFileURLPolicy: (WebError *)error forDataSource: (WebDataSource *)dataSource;
+- (void)unableToImplementFileURLPolicy: (WebPolicy *)policy error: (WebError *)error forDataSource: (WebDataSource *)dataSource;
-// Sent after locationChangeStarted.
-// Implementations typically call haveContentPolicy:forLocationChangeHandler: on WebController
-// after determining the appropriate policy, perhaps by presenting a non-blocking dialog to the user.
-- (void)requestContentPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource;
// Sent when errors are encountered with an un-implementable policy, i.e.
// file i/o failure, launch services failure, type mismatches, etc.
-- (void)unableToImplementContentPolicy: (WebError *)error forDataSource: (WebDataSource *)dataSource;
+- (void)unableToImplementContentPolicy: (WebPolicy *)policy error: (WebError *)error forDataSource: (WebDataSource *)dataSource;
// Called when a plug-in for a certain mime type is not installed
- (void)pluginNotFoundForMIMEType:(NSString *)mime pluginPageURL:(NSURL *)url;
diff --git a/WebKit/WebView.subproj/WebControllerPolicyHandler.h b/WebKit/WebView.subproj/WebControllerPolicyHandler.h
index 207a546..64ec1fa 100644
--- a/WebKit/WebView.subproj/WebControllerPolicyHandler.h
+++ b/WebKit/WebView.subproj/WebControllerPolicyHandler.h
@@ -7,24 +7,31 @@
#import <Cocoa/Cocoa.h>
-/*
- =============================================================================
+ at class WebDataSource;
+ at class WebError;
- =============================================================================
-*/
+typedef enum {
+ WebPolicyNone,
+ WebPolicyUse,
+ WebPolicyRevealInFinder,
+ WebPolicySave,
+ WebPolicyOpenURL,
+ WebPolicySaveAndOpen,
+ WebPolicyIgnore
+} WebPolicyAction;
typedef enum {
- WebURLPolicyUseContentPolicy,
- WebURLPolicyOpenExternally,
- WebURLPolicyIgnore
-} WebURLPolicy;
+ WebURLPolicyUseContentPolicy = WebPolicyUse,
+ WebURLPolicyOpenExternally = WebPolicyOpenURL,
+ WebURLPolicyIgnore = WebPolicyIgnore
+} WebURLAction;
typedef enum {
- WebFileURLPolicyUseContentPolicy,
- WebFileURLPolicyOpenExternally,
- WebFileURLPolicyReveal,
- WebFileURLPolicyIgnore
-} WebFileURLPolicy;
+ WebFileURLPolicyUseContentPolicy = WebPolicyUse,
+ WebFileURLPolicyOpenExternally = WebPolicyOpenURL,
+ WebFileURLPolicyRevealInFinder = WebPolicyRevealInFinder,
+ WebFileURLPolicyIgnore = WebPolicyIgnore
+} WebFileAction;
typedef enum {
WebContentPolicyNone,
@@ -32,7 +39,50 @@ typedef enum {
WebContentPolicySave,
WebContentPolicySaveAndOpenExternally,
WebContentPolicyIgnore
-} WebContentPolicy;
+} WebContentAction;
+
+typedef enum {
+ WebClickPolicyNone = WebPolicyNone,
+ WebClickPolicyShow,
+ WebClickPolicySave,
+ WebClickPolicySaveAndOpenExternally,
+ WebClickPolicyIgnore
+} WebClickAction;
+
+ at interface WebPolicy : NSObject
+{
+ WebPolicyAction policyAction;
+}
+- initWithPolicyAction: (WebPolicyAction)action;
+- (WebPolicyAction)policyAction;
+ at end
+
+ at interface WebURLPolicy : WebPolicy
++ webPolicyWithURLAction: (WebURLAction)action;
+ at end
+
+ at interface WebFileURLPolicy : WebPolicy
++ webPolicyWithFileAction: (WebFileAction)action;
+ at end
+
+ at interface WebContentPolicy : WebPolicy
+{
+ NSString *path;
+}
++ webPolicyWithContentAction: (WebContentAction)action andPath: (NSString *)thePath;
+- initWithContentPolicyAction: (WebContentAction)action andPath: (NSString *)thePath;
+- (NSString *)path;
+ at end
+
+ at interface WebClickPolicy : WebPolicy
+{
+ NSString *path;
+}
++ webPolicyWithClickAction: (WebClickAction)action andPath: (NSString *)thePath;
+- initWithClickPolicyAction: (WebClickAction)action andPath: (NSString *)thePath;
+- (NSString *)path;
+ at end
+
@protocol WebControllerPolicyHandler <NSObject>
@@ -40,28 +90,31 @@ typedef enum {
// before it is clicked or loaded via a URL bar. Clients can choose to handle the
// URL normally, hand the URL off to launch services, or
// ignore the URL. The default implementation could return +defaultURLPolicyForURL:.
-- (WebURLPolicy)URLPolicyForURL: (NSURL *)url;
+- (WebURLPolicy *)URLPolicyForURL: (NSURL *)url;
-// We may have different errors that cause the the policy to be un-implementable, i.e.
-// launch services failure, etc.
-- (void)unableToImplementURLPolicyForURL: (NSURL *)url error: (WebError *)error;
+// Sent after locationChangeStarted.
+// Implementations typically call haveContentPolicy:forLocationChangeHandler: on WebController
+// after determining the appropriate policy, perhaps by presenting a non-blocking dialog to the user.
+- (WebContentPolicy *)contentPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource;
// Called when the response to URLPolicyForURL is WebURLPolicyUseContentPolicy and the URL is
// a file URL. This allows clients to special-case WebKit's behavior for file URLs.
-- (WebFileURLPolicy)fileURLPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource isDirectory: (BOOL)isDirectory;
+- (WebFileURLPolicy *)fileURLPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource isDirectory: (BOOL)isDirectory;
+
+- (WebClickPolicy *)clickPolicyForElement: (NSDictionary *)elementInformation button: (NSEventType)eventType modifierMask: (unsigned int)eventMask;
+
+// We may have different errors that cause the the policy to be un-implementable, i.e.
+// launch services failure, etc.
+- (void)unableToImplementURLPolicy: (WebPolicy *)policy error: (WebError *)error forURL: (NSURL *)url;
// Called when a WebFileURLPolicy could not be completed. This is usually caused by files not
// existing or not readable.
-- (void)unableToImplementFileURLPolicy: (WebError *)error forDataSource: (WebDataSource *)dataSource;
+- (void)unableToImplementFileURLPolicy: (WebPolicy *)policy error: (WebError *)error forDataSource: (WebDataSource *)dataSource;
-// Sent after locationChangeStarted.
-// Implementations typically call haveContentPolicy:forLocationChangeHandler: on WebController
-// after determining the appropriate policy, perhaps by presenting a non-blocking dialog to the user.
-- (void)requestContentPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource;
// Sent when errors are encountered with an un-implementable policy, i.e.
// file i/o failure, launch services failure, type mismatches, etc.
-- (void)unableToImplementContentPolicy: (WebError *)error forDataSource: (WebDataSource *)dataSource;
+- (void)unableToImplementContentPolicy: (WebPolicy *)policy error: (WebError *)error forDataSource: (WebDataSource *)dataSource;
// Called when a plug-in for a certain mime type is not installed
- (void)pluginNotFoundForMIMEType:(NSString *)mime pluginPageURL:(NSURL *)url;
diff --git a/WebKit/WebView.subproj/WebControllerPolicyHandler.m b/WebKit/WebView.subproj/WebControllerPolicyHandler.m
new file mode 100644
index 0000000..6696bf3
--- /dev/null
+++ b/WebKit/WebView.subproj/WebControllerPolicyHandler.m
@@ -0,0 +1,97 @@
+//
+// WebControllerPolicyHandler.m
+// WebKit
+//
+// Created by Christopher Blumenberg on Thu Jul 25 2002.
+// Copyright (c) 2002 __MyCompanyName__. All rights reserved.
+//
+
+#import <WebKit/WebControllerPolicyHandler.h>
+
+
+ at implementation WebPolicy : NSObject
+- initWithPolicyAction: (WebPolicyAction)action
+{
+ [super init];
+ policyAction = action;
+ return self;
+}
+
+- (WebPolicyAction)policyAction
+{
+ return policyAction;
+}
+
+ at end
+
+ at implementation WebURLPolicy : WebPolicy
+
++ webPolicyWithURLAction: (WebURLAction)action
+{
+ return [[[WebURLPolicy alloc] initWithPolicyAction:action] autorelease];
+}
+
+ at end
+
+ at implementation WebFileURLPolicy : WebPolicy
+
++ webPolicyWithFileAction: (WebFileAction)action
+{
+ return [[[WebURLPolicy alloc] initWithPolicyAction:action] autorelease];
+}
+
+ at end
+
+ at implementation WebContentPolicy : WebPolicy
+
++ webPolicyWithContentAction: (WebContentAction)action andPath: (NSString *)thePath
+{
+ return [[[WebContentPolicy alloc] initWithContentPolicyAction:action andPath:thePath] autorelease];
+}
+
+- initWithContentPolicyAction: (WebContentAction)action andPath: (NSString *)thePath
+{
+ [super initWithPolicyAction:action];
+ path = [thePath retain];
+ return self;
+}
+
+- (void)dealloc
+{
+ [path release];
+ [super dealloc];
+}
+
+- (NSString *)path
+{
+ return path;
+}
+
+ at end
+
+ at implementation WebClickPolicy : WebPolicy
+
+- initWithClickPolicyAction: (WebClickAction)action andPath: (NSString *)thePath
+{
+ [super initWithPolicyAction:action];
+ path = [thePath retain];
+ return self;
+}
+
++ webPolicyWithClickAction: (WebClickAction)action andPath: (NSString *)thePath
+{
+ return [[[WebClickPolicy alloc] initWithClickPolicyAction:action andPath:thePath] autorelease];
+}
+
+- (void)dealloc
+{
+ [path release];
+ [super dealloc];
+}
+
+- (NSString *)path
+{
+ return path;
+}
+
+ at end
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index 7d1331e..88b87a3 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -131,7 +131,7 @@
[[self resourceProgressHandler] receivedError: error forResourceHandle: resourceHandle partialProgress: progress fromDataSource: dataSource];
[dataSource _addError: error forResource:
- (resourceHandle != nil ? [[resourceHandle url] absoluteString] : [error failingURL])];
+ (resourceHandle != nil ? [[resourceHandle url] absoluteString] : [[resourceHandle url] absoluteString])];
[frame _checkLoadComplete];
}
diff --git a/WebKit/WebView.subproj/WebDataSource.h b/WebKit/WebView.subproj/WebDataSource.h
index 1e38a1c..9257e65 100644
--- a/WebKit/WebView.subproj/WebDataSource.h
+++ b/WebKit/WebView.subproj/WebDataSource.h
@@ -157,7 +157,7 @@
- (NSString *)frameName;
-- (WebContentPolicy)contentPolicy;
+- (WebContentPolicy *)contentPolicy;
// MIME type
- (NSString *)contentType;
@@ -165,8 +165,6 @@
// extension based on the MIME type
- (NSString *)fileType;
-- (NSString *)downloadPath;
-
- (NSDictionary *)errors;
- (WebError *)mainDocumentError;
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index 2e01789..5eeda62 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -325,7 +325,7 @@
return _private->pageTitle;
}
-- (WebContentPolicy) contentPolicy
+- (WebContentPolicy *) contentPolicy
{
return _private->contentPolicy;
}
@@ -340,11 +340,6 @@
return [[WebFileTypeMappings sharedMappings] preferredExtensionForMIMEType:[self contentType]];
}
-- (NSString *)downloadPath
-{
- return _private->downloadPath;
-}
-
- (NSDictionary *)errors
{
return _private->errors;
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index 46e261d..38c4327 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -53,8 +53,12 @@
BOOL primaryLoadComplete;
BOOL stopping;
+
+ NSString *pageTitle;
- NSString *pageTitle, *downloadPath, *encoding, *contentType;
+ NSString *encoding;
+
+ NSString *contentType;
// Errors associated with resources.
NSMutableDictionary *errors;
@@ -62,7 +66,7 @@
// Error associated with main document.
WebError *mainDocumentError;
- WebContentPolicy contentPolicy;
+ WebContentPolicy *contentPolicy;
BOOL loading; // self and controller are retained while loading
@@ -99,8 +103,7 @@
- (void)_setTitle: (NSString *)title;
- (void)_setFinalURL: (NSURL *)url;
- (id <WebLocationChangeHandler>)_locationChangeHandler;
-- (void)_setDownloadPath:(NSString *)path;
-- (void)_setContentPolicy:(WebContentPolicy)policy;
+- (void)_setContentPolicy:(WebContentPolicy *)policy;
- (void)_setContentType:(NSString *)type;
- (void)_setEncoding:(NSString *)encoding;
- (void)_layoutChildren;
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 41d4df8..f719c93 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -67,7 +67,6 @@
[mainResourceHandleClient release];
[urlHandles release];
[pageTitle release];
- [downloadPath release];
[encoding release];
[contentType release];
[errors release];
@@ -308,15 +307,10 @@
return [_private->controller locationChangeHandler];
}
-- (void)_setDownloadPath:(NSString *)path
+- (void) _setContentPolicy:(WebContentPolicy *)policy
{
- [_private->downloadPath release];
- _private->downloadPath = [path retain];
-}
-
-- (void) _setContentPolicy:(WebContentPolicy)policy
-{
- _private->contentPolicy = policy;
+ [_private->contentPolicy release];
+ _private->contentPolicy = [policy retain];
[self _commitIfReady];
}
@@ -418,7 +412,7 @@
-(void)_commitIfReady
{
- if (_private->contentPolicy == WebContentPolicyShow && _private->gotFirstByte && !_private->committed) {
+ if ([[self contentPolicy] policyAction] == WebContentPolicyShow && _private->gotFirstByte && !_private->committed) {
WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "committed resource = %s\n", [[[self inputURL] absoluteString] cString]);
_private->committed = TRUE;
[self _makeRepresentation];
@@ -448,8 +442,8 @@
// determined, and if the policy is show, if it has been committed
// (so that we know it's representation and such are ready).
- return _private->contentPolicy != WebContentPolicyNone &&
- (_private->committed || _private->contentPolicy != WebContentPolicyShow);
+ return [[self contentPolicy] policyAction] != WebContentPolicyNone &&
+ (_private->committed || [[self contentPolicy] policyAction] != WebContentPolicyShow);
}
-(void)_receivedData:(NSData *)data
diff --git a/WebKit/WebView.subproj/WebDefaultPolicyDelegate.m b/WebKit/WebView.subproj/WebDefaultPolicyDelegate.m
index 469e12d..cc262e6 100644
--- a/WebKit/WebView.subproj/WebDefaultPolicyDelegate.m
+++ b/WebKit/WebView.subproj/WebDefaultPolicyDelegate.m
@@ -18,42 +18,42 @@
return self;
}
-- (WebURLPolicy)URLPolicyForURL: (NSURL *)url
+- (WebURLPolicy *)URLPolicyForURL: (NSURL *)url
{
return [WebController defaultURLPolicyForURL: url];
}
-- (WebFileURLPolicy)fileURLPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource isDirectory:(BOOL)isDirectory
+- (WebFileURLPolicy *)fileURLPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource isDirectory:(BOOL)isDirectory
{
if(isDirectory)
- return WebFileURLPolicyIgnore;
+ return [WebFileURLPolicy webPolicyWithFileAction:WebFileURLPolicyIgnore];
if([WebController canShowMIMEType:type])
- return WebFileURLPolicyUseContentPolicy;
- return WebFileURLPolicyIgnore;
+ return [WebFileURLPolicy webPolicyWithFileAction:WebFileURLPolicyUseContentPolicy];
+ return [WebFileURLPolicy webPolicyWithFileAction:WebFileURLPolicyIgnore];;
}
-- (void)unableToImplementFileURLPolicy: (WebError *)error forDataSource: (WebDataSource *)dataSource
+- (void)unableToImplementFileURLPolicy: (WebPolicy *)policy error: (WebError *)error forDataSource: (WebDataSource *)dataSource
{
NSLog (@"unableToImplementFileURLPolicy:forDataSource: - error %@\n", error);
}
-- (void)requestContentPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource
+- (WebContentPolicy *)contentPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource;
{
if([WebController canShowMIMEType:type]){
- [webController haveContentPolicy:WebContentPolicyShow andPath:nil forDataSource:dataSource];
+ return [WebContentPolicy webPolicyWithContentAction: WebContentPolicyShow andPath:nil];
}
else{
- [webController haveContentPolicy:WebContentPolicyIgnore andPath:nil forDataSource:dataSource];
+ return [WebContentPolicy webPolicyWithContentAction: WebContentPolicyIgnore andPath:nil];
}
}
-- (void)unableToImplementURLPolicyForURL: (NSURL *)url error: (WebError *)error
+- (void)unableToImplementURLPolicy: (WebPolicy *)policy error: (WebError *)error forURL: (NSURL *)url
{
NSLog (@"unableToImplementURLPolicyForURL:error: - URL %@, error %@\n", url, error);
}
-- (void)unableToImplementContentPolicy: (WebError *)error forDataSource: (WebDataSource *)dataSource
+- (void)unableToImplementContentPolicy: (WebPolicy *)policy error: (WebError *)error forDataSource: (WebDataSource *)dataSource;
{
NSLog (@"unableToImplementContentPolicy:forDataSource: - error %@\n", error);
}
@@ -63,5 +63,10 @@
NSLog (@"pluginNotFoundForMIMEType:pluginPageURL: - MIME %@, URL \n", mime, url);
}
+- (WebClickPolicy *)clickPolicyForElement: (NSDictionary *)elementInformation button: (NSEventType)eventType modifierMask: (unsigned int)eventMask
+{
+ return [WebClickPolicy webPolicyWithClickAction:WebClickPolicyShow andPath:nil];
+}
+
@end
diff --git a/WebKit/WebView.subproj/WebDefaultPolicyHandler.m b/WebKit/WebView.subproj/WebDefaultPolicyHandler.m
index 469e12d..cc262e6 100644
--- a/WebKit/WebView.subproj/WebDefaultPolicyHandler.m
+++ b/WebKit/WebView.subproj/WebDefaultPolicyHandler.m
@@ -18,42 +18,42 @@
return self;
}
-- (WebURLPolicy)URLPolicyForURL: (NSURL *)url
+- (WebURLPolicy *)URLPolicyForURL: (NSURL *)url
{
return [WebController defaultURLPolicyForURL: url];
}
-- (WebFileURLPolicy)fileURLPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource isDirectory:(BOOL)isDirectory
+- (WebFileURLPolicy *)fileURLPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource isDirectory:(BOOL)isDirectory
{
if(isDirectory)
- return WebFileURLPolicyIgnore;
+ return [WebFileURLPolicy webPolicyWithFileAction:WebFileURLPolicyIgnore];
if([WebController canShowMIMEType:type])
- return WebFileURLPolicyUseContentPolicy;
- return WebFileURLPolicyIgnore;
+ return [WebFileURLPolicy webPolicyWithFileAction:WebFileURLPolicyUseContentPolicy];
+ return [WebFileURLPolicy webPolicyWithFileAction:WebFileURLPolicyIgnore];;
}
-- (void)unableToImplementFileURLPolicy: (WebError *)error forDataSource: (WebDataSource *)dataSource
+- (void)unableToImplementFileURLPolicy: (WebPolicy *)policy error: (WebError *)error forDataSource: (WebDataSource *)dataSource
{
NSLog (@"unableToImplementFileURLPolicy:forDataSource: - error %@\n", error);
}
-- (void)requestContentPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource
+- (WebContentPolicy *)contentPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource;
{
if([WebController canShowMIMEType:type]){
- [webController haveContentPolicy:WebContentPolicyShow andPath:nil forDataSource:dataSource];
+ return [WebContentPolicy webPolicyWithContentAction: WebContentPolicyShow andPath:nil];
}
else{
- [webController haveContentPolicy:WebContentPolicyIgnore andPath:nil forDataSource:dataSource];
+ return [WebContentPolicy webPolicyWithContentAction: WebContentPolicyIgnore andPath:nil];
}
}
-- (void)unableToImplementURLPolicyForURL: (NSURL *)url error: (WebError *)error
+- (void)unableToImplementURLPolicy: (WebPolicy *)policy error: (WebError *)error forURL: (NSURL *)url
{
NSLog (@"unableToImplementURLPolicyForURL:error: - URL %@, error %@\n", url, error);
}
-- (void)unableToImplementContentPolicy: (WebError *)error forDataSource: (WebDataSource *)dataSource
+- (void)unableToImplementContentPolicy: (WebPolicy *)policy error: (WebError *)error forDataSource: (WebDataSource *)dataSource;
{
NSLog (@"unableToImplementContentPolicy:forDataSource: - error %@\n", error);
}
@@ -63,5 +63,10 @@
NSLog (@"pluginNotFoundForMIMEType:pluginPageURL: - MIME %@, URL \n", mime, url);
}
+- (WebClickPolicy *)clickPolicyForElement: (NSDictionary *)elementInformation button: (NSEventType)eventType modifierMask: (unsigned int)eventMask
+{
+ return [WebClickPolicy webPolicyWithClickAction:WebClickPolicyShow andPath:nil];
+}
+
@end
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index 0526c04..0e0776c 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -55,7 +55,7 @@
[dummyDataSource _setIsDummy:YES]; // hack on hack!
[dummyDataSource _setContentType:@"text/html"];
- [dummyDataSource _setContentPolicy:WebContentPolicyShow];
+ [dummyDataSource _setContentPolicy:[WebContentPolicy webPolicyWithContentAction:WebContentPolicyShow andPath:nil]];
[dummyDataSource _receivedData:[NSData data]];
// We have to do the next two steps manually, because the above
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 7639725..322b269 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -454,14 +454,14 @@ static const char * const stateNames[6] = {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
NSURL *url = [dataSource inputURL];
- WebFileURLPolicy fileURLPolicy;
- NSString *path = [url path];
+ WebFileURLPolicy *fileURLPolicy;
+ NSString *path = [url path], *urlString = [url absoluteString];
BOOL isDirectory, fileExists;
WebError *error;
- WebURLPolicy urlPolicy = [policyHandler URLPolicyForURL:url];
+ WebURLPolicy *urlPolicy = [policyHandler URLPolicyForURL:url];
- if(urlPolicy == WebURLPolicyUseContentPolicy){
+ if([urlPolicy policyAction] == WebURLPolicyUseContentPolicy){
if([url isFileURL]){
@@ -475,51 +475,46 @@ static const char * const stateNames[6] = {
fileURLPolicy = [policyHandler fileURLPolicyForMIMEType: type dataSource: dataSource isDirectory:NO];
}
- if(fileURLPolicy == WebFileURLPolicyIgnore)
+ if([fileURLPolicy policyAction] == WebFileURLPolicyIgnore)
return NO;
if(!fileExists){
- error = [[WebError alloc] initWithErrorCode:WebErrorFileDoesNotExist
- inDomain:WebErrorDomainWebKit failingURL:[url absoluteString]];
- [policyHandler unableToImplementFileURLPolicy: error forDataSource: dataSource];
+ error = [WebError errorWithCode:WebErrorFileDoesNotExist inDomain:WebErrorDomainWebKit failingURL:urlString];
+ [policyHandler unableToImplementFileURLPolicy: fileURLPolicy error: error forDataSource: dataSource];
return NO;
}
if(![fileManager isReadableFileAtPath:path]){
- error = [[WebError alloc] initWithErrorCode:WebErrorFileNotReadable
- inDomain:WebErrorDomainWebKit failingURL:[url absoluteString]];
- [policyHandler unableToImplementFileURLPolicy: error forDataSource: dataSource];
+ error = [WebError errorWithCode:WebErrorFileNotReadable inDomain:WebErrorDomainWebKit failingURL:urlString];
+ [policyHandler unableToImplementFileURLPolicy: fileURLPolicy error: error forDataSource: dataSource];
return NO;
}
- if(fileURLPolicy == WebFileURLPolicyUseContentPolicy){
+ if([fileURLPolicy policyAction] == WebFileURLPolicyUseContentPolicy){
if(isDirectory){
- error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowDirectory
- inDomain:WebErrorDomainWebKit failingURL:[url absoluteString]];
- [policyHandler unableToImplementFileURLPolicy: error forDataSource: dataSource];
+ error = [WebError errorWithCode:WebErrorCannotShowDirectory inDomain:WebErrorDomainWebKit failingURL:urlString];
+ [policyHandler unableToImplementFileURLPolicy: fileURLPolicy error: error forDataSource: dataSource];
+
return NO;
}
else if(![WebController canShowMIMEType: type]){
- error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowMIMEType
- inDomain:WebErrorDomainWebKit failingURL:[url absoluteString]];
- [policyHandler unableToImplementFileURLPolicy: error forDataSource: dataSource];
+ error = [WebError errorWithCode:WebErrorCannotShowMIMEType inDomain:WebErrorDomainWebKit failingURL:urlString];
+ [policyHandler unableToImplementFileURLPolicy: fileURLPolicy error: error forDataSource: dataSource];
return NO;
}else{
// File exists, its readable, we can show it
return YES;
}
- }else if(fileURLPolicy == WebFileURLPolicyOpenExternally){
+ }else if([fileURLPolicy policyAction] == WebFileURLPolicyOpenExternally){
if(![workspace openFile:path]){
- error = [[WebError alloc] initWithErrorCode:WebErrorCouldNotFindApplicationForFile
- inDomain:WebErrorDomainWebKit failingURL:[url absoluteString]];
- [policyHandler unableToImplementFileURLPolicy: error forDataSource: dataSource];
+ error = [WebError errorWithCode:WebErrorCouldNotFindApplicationForFile inDomain:WebErrorDomainWebKit failingURL:urlString];
+ [policyHandler unableToImplementFileURLPolicy: fileURLPolicy error: error forDataSource: dataSource];
}
return NO;
- }else if(fileURLPolicy == WebFileURLPolicyReveal){
+ }else if([fileURLPolicy policyAction] == WebFileURLPolicyRevealInFinder){
if(![workspace selectFile:path inFileViewerRootedAtPath:@""]){
- error = [[WebError alloc] initWithErrorCode:WebErrorFinderCouldNotOpenDirectory
- inDomain:WebErrorDomainWebKit failingURL:[url absoluteString]];
- [policyHandler unableToImplementFileURLPolicy: error forDataSource: dataSource];
+ error = [WebError errorWithCode:WebErrorFinderCouldNotOpenDirectory inDomain:WebErrorDomainWebKit failingURL:urlString];
+ [policyHandler unableToImplementFileURLPolicy: fileURLPolicy error: error forDataSource: dataSource];
}
return NO;
}else{
@@ -529,24 +524,22 @@ static const char * const stateNames[6] = {
}
}else{
if(![WebResourceHandle canInitWithURL:url]){
- error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowURL
- inDomain:WebErrorDomainWebKit failingURL:[url absoluteString]];
- [policyHandler unableToImplementURLPolicyForURL: url error: error];
+ error = [WebError errorWithCode:WebErrorCannotShowURL inDomain:WebErrorDomainWebKit failingURL:urlString];
+ [policyHandler unableToImplementURLPolicy: urlPolicy error: error forURL: url];
return NO;
}
// we can handle this URL
return YES;
}
}
- else if(urlPolicy == WebURLPolicyOpenExternally){
+ else if([urlPolicy policyAction] == WebURLPolicyOpenExternally){
if(![workspace openURL:url]){
- error = [[WebError alloc] initWithErrorCode:WebErrorCouldNotFindApplicationForURL
- inDomain:WebErrorDomainWebKit failingURL:[url absoluteString]];
- [policyHandler unableToImplementURLPolicyForURL: url error: error];
+ error = [WebError errorWithCode:WebErrorCouldNotFindApplicationForURL inDomain:WebErrorDomainWebKit failingURL:urlString];
+ [policyHandler unableToImplementURLPolicy: urlPolicy error: error forURL: url];
}
return NO;
}
- else if(urlPolicy == WebURLPolicyIgnore){
+ else if([urlPolicy policyAction] == WebURLPolicyIgnore){
return NO;
}
else{
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index e55a727..376fef5 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -73,8 +73,10 @@
- (void)receivedProgressWithHandle:(WebResourceHandle *)handle complete:(BOOL)isComplete
{
WebLoadProgress *progress = [WebLoadProgress progressWithResourceHandle:handle];
+ WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
+
- if ([dataSource contentPolicy] == WebContentPolicySaveAndOpenExternally || [dataSource contentPolicy] == WebContentPolicySave) {
+ if (contentAction == WebContentPolicySaveAndOpenExternally || contentAction == WebContentPolicySave) {
if (isComplete) {
[dataSource _setPrimaryLoadComplete:YES];
}
@@ -89,8 +91,9 @@
- (void)receivedError:(WebError *)error forHandle:(WebResourceHandle *)handle
{
WebLoadProgress *progress = [WebLoadProgress progressWithResourceHandle:handle];
+ WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
- if ([dataSource contentPolicy] == WebContentPolicySaveAndOpenExternally || [dataSource contentPolicy] == WebContentPolicySave) {
+ if (contentAction == WebContentPolicySaveAndOpenExternally || contentAction == WebContentPolicySave) {
[downloadProgressHandler receivedError:error forResourceHandle:handle
partialProgress:progress fromDataSource:dataSource];
} else {
@@ -131,15 +134,17 @@
WEBKIT_ASSERT([currentURL isEqual:[handle redirectedURL] ? [handle redirectedURL] : [handle url]]);
WEBKIT_ASSERT([handle statusCode] == WebResourceHandleStatusLoadComplete);
WEBKIT_ASSERT((int)[data length] == [handle contentLengthReceived]);
+
+ WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
// Don't retain data for downloaded files
- if([dataSource contentPolicy] != WebContentPolicySave &&
- [dataSource contentPolicy] != WebContentPolicySaveAndOpenExternally){
+ if(contentAction != WebContentPolicySave && contentAction != WebContentPolicySaveAndOpenExternally){
[dataSource _setResourceData:data];
}
-
- if([dataSource contentPolicy] == WebContentPolicyShow)
+
+ if(contentAction == WebContentPolicyShow){
[[dataSource representation] finishedLoadingWithDataSource:dataSource];
+ }
// Either send a final error message or a final progress message.
WebError *nonTerminalError = [handle error];
@@ -157,15 +162,14 @@
[self didStopLoading];
}
-- (void)WebResourceHandle:(WebResourceHandle *)handle dataDidBecomeAvailable:(NSData *)incomingData
+- (void)WebResourceHandle:(WebResourceHandle *)handle dataDidBecomeAvailable:(NSData *)data
{
WebController *controller = [dataSource controller];
NSString *contentType = [handle contentType];
WebFrame *frame = [dataSource webFrame];
-
- NSData *data = nil;
+ WebContentPolicy *contentPolicy;
- WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", DEBUG_OBJECT([handle url]), incomingData, [incomingData length]);
+ WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", DEBUG_OBJECT([handle url]), data, [data length]);
WEBKIT_ASSERT([currentURL isEqual:[handle redirectedURL] ? [handle redirectedURL] : [handle url]]);
@@ -184,46 +188,36 @@
// Alexander releases the WebController if no window is created for it.
// This happens in the cases mentioned in 2981866 and 2965312.
downloadProgressHandler = [[[dataSource controller] downloadProgressHandler] retain];
-
- [[controller policyHandler] requestContentPolicyForMIMEType:contentType dataSource:dataSource];
+
+ if([[dataSource contentPolicy] policyAction] == WebContentPolicyNone){
+ contentPolicy = [[controller policyHandler] contentPolicyForMIMEType: contentType dataSource: dataSource];
+ [dataSource _setContentPolicy:contentPolicy];
+ }
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(contentType));
}
- WebContentPolicy contentPolicy = [dataSource contentPolicy];
-
- if (contentPolicy != WebContentPolicyNone) {
- if (!processedBufferedData && !isFirstChunk) {
- // Process all data that has been received now that we are ready for data
- data = [handle resourceData];
- } else {
- data = incomingData;
+ switch ([contentPolicy policyAction]) {
+ case WebContentPolicyShow:
+ [dataSource _receivedData:data];
+ break;
+ case WebContentPolicySave:
+ case WebContentPolicySaveAndOpenExternally:
+ if (!downloadHandler) {
+ [frame _setProvisionalDataSource:nil];
+ [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
+ downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
}
-
- processedBufferedData = YES;
-
- switch (contentPolicy) {
- case WebContentPolicyShow:
- [dataSource _receivedData:data];
- break;
- case WebContentPolicySave:
- case WebContentPolicySaveAndOpenExternally:
- if (!downloadHandler) {
- [frame _setProvisionalDataSource:nil];
- [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
- downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
- }
- [downloadHandler receivedData:data];
- break;
- case WebContentPolicyIgnore:
- [handle cancelLoadInBackground];
- [frame _setProvisionalDataSource:nil];
- [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
- break;
- default:
- [NSException raise:NSInvalidArgumentException format:
- @"haveContentPolicy: andPath:path forDataSource: set an invalid content policy."];
- }
+ [downloadHandler receivedData:data];
+ break;
+ case WebContentPolicyIgnore:
+ [handle cancelLoadInBackground];
+ [frame _setProvisionalDataSource:nil];
+ [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
+ break;
+ default:
+ [NSException raise:NSInvalidArgumentException format:
+ @"contentPolicyForMIMEType: dataSource: returned an invalid content policy."];
}
[self receivedProgressWithHandle:handle complete:NO];
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index e55a727..376fef5 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -73,8 +73,10 @@
- (void)receivedProgressWithHandle:(WebResourceHandle *)handle complete:(BOOL)isComplete
{
WebLoadProgress *progress = [WebLoadProgress progressWithResourceHandle:handle];
+ WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
+
- if ([dataSource contentPolicy] == WebContentPolicySaveAndOpenExternally || [dataSource contentPolicy] == WebContentPolicySave) {
+ if (contentAction == WebContentPolicySaveAndOpenExternally || contentAction == WebContentPolicySave) {
if (isComplete) {
[dataSource _setPrimaryLoadComplete:YES];
}
@@ -89,8 +91,9 @@
- (void)receivedError:(WebError *)error forHandle:(WebResourceHandle *)handle
{
WebLoadProgress *progress = [WebLoadProgress progressWithResourceHandle:handle];
+ WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
- if ([dataSource contentPolicy] == WebContentPolicySaveAndOpenExternally || [dataSource contentPolicy] == WebContentPolicySave) {
+ if (contentAction == WebContentPolicySaveAndOpenExternally || contentAction == WebContentPolicySave) {
[downloadProgressHandler receivedError:error forResourceHandle:handle
partialProgress:progress fromDataSource:dataSource];
} else {
@@ -131,15 +134,17 @@
WEBKIT_ASSERT([currentURL isEqual:[handle redirectedURL] ? [handle redirectedURL] : [handle url]]);
WEBKIT_ASSERT([handle statusCode] == WebResourceHandleStatusLoadComplete);
WEBKIT_ASSERT((int)[data length] == [handle contentLengthReceived]);
+
+ WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
// Don't retain data for downloaded files
- if([dataSource contentPolicy] != WebContentPolicySave &&
- [dataSource contentPolicy] != WebContentPolicySaveAndOpenExternally){
+ if(contentAction != WebContentPolicySave && contentAction != WebContentPolicySaveAndOpenExternally){
[dataSource _setResourceData:data];
}
-
- if([dataSource contentPolicy] == WebContentPolicyShow)
+
+ if(contentAction == WebContentPolicyShow){
[[dataSource representation] finishedLoadingWithDataSource:dataSource];
+ }
// Either send a final error message or a final progress message.
WebError *nonTerminalError = [handle error];
@@ -157,15 +162,14 @@
[self didStopLoading];
}
-- (void)WebResourceHandle:(WebResourceHandle *)handle dataDidBecomeAvailable:(NSData *)incomingData
+- (void)WebResourceHandle:(WebResourceHandle *)handle dataDidBecomeAvailable:(NSData *)data
{
WebController *controller = [dataSource controller];
NSString *contentType = [handle contentType];
WebFrame *frame = [dataSource webFrame];
-
- NSData *data = nil;
+ WebContentPolicy *contentPolicy;
- WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", DEBUG_OBJECT([handle url]), incomingData, [incomingData length]);
+ WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", DEBUG_OBJECT([handle url]), data, [data length]);
WEBKIT_ASSERT([currentURL isEqual:[handle redirectedURL] ? [handle redirectedURL] : [handle url]]);
@@ -184,46 +188,36 @@
// Alexander releases the WebController if no window is created for it.
// This happens in the cases mentioned in 2981866 and 2965312.
downloadProgressHandler = [[[dataSource controller] downloadProgressHandler] retain];
-
- [[controller policyHandler] requestContentPolicyForMIMEType:contentType dataSource:dataSource];
+
+ if([[dataSource contentPolicy] policyAction] == WebContentPolicyNone){
+ contentPolicy = [[controller policyHandler] contentPolicyForMIMEType: contentType dataSource: dataSource];
+ [dataSource _setContentPolicy:contentPolicy];
+ }
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(contentType));
}
- WebContentPolicy contentPolicy = [dataSource contentPolicy];
-
- if (contentPolicy != WebContentPolicyNone) {
- if (!processedBufferedData && !isFirstChunk) {
- // Process all data that has been received now that we are ready for data
- data = [handle resourceData];
- } else {
- data = incomingData;
+ switch ([contentPolicy policyAction]) {
+ case WebContentPolicyShow:
+ [dataSource _receivedData:data];
+ break;
+ case WebContentPolicySave:
+ case WebContentPolicySaveAndOpenExternally:
+ if (!downloadHandler) {
+ [frame _setProvisionalDataSource:nil];
+ [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
+ downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
}
-
- processedBufferedData = YES;
-
- switch (contentPolicy) {
- case WebContentPolicyShow:
- [dataSource _receivedData:data];
- break;
- case WebContentPolicySave:
- case WebContentPolicySaveAndOpenExternally:
- if (!downloadHandler) {
- [frame _setProvisionalDataSource:nil];
- [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
- downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
- }
- [downloadHandler receivedData:data];
- break;
- case WebContentPolicyIgnore:
- [handle cancelLoadInBackground];
- [frame _setProvisionalDataSource:nil];
- [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
- break;
- default:
- [NSException raise:NSInvalidArgumentException format:
- @"haveContentPolicy: andPath:path forDataSource: set an invalid content policy."];
- }
+ [downloadHandler receivedData:data];
+ break;
+ case WebContentPolicyIgnore:
+ [handle cancelLoadInBackground];
+ [frame _setProvisionalDataSource:nil];
+ [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
+ break;
+ default:
+ [NSException raise:NSInvalidArgumentException format:
+ @"contentPolicyForMIMEType: dataSource: returned an invalid content policy."];
}
[self receivedProgressWithHandle:handle complete:NO];
diff --git a/WebKit/WebView.subproj/WebPolicyDelegate.h b/WebKit/WebView.subproj/WebPolicyDelegate.h
index 207a546..64ec1fa 100644
--- a/WebKit/WebView.subproj/WebPolicyDelegate.h
+++ b/WebKit/WebView.subproj/WebPolicyDelegate.h
@@ -7,24 +7,31 @@
#import <Cocoa/Cocoa.h>
-/*
- =============================================================================
+ at class WebDataSource;
+ at class WebError;
- =============================================================================
-*/
+typedef enum {
+ WebPolicyNone,
+ WebPolicyUse,
+ WebPolicyRevealInFinder,
+ WebPolicySave,
+ WebPolicyOpenURL,
+ WebPolicySaveAndOpen,
+ WebPolicyIgnore
+} WebPolicyAction;
typedef enum {
- WebURLPolicyUseContentPolicy,
- WebURLPolicyOpenExternally,
- WebURLPolicyIgnore
-} WebURLPolicy;
+ WebURLPolicyUseContentPolicy = WebPolicyUse,
+ WebURLPolicyOpenExternally = WebPolicyOpenURL,
+ WebURLPolicyIgnore = WebPolicyIgnore
+} WebURLAction;
typedef enum {
- WebFileURLPolicyUseContentPolicy,
- WebFileURLPolicyOpenExternally,
- WebFileURLPolicyReveal,
- WebFileURLPolicyIgnore
-} WebFileURLPolicy;
+ WebFileURLPolicyUseContentPolicy = WebPolicyUse,
+ WebFileURLPolicyOpenExternally = WebPolicyOpenURL,
+ WebFileURLPolicyRevealInFinder = WebPolicyRevealInFinder,
+ WebFileURLPolicyIgnore = WebPolicyIgnore
+} WebFileAction;
typedef enum {
WebContentPolicyNone,
@@ -32,7 +39,50 @@ typedef enum {
WebContentPolicySave,
WebContentPolicySaveAndOpenExternally,
WebContentPolicyIgnore
-} WebContentPolicy;
+} WebContentAction;
+
+typedef enum {
+ WebClickPolicyNone = WebPolicyNone,
+ WebClickPolicyShow,
+ WebClickPolicySave,
+ WebClickPolicySaveAndOpenExternally,
+ WebClickPolicyIgnore
+} WebClickAction;
+
+ at interface WebPolicy : NSObject
+{
+ WebPolicyAction policyAction;
+}
+- initWithPolicyAction: (WebPolicyAction)action;
+- (WebPolicyAction)policyAction;
+ at end
+
+ at interface WebURLPolicy : WebPolicy
++ webPolicyWithURLAction: (WebURLAction)action;
+ at end
+
+ at interface WebFileURLPolicy : WebPolicy
++ webPolicyWithFileAction: (WebFileAction)action;
+ at end
+
+ at interface WebContentPolicy : WebPolicy
+{
+ NSString *path;
+}
++ webPolicyWithContentAction: (WebContentAction)action andPath: (NSString *)thePath;
+- initWithContentPolicyAction: (WebContentAction)action andPath: (NSString *)thePath;
+- (NSString *)path;
+ at end
+
+ at interface WebClickPolicy : WebPolicy
+{
+ NSString *path;
+}
++ webPolicyWithClickAction: (WebClickAction)action andPath: (NSString *)thePath;
+- initWithClickPolicyAction: (WebClickAction)action andPath: (NSString *)thePath;
+- (NSString *)path;
+ at end
+
@protocol WebControllerPolicyHandler <NSObject>
@@ -40,28 +90,31 @@ typedef enum {
// before it is clicked or loaded via a URL bar. Clients can choose to handle the
// URL normally, hand the URL off to launch services, or
// ignore the URL. The default implementation could return +defaultURLPolicyForURL:.
-- (WebURLPolicy)URLPolicyForURL: (NSURL *)url;
+- (WebURLPolicy *)URLPolicyForURL: (NSURL *)url;
-// We may have different errors that cause the the policy to be un-implementable, i.e.
-// launch services failure, etc.
-- (void)unableToImplementURLPolicyForURL: (NSURL *)url error: (WebError *)error;
+// Sent after locationChangeStarted.
+// Implementations typically call haveContentPolicy:forLocationChangeHandler: on WebController
+// after determining the appropriate policy, perhaps by presenting a non-blocking dialog to the user.
+- (WebContentPolicy *)contentPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource;
// Called when the response to URLPolicyForURL is WebURLPolicyUseContentPolicy and the URL is
// a file URL. This allows clients to special-case WebKit's behavior for file URLs.
-- (WebFileURLPolicy)fileURLPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource isDirectory: (BOOL)isDirectory;
+- (WebFileURLPolicy *)fileURLPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource isDirectory: (BOOL)isDirectory;
+
+- (WebClickPolicy *)clickPolicyForElement: (NSDictionary *)elementInformation button: (NSEventType)eventType modifierMask: (unsigned int)eventMask;
+
+// We may have different errors that cause the the policy to be un-implementable, i.e.
+// launch services failure, etc.
+- (void)unableToImplementURLPolicy: (WebPolicy *)policy error: (WebError *)error forURL: (NSURL *)url;
// Called when a WebFileURLPolicy could not be completed. This is usually caused by files not
// existing or not readable.
-- (void)unableToImplementFileURLPolicy: (WebError *)error forDataSource: (WebDataSource *)dataSource;
+- (void)unableToImplementFileURLPolicy: (WebPolicy *)policy error: (WebError *)error forDataSource: (WebDataSource *)dataSource;
-// Sent after locationChangeStarted.
-// Implementations typically call haveContentPolicy:forLocationChangeHandler: on WebController
-// after determining the appropriate policy, perhaps by presenting a non-blocking dialog to the user.
-- (void)requestContentPolicyForMIMEType: (NSString *)type dataSource: (WebDataSource *)dataSource;
// Sent when errors are encountered with an un-implementable policy, i.e.
// file i/o failure, launch services failure, type mismatches, etc.
-- (void)unableToImplementContentPolicy: (WebError *)error forDataSource: (WebDataSource *)dataSource;
+- (void)unableToImplementContentPolicy: (WebPolicy *)policy error: (WebError *)error forDataSource: (WebDataSource *)dataSource;
// Called when a plug-in for a certain mime type is not installed
- (void)pluginNotFoundForMIMEType:(NSString *)mime pluginPageURL:(NSURL *)url;
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index f54c20a..8a5dd00 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -157,13 +157,13 @@
- (void)setContextMenuHandler: (id<WebContextMenuHandler>)handler;
- (id<WebContextMenuHandler>)contextMenuHandler;
-+ (WebURLPolicy)defaultURLPolicyForURL: (NSURL *)url;
+- (void)setLocationChangeHandler:(id <WebLocationChangeHandler>)handler;
+- (id <WebLocationChangeHandler>)locationChangeHandler;
- (void)setPolicyHandler: (id<WebControllerPolicyHandler>)handler;
- (id<WebControllerPolicyHandler>)policyHandler;
-- (void)setLocationChangeHandler:(id <WebLocationChangeHandler>)handler;
-- (id <WebLocationChangeHandler>)locationChangeHandler;
++ (WebURLPolicy *)defaultURLPolicyForURL: (NSURL *)url;
- (void)setDirectsAllLinksToSystemBrowser: (BOOL)flag;
- (BOOL)directsAllLinksToSystemBrowser;
@@ -188,13 +188,6 @@
// frame tree to find the view.
- (WebFrame *)frameForView: (WebView *)aView;
-// Typically called after requestContentPolicyForContentMIMEType: is sent to a
-// locationChangeHander. The content policy of HTML URLs should always be WebContentPolicyShow.
-// Setting the policy to WebContentPolicyIgnore will cancel the load of the URL if it is still
-// pending. The path argument is only used when the policy is either WebContentPolicySave or
-// WebContentPolicySaveAndOpenExternally.
-- (void)haveContentPolicy: (WebContentPolicy)policy andPath: (NSString *)path forDataSource: (WebDataSource *)dataSource;
-
// API to manage animated images.
- (void)stopAnimatedImages;
- (void)startAnimatedImages;
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index a1d1800..9303f9e 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -253,35 +253,12 @@
}
-+ (WebURLPolicy)defaultURLPolicyForURL: (NSURL *)url
++ (WebURLPolicy *)defaultURLPolicyForURL: (NSURL *)url
{
if([WebResourceHandle canInitWithURL:url]){
- return WebURLPolicyUseContentPolicy;
+ return [WebURLPolicy webPolicyWithURLAction:WebURLPolicyUseContentPolicy];
}else{
- return WebURLPolicyOpenExternally;
- }
-}
-
-
-- (void)haveContentPolicy: (WebContentPolicy)policy andPath: (NSString *)path forDataSource: (WebDataSource *)dataSource
-{
- if (policy == WebContentPolicyNone) {
- [NSException raise:NSInvalidArgumentException format:@"Can't set policy of WebContentPolicyNone. Use WebContentPolicyIgnore instead"];
- }
-
- if ([dataSource contentPolicy] != WebContentPolicyNone) {
- [NSException raise:NSGenericException format:@"Content policy can only be set once on for a dataSource."];
- }
-
- if (policy == WebContentPolicyShow &&
- ![[self class] canShowMIMEType:[dataSource contentType]]) {
-
- WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowMIMEType
- inDomain:WebErrorDomainWebKit failingURL:[[dataSource inputURL] absoluteString]];
- [[self policyHandler] unableToImplementContentPolicy:error forDataSource:dataSource];
- } else {
- [dataSource _setContentPolicy:policy];
- [dataSource _setDownloadPath:path];
+ return [WebURLPolicy webPolicyWithURLAction:WebURLPolicyOpenExternally];
}
}
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index 7d1331e..88b87a3 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -131,7 +131,7 @@
[[self resourceProgressHandler] receivedError: error forResourceHandle: resourceHandle partialProgress: progress fromDataSource: dataSource];
[dataSource _addError: error forResource:
- (resourceHandle != nil ? [[resourceHandle url] absoluteString] : [error failingURL])];
+ (resourceHandle != nil ? [[resourceHandle url] absoluteString] : [[resourceHandle url] absoluteString])];
[frame _checkLoadComplete];
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list