[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:07:47 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 80b7e83e38bf67a556c79bc2f6944f53073311a2
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Apr 19 03:02:08 2002 +0000

    New API for content policy.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1048 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 3ae49ec..3af4214 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,34 @@
+2002-04-18  Richard Williamson  <rjw at apple.com>
+
+        New API stubs for content policy.
+        
+	* WebView.subproj/IFBaseLocationChangeHandler.h: Added.
+	* WebView.subproj/IFBaseLocationChangeHandler.m: Added.
+	 (+[IFBaseLocationChangeHandler setGlobalContentPolicy:forMIMEType:]),
+	(+[IFBaseLocationChangeHandler globaContentPolicyForContentType:]),
+	(+[IFBaseLocationChangeHandler globalContentPolicies]),
+	(+[IFBaseLocationChangeHandler suggestedFileanemForURL:andContentType:]),
+	(+[IFBaseLocationChangeHandler suggestedDirectoryForURL:andContentType:]),
+	(+[IFBaseLocationChangeHandler extensionForURL:]), (-[IFBaseLocationChangeHandler
+	extension]), (-[IFBaseLocationChangeHandler locationWillChangeTo:]),
+	(-[IFBaseLocationChangeHandler locationChangeStarted]),
+	(-[IFBaseLocationChangeHandler locationChangeCommitted]),
+	(-[IFBaseLocationChangeHandler locationChangeDone:]),
+	(-[IFBaseLocationChangeHandler receivedPageTitle:forDataSource:]),
+	(-[IFBaseLocationChangeHandler serverRedirectTo:forDataSource:]),
+	(-[IFBaseLocationChangeHandler downloadingWithHandler:]),
+	(-[IFBaseLocationChangeHandler requestContentPolicyForContentMIMEType:]),
+	(-[IFBaseLocationChangeHandler unableToImplementContentPolicy:]):
+	* WebView.subproj/IFBaseWebController.mm: (-[IFBaseWebController
+	receivedError:forDownloadHandler:partialProgress:]), (-[IFBaseWebController
+	provideLocationChangeHandlerForFrame:andURL:]), (-[IFBaseWebController
+	URLPolicyForURL:]), (-[IFBaseWebController
+	unableToImplementURLPolicyForURL:error:]), (-[IFBaseWebController
+	haveContentPolicy:andPath:forLocationChangeHandler:]):
+	* WebView.subproj/IFLocationChangeHandler.h:
+	* WebView.subproj/IFWebController.h:
+	* WebView.subproj/IFWebFramePrivate.mm: (-[IFWebFrame _setState:]):
+
 2002-04-18  Darin Adler  <darin at apple.com>
 
 	* WebKit.pbproj/project.pbxproj: Oops. Take out -Wstrict-prototypes, put back
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 3ae49ec..3af4214 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,34 @@
+2002-04-18  Richard Williamson  <rjw at apple.com>
+
+        New API stubs for content policy.
+        
+	* WebView.subproj/IFBaseLocationChangeHandler.h: Added.
+	* WebView.subproj/IFBaseLocationChangeHandler.m: Added.
+	 (+[IFBaseLocationChangeHandler setGlobalContentPolicy:forMIMEType:]),
+	(+[IFBaseLocationChangeHandler globaContentPolicyForContentType:]),
+	(+[IFBaseLocationChangeHandler globalContentPolicies]),
+	(+[IFBaseLocationChangeHandler suggestedFileanemForURL:andContentType:]),
+	(+[IFBaseLocationChangeHandler suggestedDirectoryForURL:andContentType:]),
+	(+[IFBaseLocationChangeHandler extensionForURL:]), (-[IFBaseLocationChangeHandler
+	extension]), (-[IFBaseLocationChangeHandler locationWillChangeTo:]),
+	(-[IFBaseLocationChangeHandler locationChangeStarted]),
+	(-[IFBaseLocationChangeHandler locationChangeCommitted]),
+	(-[IFBaseLocationChangeHandler locationChangeDone:]),
+	(-[IFBaseLocationChangeHandler receivedPageTitle:forDataSource:]),
+	(-[IFBaseLocationChangeHandler serverRedirectTo:forDataSource:]),
+	(-[IFBaseLocationChangeHandler downloadingWithHandler:]),
+	(-[IFBaseLocationChangeHandler requestContentPolicyForContentMIMEType:]),
+	(-[IFBaseLocationChangeHandler unableToImplementContentPolicy:]):
+	* WebView.subproj/IFBaseWebController.mm: (-[IFBaseWebController
+	receivedError:forDownloadHandler:partialProgress:]), (-[IFBaseWebController
+	provideLocationChangeHandlerForFrame:andURL:]), (-[IFBaseWebController
+	URLPolicyForURL:]), (-[IFBaseWebController
+	unableToImplementURLPolicyForURL:error:]), (-[IFBaseWebController
+	haveContentPolicy:andPath:forLocationChangeHandler:]):
+	* WebView.subproj/IFLocationChangeHandler.h:
+	* WebView.subproj/IFWebController.h:
+	* WebView.subproj/IFWebFramePrivate.mm: (-[IFWebFrame _setState:]):
+
 2002-04-18  Darin Adler  <darin at apple.com>
 
 	* WebKit.pbproj/project.pbxproj: Oops. Take out -Wstrict-prototypes, put back
diff --git a/WebKit/WebView.subproj/IFBaseLocationChangeHandler.h b/WebKit/WebView.subproj/IFBaseLocationChangeHandler.h
new file mode 100644
index 0000000..b87e4c4
--- /dev/null
+++ b/WebKit/WebView.subproj/IFBaseLocationChangeHandler.h
@@ -0,0 +1,40 @@
+/*	
+        IFBaseLocationChangeHandler.h
+	Copyright 2002, Apple, Inc. All rights reserved.
+
+        Public header file.
+*/
+
+#import <Foundation/Foundation.h>
+
+#import <WebKit/IFLocationChangeHandler.h>
+
+ at protocol IFLocationChangeHandler;
+
+ at interface IFBaseLocationChangeHandler : NSObject <IFLocationChangeHandler>
+{
+    NSURL *url;
+    NSString *MIMEType;
+    IFContentPolicy contentPolicy;
+}
+
+// Maintain a persistent database of type-to-policy.
++ (void)setGlobalContentPolicy: (IFContentPolicy)policy forMIMEType: (NSString *)type;
++ (IFContentPolicy)globaContentPolicyForMIMEType: (NSString *)typen;
++ (NSDictionary *)globalContentPolicies;
+
++ (BOOL)canViewMIMEType: (NSString *)MIMEType;
++ (IFContentPolicy)builtinPolicyForMIMEType: (NSString *)MIMEType;
+
++ (NSString *)suggestedFileanemForURL: (NSURL *) andMIMEType: (NSString *)type;
++ (NSString *)suggestedDirectoryForURL: (NSURL *) andMIMEType: (NSString *)type;
+
+// Returns the extension from the URL.  May be used in conjunction with 
+// the MIME type to determine how a location should be handled.
++ (NSString *)extensionForURL: (NSURL *)url;
+
+- (NSURL *)URL;
+
+- (NSString *)MIMEType;
+
+ at end
diff --git a/WebKit/WebView.subproj/IFBaseLocationChangeHandler.m b/WebKit/WebView.subproj/IFBaseLocationChangeHandler.m
new file mode 100644
index 0000000..8c80c22
--- /dev/null
+++ b/WebKit/WebView.subproj/IFBaseLocationChangeHandler.m
@@ -0,0 +1,103 @@
+/*	IFBaseLocationChangeHander.m
+
+        Copyright 2001, Apple, Inc. All rights reserved.
+*/
+
+#import <WebKit/IFLocationChangeHandler.h>
+#import <WebKit/IFBaseLocationChangeHandler.h>
+
+
+ at implementation IFBaseLocationChangeHandler
+
++ (void)setGlobalContentPolicy: (IFContentPolicy)policy forMIMEType: (NSString *)type
+{
+}
+
++ (IFContentPolicy)globaContentPolicyForContentType: (NSString *)type
+{
+    return IFContentPolicyShow;
+}
+
++ (NSDictionary *)globalContentPolicies
+{
+}
+
++ (NSString *)suggestedFileanemForURL: (NSURL *) andContentType: (IFContentType *)type
+{
+}
+
++ (NSString *)suggestedDirectoryForURL: (NSURL *) andContentType: (IFContentType *)type
+{
+}
+
++ (NSString *)extensionForURL: (NSURL *)url
+{
+}
+
+
+
+// Returns the extension from the URL.  May be used in conjunction with 
+// the MIME type to determine how a location should be handled.
+- (NSString *)extension
+{
+    return nil;
+}
+
+- (BOOL)locationWillChangeTo: (NSURL *)url
+{
+    url = [url retain];
+}
+
+
+- (void)locationChangeStarted
+{
+    // Do nothing.  Subclasses may override.
+}
+
+
+- (void)locationChangeCommitted
+{
+    // Do nothing.  Subclasses may override.
+}
+
+
+- (void)locationChangeDone: (IFError *)error
+{
+    // Do nothing.  Subclasses may override.
+}
+
+- (void)receivedPageTitle: (NSString *)title forDataSource: (IFWebDataSource *)dataSource
+{
+    // Do nothing.  Subclasses may override.
+}
+
+- (void)serverRedirectTo: (NSURL *)url forDataSource: (IFWebDataSource *)dataSource
+{
+    // Do nothing.  Subclasses may override.
+}
+
+// DEPRECATED: 
+// Called when a file download has started
+- (void) downloadingWithHandler:(IFDownloadHandler *)downloadHandler
+{
+}
+
+
+// Sent once the IFContentType of the location handler
+// has been determined.  Should not block.
+// Implementations typically call setContentPolicy: immediately, although
+// may call it later after showing a user dialog.
+- (void)requestContentPolicyForContentMIMEType: (NSString *)type
+{
+    [self haveContentPolicy: [IFBaseLocationChangeHandler globaContentPolicyForContentType: type] forLocationChangeHandler: self];
+}
+
+// We may have different errors that cause the the policy to be un-implementable, i.e.
+// file i/o failure, launch services failure, type mismatches, etc.
+- (void)unableToImplementContentPolicy: (IFError *)error
+{
+}
+
+
+ at end
+
diff --git a/WebKit/WebView.subproj/IFBaseWebController.mm b/WebKit/WebView.subproj/IFBaseWebController.mm
index bea2122..eec8548 100644
--- a/WebKit/WebView.subproj/IFBaseWebController.mm
+++ b/WebKit/WebView.subproj/IFBaseWebController.mm
@@ -11,9 +11,10 @@
 #import <WebKit/IFDynamicScrollBarsView.h>
 #import <WebKit/IFException.h>
 #import <WebKit/IFWebController.h>
-
 #import <WebKit/WebKitDebug.h>
 
+#import <WebFoundation/IFError.h>
+
 @implementation IFBaseWebController
 
 - init
@@ -253,4 +254,23 @@
     // Do nothing.  Subclasses typically override this method.
 }
 
