[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:09:01 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 0ef249b6adc9548d81a91d04e1e2e9111b880530
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Apr 23 21:00:38 2002 +0000

            * MIME.subproj/IFDownloadHandler.h:
            * MIME.subproj/IFDownloadHandler.m: Removed.
            * MIME.subproj/IFDownloadHandler.mm: Added.
            (-[IFDownloadHandler initWithDataSource:]):
            (-[IFDownloadHandler dealloc]):
            * MIME.subproj/IFDownloadHandlerPrivate.h: Removed.
            * MIME.subproj/IFDownloadHandlerPrivate.m: Removed.
    
            Made IFDownloadHandler a private class that retains the data source
            and saves the data to disk.
    
            * WebKit.pbproj/project.pbxproj:
    
            Removed IFDownloadHandlerPrivate
    
            * WebView.subproj/IFBaseWebControllerPrivate.mm:
            (-[IFBaseWebController _mainReceivedProgress:forResource:fromDataSource:]):
    
            Only send locationChangeCommitted if its shown inline.
    
            * WebView.subproj/IFMainURLHandleClient.mm:
            (-[IFMainURLHandleClient IFURLHandleResourceDidFinishLoading:data:]):
    
            Save data with IFDownloadHandler
    
            (-[IFMainURLHandleClient IFURLHandle:resourceDataDidBecomeAvailable:]):
    
            If its a download, set the provisionalDataSource on the frame to nil.
    
            * WebView.subproj/IFWebDataSource.h:
            * WebView.subproj/IFWebDataSource.mm:
            (-[IFWebDataSource webFrame]):
            (-[IFWebDataSource pageTitle]):
            (-[IFWebDataSource contentPolicy]):
    
            Added some accessor methods. Spelling fix pageTitle.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1066 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index abfb4b2..85b019d 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,42 @@
+2002-04-23  Chris Blumenberg  <cblu at apple.com>
+
+	* MIME.subproj/IFDownloadHandler.h:
+	* MIME.subproj/IFDownloadHandler.m: Removed.
+	* MIME.subproj/IFDownloadHandler.mm: Added.
+	(-[IFDownloadHandler initWithDataSource:]):
+	(-[IFDownloadHandler dealloc]):
+	* MIME.subproj/IFDownloadHandlerPrivate.h: Removed.
+	* MIME.subproj/IFDownloadHandlerPrivate.m: Removed.
+
+	Made IFDownloadHandler a private class that retains the data source
+	and saves the data to disk.
+
+	* WebKit.pbproj/project.pbxproj:
+
+	Removed IFDownloadHandlerPrivate
+
+	* WebView.subproj/IFBaseWebControllerPrivate.mm:
+	(-[IFBaseWebController _mainReceivedProgress:forResource:fromDataSource:]):
+
+	Only send locationChangeCommitted if its shown inline.
+
+	* WebView.subproj/IFMainURLHandleClient.mm:
+	(-[IFMainURLHandleClient IFURLHandleResourceDidFinishLoading:data:]):
+	
+	Save data with IFDownloadHandler
+
+	(-[IFMainURLHandleClient IFURLHandle:resourceDataDidBecomeAvailable:]):
+	
+	If its a download, set the provisionalDataSource on the frame to nil.	
+
+	* WebView.subproj/IFWebDataSource.h:
+	* WebView.subproj/IFWebDataSource.mm:
+	(-[IFWebDataSource webFrame]):
+	(-[IFWebDataSource pageTitle]):
+	(-[IFWebDataSource contentPolicy]):
+
+	Added some accessor methods. Spelling fix pageTitle.
+
 2002-04-23  Kenneth Kocienda  <kocienda at apple.com>
 
         Reviewed by: Darin Adler
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index abfb4b2..85b019d 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,42 @@
+2002-04-23  Chris Blumenberg  <cblu at apple.com>
+
+	* MIME.subproj/IFDownloadHandler.h:
+	* MIME.subproj/IFDownloadHandler.m: Removed.
+	* MIME.subproj/IFDownloadHandler.mm: Added.
+	(-[IFDownloadHandler initWithDataSource:]):
+	(-[IFDownloadHandler dealloc]):
+	* MIME.subproj/IFDownloadHandlerPrivate.h: Removed.
+	* MIME.subproj/IFDownloadHandlerPrivate.m: Removed.
+
+	Made IFDownloadHandler a private class that retains the data source
+	and saves the data to disk.
+
+	* WebKit.pbproj/project.pbxproj:
+
+	Removed IFDownloadHandlerPrivate
+
+	* WebView.subproj/IFBaseWebControllerPrivate.mm:
+	(-[IFBaseWebController _mainReceivedProgress:forResource:fromDataSource:]):
+
+	Only send locationChangeCommitted if its shown inline.
+
+	* WebView.subproj/IFMainURLHandleClient.mm:
+	(-[IFMainURLHandleClient IFURLHandleResourceDidFinishLoading:data:]):
+	
+	Save data with IFDownloadHandler
+
+	(-[IFMainURLHandleClient IFURLHandle:resourceDataDidBecomeAvailable:]):
+	
+	If its a download, set the provisionalDataSource on the frame to nil.	
+
+	* WebView.subproj/IFWebDataSource.h:
+	* WebView.subproj/IFWebDataSource.mm:
+	(-[IFWebDataSource webFrame]):
+	(-[IFWebDataSource pageTitle]):
+	(-[IFWebDataSource contentPolicy]):
+
+	Added some accessor methods. Spelling fix pageTitle.
+
 2002-04-23  Kenneth Kocienda  <kocienda at apple.com>
 
         Reviewed by: Darin Adler
diff --git a/WebKit/MIME.subproj/IFDownloadHandler.h b/WebKit/MIME.subproj/IFDownloadHandler.h
index d842d3e..a0ea013 100644
--- a/WebKit/MIME.subproj/IFDownloadHandler.h
+++ b/WebKit/MIME.subproj/IFDownloadHandler.h
@@ -7,20 +7,12 @@
 //
 
 #import <Foundation/Foundation.h>
-
- at class IFMIMEHandler;
-
- at class IFDownloadHandlerPrivate;
+#import <WebKit/IFWebDataSource.h>
 
 @interface IFDownloadHandler : NSObject {
- at private
-    IFDownloadHandlerPrivate *_private;
+    IFWebDataSource *dataSource;
 }
 
-- (NSURL *) url;
-- (IFMIMEHandler *) mimeHandler;
-- (NSString *) suggestedFilename;
-- (void) cancelDownload;
-- (void) storeAtPath:(NSString *)path;
-- (void) openAfterDownload:(BOOL)open;
+- initWithDataSource:(IFWebDataSource *)dSource;
+- (void)downloadCompletedWithData:(NSData *)data;
 @end
diff --git a/WebKit/MIME.subproj/IFDownloadHandler.m b/WebKit/MIME.subproj/IFDownloadHandler.m
deleted file mode 100644
index d2fd5d2..0000000
--- a/WebKit/MIME.subproj/IFDownloadHandler.m
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-//  IFDownloadHandler.m
-//  WebKit
-//
-//  Created by Chris Blumenberg on Thu Apr 11 2002.
-//  Copyright (c) 2002 __MyCompanyName__. All rights reserved.
-//
-
-#import <WebKit/IFDownloadHandler.h>
-#import <WebKit/IFDownloadHandlerPrivate.h>
-
- at implementation IFDownloadHandler
-
-- (NSURL *) url
-{
-    return [_private _url];
-}
-
-- (IFMIMEHandler *) mimeHandler
-{
-    return [_private _mimeHandler];
-}
-
-- (NSString *) suggestedFilename
-{
-    return [_private _suggestedFilename];
-}
-
-- (void) cancelDownload
-{
-    [_private _cancelDownload];
-}
-
-- (void) storeAtPath:(NSString *)path
-{
-    [_private _storeAtPath:path];
-}
-
-- (void) dealloc
-{
-    [_private release];
-}
-
-- (void) openAfterDownload:(BOOL)open
-{
-    [_private _openAfterDownload:open];
-}
-
- at end
diff --git a/WebKit/MIME.subproj/IFDownloadHandler.mm b/WebKit/MIME.subproj/IFDownloadHandler.mm
new file mode 100644
index 0000000..c079aca
--- /dev/null
+++ b/WebKit/MIME.subproj/IFDownloadHandler.mm
@@ -0,0 +1,51 @@
+//
+//  IFDownloadHandler.m
+//  WebKit
+//
+//  Created by Chris Blumenberg on Thu Apr 11 2002.
+//  Copyright (c) 2002 __MyCompanyName__. All rights reserved.
+//
+
+#import <WebKit/IFDownloadHandler.h>
+#import <WebKit/IFWebDataSourcePrivate.h>
+#import <WebKit/WebKitDebug.h>
+
+ at implementation IFDownloadHandler
+
+- initWithDataSource:(IFWebDataSource *)dSource
+{
+    dataSource = [dSource retain];
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Download started for: %s", [[[dSource inputURL] absoluteString] cString]);
+    return self;
+}
+
+- (void)dealloc
+{
+    [dataSource release];
+}
+
+- (void)downloadCompletedWithData:(NSData *)data;
+{
+    NSString *path = [dataSource _downloadPath];
+    NSFileManager *fileManager;
+    CFURLRef pathURL;
+       
+    // FIXME: Should probably not replace existing file
+    // FIXME: Should report error if there is one
+    fileManager = [NSFileManager defaultManager];
+    [fileManager createFileAtPath:path contents:data attributes:nil];
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Download complete. Saved to: %s", [path cString]);
+    
+    // Send Finder notification
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Notifying Finder");
+    FNNotifyByPath((UInt8 *)[[path stringByDeletingLastPathComponent] cString], kFNDirectoryModifiedMessage, kNilOptions);
+    
+    if([dataSource _contentPolicy] == IFContentPolicyOpenExternally){
+        pathURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)path, kCFURLPOSIXPathStyle, FALSE);
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD,"Opening: %s", [path cString]);
+        LSOpenCFURLRef(pathURL, NULL);
+        CFRelease(pathURL);
+    }
+}
+
+ at end
diff --git a/WebKit/MIME.subproj/IFDownloadHandlerPrivate.h b/WebKit/MIME.subproj/IFDownloadHandlerPrivate.h
deleted file mode 100644
index 7b889c1..0000000
--- a/WebKit/MIME.subproj/IFDownloadHandlerPrivate.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-//  IFDownloadHandlerPrivate.h
-//  WebKit
-//
-//  Created by Chris Blumenberg on Thu Apr 11 2002.
-//  Copyright (c) 2002 __MyCompanyName__. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <WebKit/IFDownloadHandler.h>
-
- at class IFURLHandle;
-
- at interface IFDownloadHandlerPrivate : NSObject {
-    IFMIMEHandler *mimeHandler;
-    IFURLHandle *urlHandle;
-    NSString *path;
-    BOOL shouldOpen, downloadCompleted;
-}
-
-- (void) _setMIMEHandler:(IFMIMEHandler *) mHandler;
-- (void) _setURLHandle:(IFURLHandle *)uHandle;
-- (NSURL *) _url;
-- (IFMIMEHandler *) _mimeHandler;
-- (NSString *) _suggestedFilename;
-- (void) _cancelDownload;
-- (void) _storeAtPath:(NSString *)newPath;
-- (void) _finishedDownload;
-- (void) _openAfterDownload:(BOOL)open;
-- (void) _openFile;
-- (void) _saveFile;
-
- at end
-
- at interface IFDownloadHandler (IFPrivate)
-- _initWithURLHandle:(IFURLHandle *)uHandle mimeHandler:(IFMIMEHandler *)mHandler;
-- (void) _receivedData:(NSData *)data;
-- (void) _finishedDownload;
- at end
diff --git a/WebKit/MIME.subproj/IFDownloadHandlerPrivate.m b/WebKit/MIME.subproj/IFDownloadHandlerPrivate.m
deleted file mode 100644
index 7937b6f..0000000
--- a/WebKit/MIME.subproj/IFDownloadHandlerPrivate.m
+++ /dev/null
@@ -1,146 +0,0 @@
-//
-//  IFDownloadHandlerPrivate.m
-//  WebKit
-//
-//  Created by Chris Blumenberg on Thu Apr 11 2002.
-//  Copyright (c) 2002 __MyCompanyName__. All rights reserved.
-//
-
-#import <WebKit/IFDownloadHandlerPrivate.h>
-#import <WebKit/IFMIMEHandler.h>
-#import <WebKit/WebKitDebug.h>
-
-#import <WebFoundation/IFURLHandle.h>
-
-#import <ApplicationServices/ApplicationServices.h>
-#import <Carbon/Carbon.h>
-
- at implementation IFDownloadHandlerPrivate
-
-
-- init
-{
-    shouldOpen = NO;
-    downloadCompleted = NO;
-    return self;
-}
-
-- (void) dealloc
-{
-    if(!downloadCompleted){
-        [self _cancelDownload];
-    }
-    [mimeHandler release];
-    [urlHandle release];
-    [path release];
-}
-
-- (void) _setMIMEHandler:(IFMIMEHandler *) mHandler
-{
-    mimeHandler = [mHandler retain];
-}
-
-- (void) _setURLHandle:(IFURLHandle *)uHandle
-{
-    urlHandle = [uHandle retain];
-}
-
-- (NSURL *) _url
-{
-    return [urlHandle url];
-}
-
-- (IFMIMEHandler *) _mimeHandler
-{
-    return mimeHandler;
-}
-
-- (NSString *) _suggestedFilename
-{
-    //FIXME: need a better way to get a file name out of a URL
-    return [[[urlHandle url] absoluteString] lastPathComponent];
-}
-
-- (void) _cancelDownload
-{
-    if(!downloadCompleted)
-        [urlHandle cancelLoadInBackground];
-}
-
-- (void) _storeAtPath:(NSString *)newPath
-{
-    path = [newPath retain];
-    if(downloadCompleted)
-        [self _saveFile];
-}
-
-- (void) _finishedDownload
-{    
-    downloadCompleted = YES;
-
-    if(path)
-        [self _saveFile];
-}
-
-- (void) _openAfterDownload:(BOOL)open
-{
-    shouldOpen = open;
-    if(shouldOpen && path && downloadCompleted)
-        [self _openFile];
-}
-
-- (void) _openFile
-{
-    CFURLRef pathURL;
-    pathURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)path, kCFURLPOSIXPathStyle, FALSE);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD,"Opening: %s", [path cString]);
-    LSOpenCFURLRef(pathURL, NULL);
-    CFRelease(pathURL);
-}
-
-- (void) _saveFile
-{
-    NSFileManager *fileManager;
-    
-    if(path){
-        // FIXME: Should probably not replace existing file
-        // FIXME: Should report error if there is one
-        fileManager = [NSFileManager defaultManager];
-        [fileManager createFileAtPath:path contents:[urlHandle resourceData] attributes:nil];
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Download complete. Saved to: %s", [path cString]);
-        
-        // Send Finder notification
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Notifying Finder");
-        FNNotifyByPath([[path stringByDeletingLastPathComponent] cString], kFNDirectoryModifiedMessage, kNilOptions);
-        
-        if(shouldOpen)
-            [self _openFile];
-    }
-}
-
- at end
-
- at implementation IFDownloadHandler (IFPrivate)
-
-- _initWithURLHandle:(IFURLHandle *)uHandle mimeHandler:(IFMIMEHandler *)mHandler
-{
-    _private = [[IFDownloadHandlerPrivate alloc] init];
-    [_private _setURLHandle:uHandle];
-    [_private _setMIMEHandler:mHandler];
-    
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Downloading: %s", [[[uHandle url] absoluteString] cString]);
-    
-    return self;
-}
-
-- (void) _receivedData:(NSData *)data
-{
-
-}
-
-- (void) _finishedDownload
-{
-    [_private _finishedDownload];
-}
-
- at end
\ No newline at end of file
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 56a5b3e..2b8e859 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -217,7 +217,6 @@
 				F5A672BB0263866E01000102,
 				F5A672BD0263866E01000102,
 				F5A357540265E57A01000102,