+- (id <IFLocationChangeHandler>)provideLocationChangeHandlerForFrame: (IFWebFrame *)frame andURL: (NSURL *)url
+{
+    return nil;
+}
+
+- (IFURLPolicy)URLPolicyForURL: (NSURL *)url
+{
+    return IFURLPolicyNone;
+}
+
+- (void)unableToImplementURLPolicyForURL: (NSURL *)url error: (IFError *)error
+{
+}
+
+
+- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forLocationChangeHandler: (id <IFLocationChangeHandler>)handler
+{
+}
+
 @end
diff --git a/WebKit/WebView.subproj/IFLocationChangeHandler.h b/WebKit/WebView.subproj/IFLocationChangeHandler.h
index 383e552..e33b499 100644
--- a/WebKit/WebView.subproj/IFLocationChangeHandler.h
+++ b/WebKit/WebView.subproj/IFLocationChangeHandler.h
@@ -40,9 +40,22 @@
    
    ============================================================================= 
 */
+
+typedef enum {
+	IFContentPolicyNone,
+	IFContentPolicyShow,
+	IFContentPolicySave,
+	IFContentPolicyOpenExternally,
+	IFContentPolicyIgnore
+} IFContentPolicy;
+
+
 @protocol IFLocationChangeHandler
 
+// DEPRECATED
 - (BOOL)locationWillChangeTo: (NSURL *)url;
+// DEPRECATED 
+- (void) downloadingWithHandler:(IFDownloadHandler *)downloadHandler;
 
 - (void)locationChangeStarted;
 
@@ -54,7 +67,15 @@
 
 - (void)serverRedirectTo: (NSURL *)url forDataSource: (IFWebDataSource *)dataSource;
 
-// Called when a file download has started
-- (void) downloadingWithHandler:(IFDownloadHandler *)downloadHandler;
+// Sent once the IFContentType of the location handler
+// has been determined.  Should not block.
+// Implementations typically call haveContentPolicy:forLocationChangeHandler: immediately, although
+// may call it later after showing a user dialog.
+- (void)requestContentPolicyForContentMIMEType: (NSString *)type;
+
+// We may have different errors that cause the the policy to be un-implementable, i.e.
+// file i/o failure, launch services failure, type mismatches, etc.
+- (void)unableToImplementContentPolicy: (IFError *)error;
+
 
 @end
diff --git a/WebKit/WebView.subproj/IFWebController.h b/WebKit/WebView.subproj/IFWebController.h
index 7ddcc48..bcced61 100644
--- a/WebKit/WebView.subproj/IFWebController.h
+++ b/WebKit/WebView.subproj/IFWebController.h
@@ -6,6 +6,9 @@
 */
 
 #import <Cocoa/Cocoa.h>