-				F5E6396B0266996101000102,
 				F544394F02674FD501FF6181,
 				F567433F026B5B7B01A80181,
 			);
@@ -267,7 +266,6 @@
 				F5A672BC0263866E01000102,
 				F5A672BE0263866E01000102,
 				F5A357530265E57A01000102,
-				F5E6396A0266996101000102,
 				F544395002674FD501FF6181,
 			);
 			isa = PBXSourcesBuildPhase;
@@ -1116,8 +1114,8 @@
 		};
 		F544394E02674FD501FF6181 = {
 			isa = PBXFileReference;
-			name = IFDownloadHandler.m;
-			path = MIME.subproj/IFDownloadHandler.m;
+			name = IFDownloadHandler.mm;
+			path = MIME.subproj/IFDownloadHandler.mm;
 			refType = 4;
 		};
 		F544394F02674FD501FF6181 = {
@@ -1421,30 +1419,6 @@
 			settings = {
 			};
 		};
-		F5E639680266996101000102 = {
-			isa = PBXFileReference;
-			name = IFDownloadHandlerPrivate.m;
-			path = MIME.subproj/IFDownloadHandlerPrivate.m;
-			refType = 4;
-		};
-		F5E639690266996101000102 = {
-			isa = PBXFileReference;
-			name = IFDownloadHandlerPrivate.h;
-			path = MIME.subproj/IFDownloadHandlerPrivate.h;
-			refType = 4;
-		};
-		F5E6396A0266996101000102 = {
-			fileRef = F5E639680266996101000102;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		F5E6396B0266996101000102 = {
-			fileRef = F5E639690266996101000102;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 		F5EBC45202134BB601CA1520 = {
 			children = (
 				F5EBC45502134BC301CA1520,
@@ -1506,8 +1480,6 @@
 				F5A357520265E57A01000102,
 				F544394D02674FD501FF6181,
 				F544394E02674FD501FF6181,
-				F5E639690266996101000102,
-				F5E639680266996101000102,
 			);
 			isa = PBXGroup;
 			name = MIME;
diff --git a/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm b/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm
index 6dac93b..2ea6a00 100644
--- a/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm
+++ b/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm
@@ -109,20 +109,21 @@
         
     // Check to see if this is these are the first bits of a provisional data source,
     // if so we need to transition the data source from provisional to committed.
-    if([frame provisionalDataSource] == dataSource){
+    // This transition is only done for the IFContentPolicyShow policy.
+    if([frame provisionalDataSource] == dataSource && [dataSource _contentPolicy] == IFContentPolicyShow){
         WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "committing resource = %s\n", [[[dataSource inputURL] absoluteString] cString]);
         [frame _transitionProvisionalToCommitted];
     }
 
     // This resouce has completed, so check if the load is complete for all frames.
     if (progress->bytesSoFar == progress->totalToLoad){
-        // If the load is complete, make the primary load as done.  The primary load is the load
+        // If the load is complete, mark the primary load as done.  The primary load is the load
         // of the main document.  Other resources may still be arriving.
         [dataSource _setPrimaryLoadComplete: YES];
         [frame _checkLoadCompleteResource: resourceDescription error: nil  isMainDocument: YES];
     }
     else {
-        // If the frame isn't complete is might be ready for a layout.  Perform that check here.
+        // If the frame isn't complete it might be ready for a layout.  Perform that check here.
         // Note that transitioning a frame to this state doesn't guarantee a layout, rather it
         // just indicates that an early layout can be performed.
         int timedLayoutSize = [[IFPreferences standardPreferences] _initialTimedLayoutSize];
diff --git a/WebKit/WebView.subproj/IFMainURLHandleClient.mm b/WebKit/WebView.subproj/IFMainURLHandleClient.mm
index 0af69b7..9bfdac0 100644
--- a/WebKit/WebView.subproj/IFMainURLHandleClient.mm
+++ b/WebKit/WebView.subproj/IFMainURLHandleClient.mm
@@ -13,10 +13,13 @@
 #import <WebKit/IFMIMEDatabase.h>
 #import <WebKit/WebKitDebug.h>
 #import <WebKit/IFContentHandler.h>
-#import <WebKit/IFDownloadHandlerPrivate.h>
+#import <WebKit/IFDownloadHandler.h>
+#import <WebKit/IFWebDataSource.h>
 #import <WebKit/IFWebDataSourcePrivate.h>
 #import <WebKit/IFWebController.h>
 #import <WebKit/IFLocationChangeHandler.h>
+#import <WebKit/IFWebFrame.h>
+#import <WebKit/IFWebFramePrivate.h>
 
 #import <WebFoundation/IFError.h>
 #import <WebFoundation/IFURLHandle.h>
@@ -85,11 +88,13 @@
         }
     }
     
-    else if([dataSource _contentPolicy] == IFContentPolicySave) 
-        [IFMIMEHandler saveFileWithPath:[dataSource _downloadPath] andData:[sender resourceData]];
-               
-    else if([dataSource _contentPolicy] == IFContentPolicyOpenExternally)
-        [IFMIMEHandler saveAndOpenFileWithPath:[dataSource _downloadPath] andData:[sender resourceData]];
+    else if([dataSource _contentPolicy] == IFContentPolicySave || 
+            [dataSource _contentPolicy] == IFContentPolicyOpenExternally){
+        // FIXME [cblu]: We shouldn't wait for the download to end to write to the disk.
+        // Will fix once we there is an IFURLHandle flag to not memory cache 
+        [downloadHandler downloadCompletedWithData:[sender resourceData]];
+        [downloadHandler release];
+    }
 
     IFLoadProgress *loadProgress = [[IFLoadProgress alloc] init];
     loadProgress->totalToLoad = [data length];
@@ -104,12 +109,13 @@
     NSString *fakeHTMLDocument;
     const char *fakeHTMLDocumentBytes;
     IFContentHandler *contentHandler;
+    IFWebFrame *frame;
     
     WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", [[[sender url] absoluteString] cString], data, [data length]);
     
     // check the mime type
     if(!typeChecked){
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Main URL's contentType: %s", [[sender contentType] cString]);
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", [[sender contentType] cString]);
         [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:[sender contentType]];
         mimeHandler = [[[IFMIMEDatabase sharedMIMEDatabase] MIMEHandlerForMIMEType:[sender contentType]] retain];
         handlerType = [mimeHandler handlerType];
@@ -150,7 +156,15 @@
     
     else if([dataSource _contentPolicy] == IFContentPolicySave || 
             [dataSource _contentPolicy] == IFContentPolicyOpenExternally){
-        
+            if(!downloadStarted){
+                downloadHandler = [[IFDownloadHandler alloc] initWithDataSource:dataSource];
+                frame = [dataSource webFrame];
+                // FIXME: need a cleaner way for the frame to let go of the data source
+                frame->_private->provisionalDataSource = nil; 
+                [[dataSource _locationChangeHandler] locationChangeDone:nil];
+                downloadStarted = YES;
+            }
+            WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", [sender contentLengthReceived], [sender contentLength]);
     }
     
     // update progress
diff --git a/WebKit/WebView.subproj/IFWebDataSource.h b/WebKit/WebView.subproj/IFWebDataSource.h
index c1cf6b8..96f6f22 100644
--- a/WebKit/WebView.subproj/IFWebDataSource.h
+++ b/WebKit/WebView.subproj/IFWebDataSource.h
@@ -7,6 +7,8 @@
 
 #import <Cocoa/Cocoa.h>
 
+#import <WebKit/IFLocationChangeHandler.h>
+
 /* 
     =============================================================================
    
@@ -51,6 +53,9 @@
 // Return the frame that represents this data source.
 - (IFWebFrame *)frame;
 
+// Return the frame that represents this data source. Same as above.
+- (IFWebFrame *)webFrame;
+
 // Add a child frame.  This should only be called by the data source's controller
 // as a result of a createFrame:inParent:.
 // [Should this be private?]
@@ -143,4 +148,6 @@
 
 - (NSString *)frameName;
 
+- (IFContentPolicy)contentPolicy;
+
 @end
diff --git a/WebKit/WebView.subproj/IFWebDataSource.mm b/WebKit/WebView.subproj/IFWebDataSource.mm
index ddc9ed1..ce0537b 100644
--- a/WebKit/WebView.subproj/IFWebDataSource.mm
+++ b/WebKit/WebView.subproj/IFWebDataSource.mm
@@ -68,6 +68,12 @@ static id IFWebDataSourceMake(void *handle)
     return [_private->controller frameForDataSource: self];
 }
 
+// This was adding to avoid collision with NSView
+- (IFWebFrame *)webFrame
+{
+    return [self frame];
+}
+
 // Returns the name of the frame containing this data source, or nil
 // if the data source is not in a frame set.
 - (NSString *)frameName 
@@ -313,4 +319,9 @@ static id IFWebDataSourceMake(void *handle)
     return _private->pageTitle;
 }
 
+- (IFContentPolicy) contentPolicy
+{
+    return _private->contentPolicy;
+}
+
 @end
diff --git a/WebKit/WebView.subproj/WebDataSource.h b/WebKit/WebView.subproj/WebDataSource.h
index c1cf6b8..96f6f22 100644
--- a/WebKit/WebView.subproj/WebDataSource.h
+++ b/WebKit/WebView.subproj/WebDataSource.h
@@ -7,6 +7,8 @@
 
 #import <Cocoa/Cocoa.h>
 
+#import <WebKit/IFLocationChangeHandler.h>
+
 /* 
     =============================================================================
    
@@ -51,6 +53,9 @@
 // Return the frame that represents this data source.
 - (IFWebFrame *)frame;
 
+// Return the frame that represents this data source. Same as above.
+- (IFWebFrame *)webFrame;
+
 // Add a child frame.  This should only be called by the data source's controller
 // as a result of a createFrame:inParent:.
 // [Should this be private?]
@@ -143,4 +148,6 @@
 
 - (NSString *)frameName;
 
+- (IFContentPolicy)contentPolicy;
+
 @end
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index ddc9ed1..ce0537b 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -68,6 +68,12 @@ static id IFWebDataSourceMake(void *handle)
     return [_private->controller frameForDataSource: self];
 }
 
+// This was adding to avoid collision with NSView
+- (IFWebFrame *)webFrame
+{
+    return [self frame];
+}
+
 // Returns the name of the frame containing this data source, or nil
 // if the data source is not in a frame set.
 - (NSString *)frameName 
@@ -313,4 +319,9 @@ static id IFWebDataSourceMake(void *handle)
     return _private->pageTitle;
 }
 
+- (IFContentPolicy) contentPolicy
+{
+    return _private->contentPolicy;
+}
+
 @end
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 0af69b7..9bfdac0 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -13,10 +13,13 @@
 #import <WebKit/IFMIMEDatabase.h>
 #import <WebKit/WebKitDebug.h>
 #import <WebKit/IFContentHandler.h>
-#import <WebKit/IFDownloadHandlerPrivate.h>
+#import <WebKit/IFDownloadHandler.h>
+#import <WebKit/IFWebDataSource.h>
 #import <WebKit/IFWebDataSourcePrivate.h>
 #import <WebKit/IFWebController.h>
 #import <WebKit/IFLocationChangeHandler.h>
+#import <WebKit/IFWebFrame.h>
+#import <WebKit/IFWebFramePrivate.h>
 
 #import <WebFoundation/IFError.h>
 #import <WebFoundation/IFURLHandle.h>
@@ -85,11 +88,13 @@
         }
     }
     
-    else if([dataSource _contentPolicy] == IFContentPolicySave) 
-        [IFMIMEHandler saveFileWithPath:[dataSource _downloadPath] andData:[sender resourceData]];
-               
-    else if([dataSource _contentPolicy] == IFContentPolicyOpenExternally)
-        [IFMIMEHandler saveAndOpenFileWithPath:[dataSource _downloadPath] andData:[sender resourceData]];
+    else if([dataSource _contentPolicy] == IFContentPolicySave || 
+            [dataSource _contentPolicy] == IFContentPolicyOpenExternally){
+        // FIXME [cblu]: We shouldn't wait for the download to end to write to the disk.
+        // Will fix once we there is an IFURLHandle flag to not memory cache 
+        [downloadHandler downloadCompletedWithData:[sender resourceData]];
+        [downloadHandler release];
+    }
 
     IFLoadProgress *loadProgress = [[IFLoadProgress alloc] init];
     loadProgress->totalToLoad = [data length];
@@ -104,12 +109,13 @@
     NSString *fakeHTMLDocument;
     const char *fakeHTMLDocumentBytes;
     IFContentHandler *contentHandler;
+    IFWebFrame *frame;
     
     WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", [[[sender url] absoluteString] cString], data, [data length]);
     
     // check the mime type
     if(!typeChecked){
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Main URL's contentType: %s", [[sender contentType] cString]);
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", [[sender contentType] cString]);
         [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:[sender contentType]];
         mimeHandler = [[[IFMIMEDatabase sharedMIMEDatabase] MIMEHandlerForMIMEType:[sender contentType]] retain];
         handlerType = [mimeHandler handlerType];
@@ -150,7 +156,15 @@
     
     else if([dataSource _contentPolicy] == IFContentPolicySave || 
             [dataSource _contentPolicy] == IFContentPolicyOpenExternally){
-        
+            if(!downloadStarted){
+                downloadHandler = [[IFDownloadHandler alloc] initWithDataSource:dataSource];
+                frame = [dataSource webFrame];
+                // FIXME: need a cleaner way for the frame to let go of the data source
+                frame->_private->provisionalDataSource = nil; 
+                [[dataSource _locationChangeHandler] locationChangeDone:nil];
+                downloadStarted = YES;
+            }
+            WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", [sender contentLengthReceived], [sender contentLength]);
     }
     
     // update progress
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 0af69b7..9bfdac0 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -13,10 +13,13 @@
 #import <WebKit/IFMIMEDatabase.h>
 #import <WebKit/WebKitDebug.h>
 #import <WebKit/IFContentHandler.h>
-#import <WebKit/IFDownloadHandlerPrivate.h>
+#import <WebKit/IFDownloadHandler.h>
+#import <WebKit/IFWebDataSource.h>
 #import <WebKit/IFWebDataSourcePrivate.h>
 #import <WebKit/IFWebController.h>
 #import <WebKit/IFLocationChangeHandler.h>
+#import <WebKit/IFWebFrame.h>
+#import <WebKit/IFWebFramePrivate.h>
 
 #import <WebFoundation/IFError.h>
 #import <WebFoundation/IFURLHandle.h>
@@ -85,11 +88,13 @@
         }
     }
     
-    else if([dataSource _contentPolicy] == IFContentPolicySave) 
-        [IFMIMEHandler saveFileWithPath:[dataSource _downloadPath] andData:[sender resourceData]];
-               
-    else if([dataSource _contentPolicy] == IFContentPolicyOpenExternally)
-        [IFMIMEHandler saveAndOpenFileWithPath:[dataSource _downloadPath] andData:[sender resourceData]];
+    else if([dataSource _contentPolicy] == IFContentPolicySave || 
+            [dataSource _contentPolicy] == IFContentPolicyOpenExternally){
+        // FIXME [cblu]: We shouldn't wait for the download to end to write to the disk.
+        // Will fix once we there is an IFURLHandle flag to not memory cache 
+        [downloadHandler downloadCompletedWithData:[sender resourceData]];
+        [downloadHandler release];
+    }
 
     IFLoadProgress *loadProgress = [[IFLoadProgress alloc] init];
     loadProgress->totalToLoad = [data length];
@@ -104,12 +109,13 @@
     NSString *fakeHTMLDocument;
     const char *fakeHTMLDocumentBytes;
     IFContentHandler *contentHandler;
+    IFWebFrame *frame;
     
     WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", [[[sender url] absoluteString] cString], data, [data length]);
     
     // check the mime type
     if(!typeChecked){
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Main URL's contentType: %s", [[sender contentType] cString]);
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", [[sender contentType] cString]);
         [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:[sender contentType]];
         mimeHandler = [[[IFMIMEDatabase sharedMIMEDatabase] MIMEHandlerForMIMEType:[sender contentType]] retain];
         handlerType = [mimeHandler handlerType];
@@ -150,7 +156,15 @@
     
     else if([dataSource _contentPolicy] == IFContentPolicySave || 
             [dataSource _contentPolicy] == IFContentPolicyOpenExternally){
-        
+            if(!downloadStarted){
+                downloadHandler = [[IFDownloadHandler alloc] initWithDataSource:dataSource];
+                frame = [dataSource webFrame];
+                // FIXME: need a cleaner way for the frame to let go of the data source
+                frame->_private->provisionalDataSource = nil; 
+                [[dataSource _locationChangeHandler] locationChangeDone:nil];
+                downloadStarted = YES;
+            }
+            WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", [sender contentLengthReceived], [sender contentLength]);
     }
     
     // update progress

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list