+#import <Foundation/Foundation.h>
+
+#import <WebKit/IFLocationChangeHandler.h>
 
 /*
    ============================================================================= 
@@ -31,8 +34,6 @@
 @class IFWebDataSource;
 @class IFWebFrame;
 
- at protocol IFLocationChangeHandler;
-
 /*
    ============================================================================= 
 
@@ -99,6 +100,13 @@
    ============================================================================= 
 */
 
+typedef enum {
+    IFURLPolicyNone,
+    IFURLPolicyUseContentPolicy,
+    IFURLPolicyOpenExternally,
+    IFURLPolicyIgnore
+} IFURLPolicy;
+
 @protocol IFWebController <IFResourceProgressHandler, IFDownloadProgressHandler, IFScriptContextHandler>
 
 // Called when a data source needs to create a frame.  This method encapsulates the
@@ -121,10 +129,30 @@
 // an IFWebView.
 - (IFWebFrame *)frameForView: (NSView *)aView;
 
+// DEPRECATED
 - (id <IFLocationChangeHandler>)provideLocationChangeHandlerForFrame: (IFWebFrame *)frame;
 
+- (id <IFLocationChangeHandler>)provideLocationChangeHandlerForFrame: (IFWebFrame *)frame andURL: (NSURL *)url;
+
+// URLPolicyForURL: is used to determine what to do BEFORE a URL is loaded, i.e.
+// before it is clicked or loaded via a URL bar.  Clients can choose to handle the
+// URL normally (i.e. Alexander), hand the URL off to launch services (i.e. Mail), or
+// ignore the URL (i.e. Help Viewer?).  This API could potentially be used by mac manager
+// to filter allowable URLs.
+- (IFURLPolicy)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: (IFError *)error;
+
 // FIXME:  this method should be moved to a protocol
 // Called when a plug-in for a certain mime type is not installed
 - (void)pluginNotFoundForMIMEType:(NSString *)mime pluginPageURL:(NSURL *)url;
 
+// Typically called after requestContentPolicyForContentMIMEType: is sent to a locationChangeHander.
+// The content policy of HTML URLs should always be IFContentPolicyShow.  Setting the policy to 
+// IFContentPolicyIgnore will cancel the load of the URL if it is still pending.  The path argument 
+// is only used when the policy is either IFContentPolicySave or IFContentPolicyOpenExternally.
+- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forLocationChangeHandler: (id <IFLocationChangeHandler>)handler;
+
 @end
diff --git a/WebKit/WebView.subproj/IFWebFramePrivate.mm b/WebKit/WebView.subproj/IFWebFramePrivate.mm
index 5d209c7..a6874b9 100644
--- a/WebKit/WebView.subproj/IFWebFramePrivate.mm
+++ b/WebKit/WebView.subproj/IFWebFramePrivate.mm
@@ -266,8 +266,9 @@ static const char * const stateNames[6] = {
     if ([self controller])
         WEBKITDEBUGLEVEL (WEBKIT_LOG_TIMING, "%s:  transition from %s to %s, %f seconds since start of document load\n", [[self name] cString], stateNames[_private->state], stateNames[newState], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
     
-    if (newState == IFWEBFRAMESTATE_COMPLETE && self == [[self controller] mainFrame])
+    if (newState == IFWEBFRAMESTATE_COMPLETE && self == [[self controller] mainFrame]){
         WEBKITDEBUGLEVEL (WEBKIT_LOG_DOCUMENTLOAD, "completed %s (%f seconds)", [[[[self dataSource] inputURL] absoluteString] cString], CFAbsoluteTimeGetCurrent() - [[self dataSource] _loadingStartedTime]);
+    }
 
     _private->state = newState;
 }
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index 7ddcc48..bcced61 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -6,6 +6,9 @@
 */
 
 #import <Cocoa/Cocoa.h>
+#import <Foundation/Foundation.h>
+
+#import <WebKit/IFLocationChangeHandler.h>
 
 /*
    ============================================================================= 
@@ -31,8 +34,6 @@
 @class IFWebDataSource;
 @class IFWebFrame;
 
- at protocol IFLocationChangeHandler;
-
 /*
    ============================================================================= 
 
@@ -99,6 +100,13 @@
    ============================================================================= 
 */
 
+typedef enum {
+    IFURLPolicyNone,
+    IFURLPolicyUseContentPolicy,
+    IFURLPolicyOpenExternally,
+    IFURLPolicyIgnore
+} IFURLPolicy;
+
 @protocol IFWebController <IFResourceProgressHandler, IFDownloadProgressHandler, IFScriptContextHandler>
 
 // Called when a data source needs to create a frame.  This method encapsulates the
@@ -121,10 +129,30 @@
 // an IFWebView.
 - (IFWebFrame *)frameForView: (NSView *)aView;
 
+// DEPRECATED
 - (id <IFLocationChangeHandler>)provideLocationChangeHandlerForFrame: (IFWebFrame *)frame;
 
+- (id <IFLocationChangeHandler>)provideLocationChangeHandlerForFrame: (IFWebFrame *)frame andURL: (NSURL *)url;
+
+// URLPolicyForURL: is used to determine what to do BEFORE a URL is loaded, i.e.
+// before it is clicked or loaded via a URL bar.  Clients can choose to handle the
+// URL normally (i.e. Alexander), hand the URL off to launch services (i.e. Mail), or
+// ignore the URL (i.e. Help Viewer?).  This API could potentially be used by mac manager
+// to filter allowable URLs.
+- (IFURLPolicy)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: (IFError *)error;
+
 // FIXME:  this method should be moved to a protocol
 // Called when a plug-in for a certain mime type is not installed
 - (void)pluginNotFoundForMIMEType:(NSString *)mime pluginPageURL:(NSURL *)url;
 
+// Typically called after requestContentPolicyForContentMIMEType: is sent to a locationChangeHander.
+// The content policy of HTML URLs should always be IFContentPolicyShow.  Setting the policy to 
+// IFContentPolicyIgnore will cancel the load of the URL if it is still pending.  The path argument 
+// is only used when the policy is either IFContentPolicySave or IFContentPolicyOpenExternally.
+- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forLocationChangeHandler: (id <IFLocationChangeHandler>)handler;
+
 @end
diff --git a/WebKit/WebView.subproj/WebFrameLoadDelegate.h b/WebKit/WebView.subproj/WebFrameLoadDelegate.h
index 383e552..e33b499 100644
--- a/WebKit/WebView.subproj/WebFrameLoadDelegate.h
+++ b/WebKit/WebView.subproj/WebFrameLoadDelegate.h
@@ -40,9 +40,22 @@
    
    ============================================================================= 
 */
+
+typedef enum {
+	IFContentPolicyNone,
+	IFContentPolicyShow,
+	IFContentPolicySave,
+	IFContentPolicyOpenExternally,
+	IFContentPolicyIgnore
+} IFContentPolicy;
+
+
 @protocol IFLocationChangeHandler
 
+// DEPRECATED
 - (BOOL)locationWillChangeTo: (NSURL *)url;
+// DEPRECATED 
+- (void) downloadingWithHandler:(IFDownloadHandler *)downloadHandler;
 
 - (void)locationChangeStarted;
 
@@ -54,7 +67,15 @@
 
 - (void)serverRedirectTo: (NSURL *)url forDataSource: (IFWebDataSource *)dataSource;
 
-// Called when a file download has started
-- (void) downloadingWithHandler:(IFDownloadHandler *)downloadHandler;
+// Sent once the IFContentType of the location handler
+// has been determined.  Should not block.
+// Implementations typically call haveContentPolicy:forLocationChangeHandler: immediately, although
+// may call it later after showing a user dialog.
+- (void)requestContentPolicyForContentMIMEType: (NSString *)type;
+
+// We may have different errors that cause the the policy to be un-implementable, i.e.
+// file i/o failure, launch services failure, type mismatches, etc.
+- (void)unableToImplementContentPolicy: (IFError *)error;
+
 
 @end
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 5d209c7..a6874b9 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -266,8 +266,9 @@ static const char * const stateNames[6] = {
     if ([self controller])
         WEBKITDEBUGLEVEL (WEBKIT_LOG_TIMING, "%s:  transition from %s to %s, %f seconds since start of document load\n", [[self name] cString], stateNames[_private->state], stateNames[newState], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
     
-    if (newState == IFWEBFRAMESTATE_COMPLETE && self == [[self controller] mainFrame])
+    if (newState == IFWEBFRAMESTATE_COMPLETE && self == [[self controller] mainFrame]){
         WEBKITDEBUGLEVEL (WEBKIT_LOG_DOCUMENTLOAD, "completed %s (%f seconds)", [[[[self dataSource] inputURL] absoluteString] cString], CFAbsoluteTimeGetCurrent() - [[self dataSource] _loadingStartedTime]);
+    }
 
     _private->state = newState;
 }
diff --git a/WebKit/WebView.subproj/WebLocationChangeDelegate.h b/WebKit/WebView.subproj/WebLocationChangeDelegate.h
index 383e552..e33b499 100644
--- a/WebKit/WebView.subproj/WebLocationChangeDelegate.h
+++ b/WebKit/WebView.subproj/WebLocationChangeDelegate.h
@@ -40,9 +40,22 @@
    
    ============================================================================= 
 */
+
+typedef enum {
+	IFContentPolicyNone,
+	IFContentPolicyShow,
+	IFContentPolicySave,
+	IFContentPolicyOpenExternally,
+	IFContentPolicyIgnore
+} IFContentPolicy;
+
+
 @protocol IFLocationChangeHandler
 
+// DEPRECATED
 - (BOOL)locationWillChangeTo: (NSURL *)url;
+// DEPRECATED 
+- (void) downloadingWithHandler:(IFDownloadHandler *)downloadHandler;
 
 - (void)locationChangeStarted;
 
@@ -54,7 +67,15 @@
 
 - (void)serverRedirectTo: (NSURL *)url forDataSource: (IFWebDataSource *)dataSource;
 
-// Called when a file download has started
-- (void) downloadingWithHandler:(IFDownloadHandler *)downloadHandler;
+// Sent once the IFContentType of the location handler
+// has been determined.  Should not block.
+// Implementations typically call haveContentPolicy:forLocationChangeHandler: immediately, although
+// may call it later after showing a user dialog.
+- (void)requestContentPolicyForContentMIMEType: (NSString *)type;
+
+// We may have different errors that cause the the policy to be un-implementable, i.e.
+// file i/o failure, launch services failure, type mismatches, etc.
+- (void)unableToImplementContentPolicy: (IFError *)error;
+
 
 @end
diff --git a/WebKit/WebView.subproj/WebLocationChangeHandler.h b/WebKit/WebView.subproj/WebLocationChangeHandler.h
index 383e552..e33b499 100644
--- a/WebKit/WebView.subproj/WebLocationChangeHandler.h
+++ b/WebKit/WebView.subproj/WebLocationChangeHandler.h
@@ -40,9 +40,22 @@
    
    ============================================================================= 
 */
+
+typedef enum {
+	IFContentPolicyNone,
+	IFContentPolicyShow,
+	IFContentPolicySave,
+	IFContentPolicyOpenExternally,
+	IFContentPolicyIgnore
+} IFContentPolicy;
+
+
 @protocol IFLocationChangeHandler
 
+// DEPRECATED
 - (BOOL)locationWillChangeTo: (NSURL *)url;
+// DEPRECATED 
+- (void) downloadingWithHandler:(IFDownloadHandler *)downloadHandler;
 
 - (void)locationChangeStarted;
 
@@ -54,7 +67,15 @@
 
 - (void)serverRedirectTo: (NSURL *)url forDataSource: (IFWebDataSource *)dataSource;
 
-// Called when a file download has started
-- (void) downloadingWithHandler:(IFDownloadHandler *)downloadHandler;
+// Sent once the IFContentType of the location handler
+// has been determined.  Should not block.
+// Implementations typically call haveContentPolicy:forLocationChangeHandler: immediately, although
+// may call it later after showing a user dialog.
+- (void)requestContentPolicyForContentMIMEType: (NSString *)type;
+
+// We may have different errors that cause the the policy to be un-implementable, i.e.
+// file i/o failure, launch services failure, type mismatches, etc.
+- (void)unableToImplementContentPolicy: (IFError *)error;
+
 
 @end
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index 7ddcc48..bcced61 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -6,6 +6,9 @@
 */
 
 #import <Cocoa/Cocoa.h>
+#import <Foundation/Foundation.h>
+
+#import <WebKit/IFLocationChangeHandler.h>
 
 /*
    ============================================================================= 
@@ -31,8 +34,6 @@
 @class IFWebDataSource;
 @class IFWebFrame;
 
- at protocol IFLocationChangeHandler;
-
 /*
    ============================================================================= 
 
@@ -99,6 +100,13 @@
    ============================================================================= 
 */
 
+typedef enum {
+    IFURLPolicyNone,
+    IFURLPolicyUseContentPolicy,
+    IFURLPolicyOpenExternally,
+    IFURLPolicyIgnore
+} IFURLPolicy;
+
 @protocol IFWebController <IFResourceProgressHandler, IFDownloadProgressHandler, IFScriptContextHandler>
 
 // Called when a data source needs to create a frame.  This method encapsulates the
@@ -121,10 +129,30 @@
 // an IFWebView.
 - (IFWebFrame *)frameForView: (NSView *)aView;
 
+// DEPRECATED
 - (id <IFLocationChangeHandler>)provideLocationChangeHandlerForFrame: (IFWebFrame *)frame;
 
+- (id <IFLocationChangeHandler>)provideLocationChangeHandlerForFrame: (IFWebFrame *)frame andURL: (NSURL *)url;
+
+// URLPolicyForURL: is used to determine what to do BEFORE a URL is loaded, i.e.
+// before it is clicked or loaded via a URL bar.  Clients can choose to handle the
+// URL normally (i.e. Alexander), hand the URL off to launch services (i.e. Mail), or
+// ignore the URL (i.e. Help Viewer?).  This API could potentially be used by mac manager
+// to filter allowable URLs.
+- (IFURLPolicy)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: (IFError *)error;
+
 // FIXME:  this method should be moved to a protocol
 // Called when a plug-in for a certain mime type is not installed
 - (void)pluginNotFoundForMIMEType:(NSString *)mime pluginPageURL:(NSURL *)url;
 
+// Typically called after requestContentPolicyForContentMIMEType: is sent to a locationChangeHander.
+// The content policy of HTML URLs should always be IFContentPolicyShow.  Setting the policy to 
+// IFContentPolicyIgnore will cancel the load of the URL if it is still pending.  The path argument 
+// is only used when the policy is either IFContentPolicySave or IFContentPolicyOpenExternally.
+- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forLocationChangeHandler: (id <IFLocationChangeHandler>)handler;
+
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list