[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:20:29 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit f5407b6d3ba5544168d249802b63e78e67f00863
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jun 19 04:40:15 2002 +0000
WebBrowser:
Only have "View Source", "Save As" and "Print" menu items enabled
if currently at a web page and that web page is not loading.
Renamed content policy API's to include the data source.
* BrowserDocument.m:
(-[BrowserDocument validateUserInterfaceItem:]):
* LocationChangeHandler.m:
(-[LocationChangeHandler requestContentPolicyForMIMEType:dataSource:]):
(-[LocationChangeHandler unableToImplementContentPolicy:forDataSource:]):
* WebBrowser.pbproj/project.pbxproj:
WebKit:
Enabled the viewing of plug-in content inline
(aka direct links to plugin media). Made IFPluginView a
IFDocumentView and IFPluginStream a IFDocumentRespresentation.
Renamed content policy API's to include the data source.
* Plugins.subproj/IFPluginDatabase.h:
* Plugins.subproj/IFPluginDatabase.m:
(+[IFPluginDatabase installedPlugins]): registers plugins as IFDocument*
* Plugins.subproj/IFPluginStream.h:
* Plugins.subproj/IFPluginStream.mm:
(-[IFPluginStream init]): added for IFDocumentRepresentation
(-[IFPluginStream initWithURL:pluginPointer:notifyData:attributes:]): removed load initiliazatoin
(-[IFPluginStream dealloc]):
(-[IFPluginStream startLoad]): added
(-[IFPluginStream stop]):
(-[IFPluginStream receivedData:]): added as the base implementation
(-[IFPluginStream receivedError]): added as the base implementation
(-[IFPluginStream finishedLoadingWithData:]): added as the base implementation
(-[IFPluginStream receivedData:withDataSource:]): added for IFDocumentRepresentation
(-[IFPluginStream receivedError:withDataSource:]): added for IFDocumentRepresentation
(-[IFPluginStream finishedLoadingWithDataSource:]): added for IFDocumentRepresentation
(-[IFPluginStream IFURLHandleResourceDidBeginLoading:]):
(-[IFPluginStream IFURLHandle:resourceDataDidBecomeAvailable:]): call receivedData
(-[IFPluginStream IFURLHandleResourceDidFinishLoading:data:]): call finishedLoadingWithData
(-[IFPluginStream IFURLHandleResourceDidCancelLoading:]): call receivedError
(-[IFPluginStream IFURLHandle:resourceDidFailLoadingWithResult:]): call receivedError
(-[IFPluginStream IFURLHandle:didRedirectToURL:]):
* Plugins.subproj/IFPluginView.h:
* Plugins.subproj/IFPluginView.mm:
(-[IFPluginView initWithFrame:plugin:url:mime:arguments:]): removed special-case code for NP_FULL mose
(-[IFPluginView start]):
(-[IFPluginView initWithFrame:]): added for IFDocumentView
(-[IFPluginView provisionalDataSourceChanged:]): added for IFDocumentView
(-[IFPluginView provisionalDataSourceCommitted:]): added for IFDocumentView
(-[IFPluginView dataSourceUpdated:]): added for IFDocumentView
(-[IFPluginView layout]): added for IFDocumentView
(-[IFPluginView removeFromSuperview]): call stop
(-[IFPluginView loadURL:inTarget:withNotifyData:andHandleAttributes:]):
(-[IFPluginView pluginInstance]): added
* WebCoreSupport.subproj/IFWebCoreViewFactory.m:
(-[IFWebCoreViewFactory viewForPluginWithURL:serviceType:arguments:baseURL:]): call new init method
(-[IFWebCoreViewFactory viewForJavaAppletWithArguments:]): call new init method
* WebKit.pbproj/project.pbxproj:
* WebView.subproj/IFLocationChangeHandler.h: content policy method name changes
* WebView.subproj/IFMainURLHandleClient.mm:
(-[IFMainURLHandleClient IFURLHandle:resourceDataDidBecomeAvailable:]): content policy method name changes
* WebView.subproj/IFWebController.h:
* WebView.subproj/IFWebController.mm:
(-[IFWebController haveContentPolicy:andPath:forDataSource:]): content policy method name changes
* WebView.subproj/IFWebDataSourcePrivate.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1399 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 643d6a5..9b08107 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,57 @@
+2002-06-18 Chris Blumenberg <cblu at apple.com>
+
+ Enabled the viewing of plug-in content inline
+ (aka direct links to plugin media). Made IFPluginView a
+ IFDocumentView and IFPluginStream a IFDocumentRespresentation.
+
+ Renamed content policy API's to include the data source.
+
+ * Plugins.subproj/IFPluginDatabase.h:
+ * Plugins.subproj/IFPluginDatabase.m:
+ (+[IFPluginDatabase installedPlugins]): registers plugins as IFDocument*
+ * Plugins.subproj/IFPluginStream.h:
+ * Plugins.subproj/IFPluginStream.mm:
+ (-[IFPluginStream init]): added for IFDocumentRepresentation
+ (-[IFPluginStream initWithURL:pluginPointer:notifyData:attributes:]): removed load initiliazatoin
+ (-[IFPluginStream dealloc]):
+ (-[IFPluginStream startLoad]): added
+ (-[IFPluginStream stop]):
+ (-[IFPluginStream receivedData:]): added as the base implementation
+ (-[IFPluginStream receivedError]): added as the base implementation
+ (-[IFPluginStream finishedLoadingWithData:]): added as the base implementation
+ (-[IFPluginStream receivedData:withDataSource:]): added for IFDocumentRepresentation
+ (-[IFPluginStream receivedError:withDataSource:]): added for IFDocumentRepresentation
+ (-[IFPluginStream finishedLoadingWithDataSource:]): added for IFDocumentRepresentation
+ (-[IFPluginStream IFURLHandleResourceDidBeginLoading:]):
+ (-[IFPluginStream IFURLHandle:resourceDataDidBecomeAvailable:]): call receivedData
+ (-[IFPluginStream IFURLHandleResourceDidFinishLoading:data:]): call finishedLoadingWithData
+ (-[IFPluginStream IFURLHandleResourceDidCancelLoading:]): call receivedError
+ (-[IFPluginStream IFURLHandle:resourceDidFailLoadingWithResult:]): call receivedError
+ (-[IFPluginStream IFURLHandle:didRedirectToURL:]):
+ * Plugins.subproj/IFPluginView.h:
+ * Plugins.subproj/IFPluginView.mm:
+ (-[IFPluginView initWithFrame:plugin:url:mime:arguments:]): removed special-case code for NP_FULL mose
+ (-[IFPluginView start]):
+ (-[IFPluginView initWithFrame:]): added for IFDocumentView
+ (-[IFPluginView provisionalDataSourceChanged:]): added for IFDocumentView
+ (-[IFPluginView provisionalDataSourceCommitted:]): added for IFDocumentView
+ (-[IFPluginView dataSourceUpdated:]): added for IFDocumentView
+ (-[IFPluginView layout]): added for IFDocumentView
+ (-[IFPluginView removeFromSuperview]): call stop
+ (-[IFPluginView loadURL:inTarget:withNotifyData:andHandleAttributes:]):
+ (-[IFPluginView pluginInstance]): added
+ * WebCoreSupport.subproj/IFWebCoreViewFactory.m:
+ (-[IFWebCoreViewFactory viewForPluginWithURL:serviceType:arguments:baseURL:]): call new init method
+ (-[IFWebCoreViewFactory viewForJavaAppletWithArguments:]): call new init method
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/IFLocationChangeHandler.h: content policy method name changes
+ * WebView.subproj/IFMainURLHandleClient.mm:
+ (-[IFMainURLHandleClient IFURLHandle:resourceDataDidBecomeAvailable:]): content policy method name changes
+ * WebView.subproj/IFWebController.h:
+ * WebView.subproj/IFWebController.mm:
+ (-[IFWebController haveContentPolicy:andPath:forDataSource:]): content policy method name changes
+ * WebView.subproj/IFWebDataSourcePrivate.h:
+
2002-06-18 Kenneth Kocienda <kocienda at apple.com>
Fix for this bug:
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 643d6a5..9b08107 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,57 @@
+2002-06-18 Chris Blumenberg <cblu at apple.com>
+
+ Enabled the viewing of plug-in content inline
+ (aka direct links to plugin media). Made IFPluginView a
+ IFDocumentView and IFPluginStream a IFDocumentRespresentation.
+
+ Renamed content policy API's to include the data source.
+
+ * Plugins.subproj/IFPluginDatabase.h:
+ * Plugins.subproj/IFPluginDatabase.m:
+ (+[IFPluginDatabase installedPlugins]): registers plugins as IFDocument*
+ * Plugins.subproj/IFPluginStream.h:
+ * Plugins.subproj/IFPluginStream.mm:
+ (-[IFPluginStream init]): added for IFDocumentRepresentation
+ (-[IFPluginStream initWithURL:pluginPointer:notifyData:attributes:]): removed load initiliazatoin
+ (-[IFPluginStream dealloc]):
+ (-[IFPluginStream startLoad]): added
+ (-[IFPluginStream stop]):
+ (-[IFPluginStream receivedData:]): added as the base implementation
+ (-[IFPluginStream receivedError]): added as the base implementation
+ (-[IFPluginStream finishedLoadingWithData:]): added as the base implementation
+ (-[IFPluginStream receivedData:withDataSource:]): added for IFDocumentRepresentation
+ (-[IFPluginStream receivedError:withDataSource:]): added for IFDocumentRepresentation
+ (-[IFPluginStream finishedLoadingWithDataSource:]): added for IFDocumentRepresentation
+ (-[IFPluginStream IFURLHandleResourceDidBeginLoading:]):
+ (-[IFPluginStream IFURLHandle:resourceDataDidBecomeAvailable:]): call receivedData
+ (-[IFPluginStream IFURLHandleResourceDidFinishLoading:data:]): call finishedLoadingWithData
+ (-[IFPluginStream IFURLHandleResourceDidCancelLoading:]): call receivedError
+ (-[IFPluginStream IFURLHandle:resourceDidFailLoadingWithResult:]): call receivedError
+ (-[IFPluginStream IFURLHandle:didRedirectToURL:]):
+ * Plugins.subproj/IFPluginView.h:
+ * Plugins.subproj/IFPluginView.mm:
+ (-[IFPluginView initWithFrame:plugin:url:mime:arguments:]): removed special-case code for NP_FULL mose
+ (-[IFPluginView start]):
+ (-[IFPluginView initWithFrame:]): added for IFDocumentView
+ (-[IFPluginView provisionalDataSourceChanged:]): added for IFDocumentView
+ (-[IFPluginView provisionalDataSourceCommitted:]): added for IFDocumentView
+ (-[IFPluginView dataSourceUpdated:]): added for IFDocumentView
+ (-[IFPluginView layout]): added for IFDocumentView
+ (-[IFPluginView removeFromSuperview]): call stop
+ (-[IFPluginView loadURL:inTarget:withNotifyData:andHandleAttributes:]):
+ (-[IFPluginView pluginInstance]): added
+ * WebCoreSupport.subproj/IFWebCoreViewFactory.m:
+ (-[IFWebCoreViewFactory viewForPluginWithURL:serviceType:arguments:baseURL:]): call new init method
+ (-[IFWebCoreViewFactory viewForJavaAppletWithArguments:]): call new init method
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/IFLocationChangeHandler.h: content policy method name changes
+ * WebView.subproj/IFMainURLHandleClient.mm:
+ (-[IFMainURLHandleClient IFURLHandle:resourceDataDidBecomeAvailable:]): content policy method name changes
+ * WebView.subproj/IFWebController.h:
+ * WebView.subproj/IFWebController.mm:
+ (-[IFWebController haveContentPolicy:andPath:forDataSource:]): content policy method name changes
+ * WebView.subproj/IFWebDataSourcePrivate.h:
+
2002-06-18 Kenneth Kocienda <kocienda at apple.com>
Fix for this bug:
diff --git a/WebKit/Plugins.subproj/IFPluginDatabase.h b/WebKit/Plugins.subproj/IFPluginDatabase.h
index dc3984d..2d76187 100644
--- a/WebKit/Plugins.subproj/IFPluginDatabase.h
+++ b/WebKit/Plugins.subproj/IFPluginDatabase.h
@@ -24,7 +24,8 @@
*/
#import <Foundation/Foundation.h>
-#import <IFPlugin.h>
+
+ at class IFPlugin;
@interface IFPluginDatabase : NSObject {
NSArray *plugins;
diff --git a/WebKit/Plugins.subproj/IFPluginDatabase.m b/WebKit/Plugins.subproj/IFPluginDatabase.m
index 7cc421a..05e77df 100644
--- a/WebKit/Plugins.subproj/IFPluginDatabase.m
+++ b/WebKit/Plugins.subproj/IFPluginDatabase.m
@@ -23,9 +23,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import "IFPluginDatabase.h"
-#import "WebKitDebug.h"
-
+#import <WebKit/IFPlugin.h>
+#import <WebKit/IFPluginStream.h>
+#import <WebKit/IFPluginView.h>
+#import <WebKit/IFPluginDatabase.h>
+#import <WebKit/IFWebView.h>
+#import <WebKit/IFWebDataSource.h>
+#import <WebKit/WebKitDebug.h>
NSArray *_pluginLocations(void);
NSArray *_findPlugins(void);
@@ -39,6 +43,17 @@ static IFPluginDatabase *__IFPluginDatabase = nil;
if(!__IFPluginDatabase){
__IFPluginDatabase = [IFPluginDatabase alloc];
__IFPluginDatabase->plugins = _findPlugins();
+
+ // register plug-in IFDocumentViews and IFDocumentRepresentations
+ NSArray *mimes = [__IFPluginDatabase MIMETypes];
+ NSString *mime;
+ unsigned i;
+
+ for(i=0; i<[mimes count]; i++){
+ mime = [mimes objectAtIndex:i];
+ [IFWebView registerViewClass:[IFPluginView class] forMIMEType:mime];
+ [IFWebDataSource registerRepresentationClass:[IFPluginStream class] forMIMEType:mime];
+ }
}
return __IFPluginDatabase;
}
diff --git a/WebKit/Plugins.subproj/IFPluginStream.h b/WebKit/Plugins.subproj/IFPluginStream.h
index 2e72e2b..1701890 100644
--- a/WebKit/Plugins.subproj/IFPluginStream.h
+++ b/WebKit/Plugins.subproj/IFPluginStream.h
@@ -10,7 +10,9 @@
#import <WebKit/IFPluginView.h>
#import <WebKit/npapi.h>
- at interface IFPluginStream : NSObject
+ at protocol IFDocumentRepresentation;
+
+ at interface IFPluginStream : NSObject <IFDocumentRepresentation>
{
IFPluginView *view;
NSURL *URL;
@@ -19,8 +21,14 @@
int32 offset;
NPStream npStream;
NSString *path;
+ NSString *mimeType;
+ NSDictionary *attributes;
+
void *notifyData;
- BOOL receivedFirstChunk, stopped;
+
+ BOOL isFirstChunk;
+ BOOL stopped;
+
IFURLHandle *URLHandle;
NPP_NewStreamProcPtr NPP_NewStream;
@@ -35,5 +43,6 @@
- initWithURL:(NSURL *)theURL pluginPointer:(NPP)thePluginPointer notifyData:(void *)theNotifyData;
- initWithURL:(NSURL *)theURL pluginPointer:(NPP)thePluginPointer notifyData:(void *)theNotifyData attributes:(NSDictionary *)theAttributes;
+- (void)startLoad;
- (void)stop;
@end
diff --git a/WebKit/Plugins.subproj/IFPluginStream.mm b/WebKit/Plugins.subproj/IFPluginStream.mm
index 52a985d..27fafd3 100644
--- a/WebKit/Plugins.subproj/IFPluginStream.mm
+++ b/WebKit/Plugins.subproj/IFPluginStream.mm
@@ -5,6 +5,8 @@
#import <WebKit/IFLoadProgress.h>
#import <WebKit/IFPluginStream.h>
+#import <WebKit/IFWebView.h>
+#import <WebKit/IFWebDataSource.h>
#import <WebKit/IFWebControllerPrivate.h>
#import <WebKitDebug.h>
@@ -15,6 +17,16 @@ static NSString *getCarbonPath(NSString *posixPath);
@implementation IFPluginStream
+- init
+{
+ [super init];
+
+ isFirstChunk = YES;
+ stopped = YES;
+
+ return self;
+}
+
- initWithURL:(NSURL *)theURL pluginPointer:(NPP)thePluginPointer
{
return [self initWithURL:theURL pluginPointer:thePluginPointer notifyData:nil attributes:nil];
@@ -26,10 +38,7 @@ static NSString *getCarbonPath(NSString *posixPath);
}
- initWithURL:(NSURL *)theURL pluginPointer:(NPP)thePluginPointer notifyData:(void *)theNotifyData attributes:(NSDictionary *)theAttributes
-{
- NSString *URLString;
- char * cURL;
-
+{
[super init];
if(!theURL)
@@ -40,6 +49,7 @@ static NSString *getCarbonPath(NSString *posixPath);
view = [(IFPluginView *)thePluginPointer->ndata retain];
URL = [theURL retain];
+ attributes = [theAttributes retain];
instance = thePluginPointer;
notifyData = theNotifyData;
@@ -50,27 +60,8 @@ static NSString *getCarbonPath(NSString *posixPath);
NPP_DestroyStream = [view NPP_DestroyStream];
NPP_URLNotify = [view NPP_URLNotify];
- URLString = [theURL absoluteString];
- cURL = (char *)malloc([URLString cStringLength]+1);
- [URLString getCString:cURL];
-
- npStream.ndata = self;
- npStream.url = cURL;
- npStream.end = 0;
- npStream.lastmodified = 0;
- npStream.notifyData = notifyData;
- offset = 0;
-
- receivedFirstChunk = NO;
- stopped = NO;
-
- URLHandle = [[IFURLHandle alloc] initWithURL:URL attributes:theAttributes flags:0];
- if(URLHandle){
- [URLHandle addClient:self];
- [URLHandle loadInBackground];
- }else{
- return nil;
- }
+ isFirstChunk = YES;
+ stopped = YES;
return self;
}
@@ -86,25 +77,43 @@ static NSString *getCarbonPath(NSString *posixPath);
}
free((void *)npStream.url);
[URL release];
+ [attributes release];
[super dealloc];
}
-- (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
+- (void)startLoad
{
- [[view webController] _didStartLoading:URL];
+ URLHandle = [[IFURLHandle alloc] initWithURL:URL attributes:attributes flags:0];
+ if(URLHandle){
+ [URLHandle addClient:self];
+ [URLHandle loadInBackground];
+ }
}
-- (void)IFURLHandle:(IFURLHandle *)sender resourceDataDidBecomeAvailable:(NSData *)data
+- (void)stop
+{
+ if(!stopped){
+ stopped = YES;
+ if([URLHandle statusCode] == IFURLHandleStatusLoading)
+ [URLHandle cancelLoadInBackground];
+ [URLHandle removeClient:self];
+ [URLHandle release];
+ }
+ [view release];
+ view = nil;
+}
+
+- (void)receivedData:(NSData *)data
{
int32 numBytes;
NPError npErr;
- if(!receivedFirstChunk){
- receivedFirstChunk = YES;
+ if(isFirstChunk){
+ isFirstChunk = NO;
//FIXME: Need a way to check if stream is seekable
- npErr = NPP_NewStream(instance, (char *)[[sender contentType] cString], &npStream, NO, &transferMode);
+ npErr = NPP_NewStream(instance, (char *)[mimeType cString], &npStream, NO, &transferMode);
WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_NewStream: %d %s\n", npErr, [[URL absoluteString] cString]);
if(npErr != NPERR_NO_ERROR){
@@ -134,19 +143,23 @@ static NSString *getCarbonPath(NSString *posixPath);
offset += [data length];
}
-
- [[view webController] _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
- forResourceHandle: sender fromDataSource: [view webDataSource] complete: NO];
}
-- (void)IFURLHandleResourceDidFinishLoading:(IFURLHandle *)sender data: (NSData *)data
+- (void)receivedError
+{
+ NPError npErr;
+
+ npErr = NPP_DestroyStream(instance, &npStream, NPRES_NETWORK_ERR);
+ WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_DestroyStream: %d\n", npErr);
+}
+
+- (void)finishedLoadingWithData:(NSData *)data
{
NPError npErr;
NSFileManager *fileManager;
NSString *filename;
- // FIXME: Need a better way to get a file name from a URL
- filename = [[URL absoluteString] lastPathComponent];
+ filename = [[URL path] lastPathComponent];
if(transferMode == NP_ASFILE || transferMode == NP_ASFILEONLY) {
// FIXME: Need to use something like mkstemp?
path = [[NSString stringWithFormat:@"/tmp/%@", filename] retain];
@@ -166,10 +179,83 @@ static NSString *getCarbonPath(NSString *posixPath);
WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_URLNotify\n");
}
- [[view webController] _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
- forResourceHandle: sender fromDataSource: [view webDataSource] complete: YES];
-
[self stop];
+}
+
+- (void)receivedData:(NSData *)data withDataSource:(IFWebDataSource *)dataSource
+{
+ if(isFirstChunk){
+ URL = [[dataSource inputURL] retain];
+ NSString *URLString = [URL absoluteString];
+ char *cURL = (char *)malloc([URLString cStringLength]+1);
+ [URLString getCString:cURL];
+
+ npStream.ndata = self;
+ npStream.url = cURL;
+ npStream.end = 0;
+ npStream.lastmodified = 0;
+ npStream.notifyData = 0;
+ offset = 0;
+ mimeType = [[dataSource contentType] retain];
+
+ IFWebFrame *frame = [dataSource webFrame];
+ IFWebView *webView = [frame webView];
+ view = [[webView documentView] retain];
+ instance = [view pluginInstance];
+
+ NPP_NewStream = [view NPP_NewStream];
+ NPP_WriteReady = [view NPP_WriteReady];
+ NPP_Write = [view NPP_Write];
+ NPP_StreamAsFile = [view NPP_StreamAsFile];
+ NPP_DestroyStream = [view NPP_DestroyStream];
+ NPP_URLNotify = [view NPP_URLNotify];
+ }
+ [self receivedData:data];
+}
+
+- (void)receivedError:(IFError *)error withDataSource:(IFWebDataSource *)dataSource
+{
+ [self receivedError];
+}
+
+- (void)finishedLoadingWithDataSource:(IFWebDataSource *)dataSource
+{
+ [self finishedLoadingWithData:[dataSource data]];
+}
+
+- (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
+{
+ [[view webController] _didStartLoading:URL];
+}
+
+- (void)IFURLHandle:(IFURLHandle *)sender resourceDataDidBecomeAvailable:(NSData *)data
+{
+ if(isFirstChunk){
+ NSString *URLString = [[sender url] absoluteString];
+ char *cURL = (char *)malloc([URLString cStringLength]+1);
+ [URLString getCString:cURL];
+
+ npStream.ndata = self;
+ npStream.url = cURL;
+ npStream.end = 0;
+ npStream.lastmodified = 0;
+ npStream.notifyData = notifyData;
+ offset = 0;
+ mimeType = [[sender contentType] retain];
+ }
+ [self receivedData:data];
+
+ [[view webController] _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
+ forResourceHandle: sender fromDataSource: [view webDataSource] complete: NO];
+}
+
+- (void)IFURLHandleResourceDidFinishLoading:(IFURLHandle *)sender data: (NSData *)data
+{
+ [[view webController] _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
+ forResourceHandle: sender fromDataSource: [view webDataSource] complete: YES];
+
+ [self finishedLoadingWithData:data];
+
[[view webController] _didStopLoading:URL];
}
@@ -177,8 +263,9 @@ static NSString *getCarbonPath(NSString *posixPath);
{
[[view webController] _receivedProgress:[IFLoadProgress progress]
forResourceHandle: sender fromDataSource: [view webDataSource] complete: YES];
+
+ [self receivedError];
- [self stop];
[[view webController] _didStopLoading:URL];
}
@@ -192,7 +279,8 @@ static NSString *getCarbonPath(NSString *posixPath);
partialProgress: loadProgress fromDataSource: [view webDataSource]];
[loadProgress release];
- [self stop];
+ [self receivedError];
+
[[view webController] _didStopLoading:URL];
}
@@ -203,19 +291,6 @@ static NSString *getCarbonPath(NSString *posixPath);
[[view webController] _didStartLoading:toURL];
}
-
-- (void)stop
-{
- if(!stopped){
- stopped = YES;
- if([URLHandle statusCode] == IFURLHandleStatusLoading)
- [URLHandle cancelLoadInBackground];
- [URLHandle removeClient:self];
- [URLHandle release];
- [view release];
- }
-}
-
@end
static NSString *getCarbonPath(NSString *posixPath)
diff --git a/WebKit/Plugins.subproj/IFPluginView.h b/WebKit/Plugins.subproj/IFPluginView.h
index f8ea6d7..accd2d4 100644
--- a/WebKit/Plugins.subproj/IFPluginView.h
+++ b/WebKit/Plugins.subproj/IFPluginView.h
@@ -13,8 +13,9 @@
@class IFWebDataSource;
@class IFPlugin;
@class IFWebController;
+ at protocol IFDocumentView;
- at interface IFPluginView : NSView
+ at interface IFPluginView : NSView <IFDocumentView>
{
IFPluginNullEventSender *eventSender;
unsigned argsCount;
@@ -28,7 +29,7 @@
NPWindow window;
NP_Port nPort;
NPP_t instanceStruct;
-
+
BOOL canRestart, isHidden, isStarted, fullMode;
NSString *mime;
@@ -52,12 +53,13 @@
NPP_SetValueProcPtr NPP_SetValue;
}
-- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plugin url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode;
+- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plugin url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments;
-(void)stop;
- (IFWebDataSource *)webDataSource;
- (IFWebController *)webController;
+(void)getCarbonEvent:(EventRecord *)carbonEvent;
+- (NPP)pluginInstance;
- (NPP_NewStreamProcPtr)NPP_NewStream;
- (NPP_WriteReadyProcPtr)NPP_WriteReady;
- (NPP_WriteProcPtr)NPP_Write;
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index 2d017a4..b2abe64 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -261,14 +261,12 @@ static char *newCString(NSString *string)
return cString;
}
-- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plugin url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode
+- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plugin url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments
{
NSString *baseURLString;
[super initWithFrame: r];
- // The following line doesn't work for Flash, so I have create a NPP_t struct and point to it
- //instance = malloc(sizeof(NPP_t));
instance = &instanceStruct;
instance->ndata = self;
@@ -300,37 +298,30 @@ static char *newCString(NSString *string)
baseURL = [[NSURL URLWithString:baseURLString] retain];
isHidden = [arguments objectForKey:@"hidden"] != nil;
- fullMode = [arguments objectForKey:@"wkfullmode"] != nil;
argsCount = 0;
- if (fullMode) {
- cAttributes = 0;
- cValues = 0;
- } else {
- // Convert arguments dictionary to 2 string arrays.
- // These arrays are passed to NPP_New, but the strings need to be
- // modifiable and live the entire life of the plugin.
-
- cAttributes = new char * [[arguments count]];
- cValues = new char * [[arguments count]];
-
- NSEnumerator *e = [arguments keyEnumerator];
- NSString *key;
- while ((key = [e nextObject])) {
- if (![key isEqualToString:@"wkfullmode"]) {
- cAttributes[argsCount] = newCString(key);
- cValues[argsCount] = newCString([arguments objectForKey:key]);
- argsCount++;
- }
- }
- }
+
+ // Convert arguments dictionary to 2 string arrays.
+ // These arrays are passed to NPP_New, but the strings need to be
+ // modifiable and live the entire life of the plugin.
+
+ cAttributes = new char * [[arguments count]];
+ cValues = new char * [[arguments count]];
+ NSEnumerator *e = [arguments keyEnumerator];
+ NSString *key;
+ while ((key = [e nextObject])) {
+ cAttributes[argsCount] = newCString(key);
+ cValues[argsCount] = newCString([arguments objectForKey:key]);
+ argsCount++;
+ }
streams = [[NSMutableArray alloc] init];
notificationData = [[NSMutableDictionary dictionaryWithCapacity:1] retain];
// Initialize globals
canRestart = YES;
isStarted = NO;
+ fullMode = NO;
return self;
}
@@ -394,7 +385,6 @@ static char *newCString(NSString *string)
-(void)start
{
- NPSavedData saved;
NPError npErr;
NSNotificationCenter *notificationCenter;
NSWindow *theWindow;
@@ -405,7 +395,7 @@ static char *newCString(NSString *string)
isStarted = YES;
- npErr = NPP_New((char *)[mime cString], instance, fullMode ? NP_FULL : NP_EMBED, argsCount, cAttributes, cValues, &saved);
+ npErr = NPP_New((char *)[mime cString], instance, fullMode ? NP_FULL : NP_EMBED, argsCount, cAttributes, cValues, NULL);
WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_New: %d\n", npErr);
// Create a WindowRef is one doesn't already exist
@@ -434,6 +424,7 @@ static char *newCString(NSString *string)
if(srcURL){
stream = [[IFPluginStream alloc] initWithURL:srcURL pluginPointer:instance];
if(stream){
+ [stream startLoad];
[streams addObject:stream];
[stream release];
}
@@ -491,6 +482,76 @@ static char *newCString(NSString *string)
return webController;
}
+#pragma mark IFDOCUMENTVIEW
+
+- initWithFrame:(NSRect)frame
+{
+ [super initWithFrame:frame];
+
+ instance = &instanceStruct;
+ instance->ndata = self;
+
+ argsCount = 0;
+ cAttributes = 0;
+ cValues = 0;
+
+ canRestart = YES;
+ isStarted = NO;
+ fullMode = YES;
+
+ [self setFrame:NSMakeRect(0, 0, 1, 1)];
+
+ return self;
+}
+
+- (void)provisionalDataSourceChanged:(IFWebDataSource *)dataSource
+{
+ IFPlugin *plugin;
+
+ mime = [[dataSource contentType] retain];
+ plugin = [[IFPluginDatabase installedPlugins] pluginForMimeType:mime];
+
+ if(![plugin load])
+ return;
+
+ // copy function pointers
+ NPP_New = [plugin NPP_New];
+ NPP_Destroy = [plugin NPP_Destroy];
+ NPP_SetWindow = [plugin NPP_SetWindow];
+ NPP_NewStream = [plugin NPP_NewStream];
+ NPP_WriteReady = [plugin NPP_WriteReady];
+ NPP_Write = [plugin NPP_Write];
+ NPP_StreamAsFile = [plugin NPP_StreamAsFile];
+ NPP_DestroyStream = [plugin NPP_DestroyStream];
+ NPP_HandleEvent = [plugin NPP_HandleEvent];
+ NPP_URLNotify = [plugin NPP_URLNotify];
+ NPP_GetValue = [plugin NPP_GetValue];
+ NPP_SetValue = [plugin NPP_SetValue];
+ NPP_Print = [plugin NPP_Print];
+
+ [self start];
+}
+
+- (void)provisionalDataSourceCommitted:(IFWebDataSource *)dataSource
+{
+
+}
+
+- (void)dataSourceUpdated:(IFWebDataSource *)dataSource
+{
+
+}
+
+- (void)layout
+{
+ NSRect superFrame = [[self _IF_parentWebView] frame];
+
+ [self setFrame:NSMakeRect(0, 0, superFrame.size.width, superFrame.size.height)];
+ [self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+}
+
+
+
#pragma mark NSVIEW
- (void)drawRect:(NSRect)rect
@@ -506,6 +567,12 @@ static char *newCString(NSString *string)
return YES;
}
+- (void)removeFromSuperview
+{
+ [self stop];
+ [super removeFromSuperview];
+}
+
#pragma mark NOTIFICATIONS
-(void) viewHasMoved:(NSNotification *)notification
@@ -591,6 +658,7 @@ static char *newCString(NSString *string)
if(!target){
stream = [[IFPluginStream alloc] initWithURL:url pluginPointer:instance notifyData:notifyData attributes:attributes];
if(stream){
+ [stream startLoad];
[streams addObject:stream];
[stream release];
}else{
@@ -753,6 +821,10 @@ static char *newCString(NSString *string)
[self sendUpdateEvent];
}
+- (NPP)pluginInstance
+{
+ return instance;
+}
- (NPP_NewStreamProcPtr)NPP_NewStream
{
diff --git a/WebKit/Plugins.subproj/WebPluginDatabase.h b/WebKit/Plugins.subproj/WebPluginDatabase.h
index dc3984d..2d76187 100644
--- a/WebKit/Plugins.subproj/WebPluginDatabase.h
+++ b/WebKit/Plugins.subproj/WebPluginDatabase.h
@@ -24,7 +24,8 @@
*/
#import <Foundation/Foundation.h>
-#import <IFPlugin.h>
+
+ at class IFPlugin;
@interface IFPluginDatabase : NSObject {
NSArray *plugins;
diff --git a/WebKit/Plugins.subproj/WebPluginDatabase.m b/WebKit/Plugins.subproj/WebPluginDatabase.m
index 7cc421a..05e77df 100644
--- a/WebKit/Plugins.subproj/WebPluginDatabase.m
+++ b/WebKit/Plugins.subproj/WebPluginDatabase.m
@@ -23,9 +23,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import "IFPluginDatabase.h"
-#import "WebKitDebug.h"
-
+#import <WebKit/IFPlugin.h>
+#import <WebKit/IFPluginStream.h>
+#import <WebKit/IFPluginView.h>
+#import <WebKit/IFPluginDatabase.h>
+#import <WebKit/IFWebView.h>
+#import <WebKit/IFWebDataSource.h>
+#import <WebKit/WebKitDebug.h>
NSArray *_pluginLocations(void);
NSArray *_findPlugins(void);
@@ -39,6 +43,17 @@ static IFPluginDatabase *__IFPluginDatabase = nil;
if(!__IFPluginDatabase){
__IFPluginDatabase = [IFPluginDatabase alloc];
__IFPluginDatabase->plugins = _findPlugins();
+
+ // register plug-in IFDocumentViews and IFDocumentRepresentations
+ NSArray *mimes = [__IFPluginDatabase MIMETypes];
+ NSString *mime;
+ unsigned i;
+
+ for(i=0; i<[mimes count]; i++){
+ mime = [mimes objectAtIndex:i];
+ [IFWebView registerViewClass:[IFPluginView class] forMIMEType:mime];
+ [IFWebDataSource registerRepresentationClass:[IFPluginStream class] forMIMEType:mime];
+ }
}
return __IFPluginDatabase;
}
diff --git a/WebKit/Plugins.subproj/WebPluginStream.h b/WebKit/Plugins.subproj/WebPluginStream.h
index 2e72e2b..1701890 100644
--- a/WebKit/Plugins.subproj/WebPluginStream.h
+++ b/WebKit/Plugins.subproj/WebPluginStream.h
@@ -10,7 +10,9 @@
#import <WebKit/IFPluginView.h>
#import <WebKit/npapi.h>
- at interface IFPluginStream : NSObject
+ at protocol IFDocumentRepresentation;
+
+ at interface IFPluginStream : NSObject <IFDocumentRepresentation>
{
IFPluginView *view;
NSURL *URL;
@@ -19,8 +21,14 @@
int32 offset;
NPStream npStream;
NSString *path;
+ NSString *mimeType;
+ NSDictionary *attributes;
+
void *notifyData;
- BOOL receivedFirstChunk, stopped;
+
+ BOOL isFirstChunk;
+ BOOL stopped;
+
IFURLHandle *URLHandle;
NPP_NewStreamProcPtr NPP_NewStream;
@@ -35,5 +43,6 @@
- initWithURL:(NSURL *)theURL pluginPointer:(NPP)thePluginPointer notifyData:(void *)theNotifyData;
- initWithURL:(NSURL *)theURL pluginPointer:(NPP)thePluginPointer notifyData:(void *)theNotifyData attributes:(NSDictionary *)theAttributes;
+- (void)startLoad;
- (void)stop;
@end
diff --git a/WebKit/Plugins.subproj/WebPluginStream.m b/WebKit/Plugins.subproj/WebPluginStream.m
index 52a985d..27fafd3 100644
--- a/WebKit/Plugins.subproj/WebPluginStream.m
+++ b/WebKit/Plugins.subproj/WebPluginStream.m
@@ -5,6 +5,8 @@
#import <WebKit/IFLoadProgress.h>
#import <WebKit/IFPluginStream.h>
+#import <WebKit/IFWebView.h>
+#import <WebKit/IFWebDataSource.h>
#import <WebKit/IFWebControllerPrivate.h>
#import <WebKitDebug.h>
@@ -15,6 +17,16 @@ static NSString *getCarbonPath(NSString *posixPath);
@implementation IFPluginStream
+- init
+{
+ [super init];
+
+ isFirstChunk = YES;
+ stopped = YES;
+
+ return self;
+}
+
- initWithURL:(NSURL *)theURL pluginPointer:(NPP)thePluginPointer
{
return [self initWithURL:theURL pluginPointer:thePluginPointer notifyData:nil attributes:nil];
@@ -26,10 +38,7 @@ static NSString *getCarbonPath(NSString *posixPath);
}
- initWithURL:(NSURL *)theURL pluginPointer:(NPP)thePluginPointer notifyData:(void *)theNotifyData attributes:(NSDictionary *)theAttributes
-{
- NSString *URLString;
- char * cURL;
-
+{
[super init];
if(!theURL)
@@ -40,6 +49,7 @@ static NSString *getCarbonPath(NSString *posixPath);
view = [(IFPluginView *)thePluginPointer->ndata retain];
URL = [theURL retain];
+ attributes = [theAttributes retain];
instance = thePluginPointer;
notifyData = theNotifyData;
@@ -50,27 +60,8 @@ static NSString *getCarbonPath(NSString *posixPath);
NPP_DestroyStream = [view NPP_DestroyStream];
NPP_URLNotify = [view NPP_URLNotify];
- URLString = [theURL absoluteString];
- cURL = (char *)malloc([URLString cStringLength]+1);
- [URLString getCString:cURL];
-
- npStream.ndata = self;
- npStream.url = cURL;
- npStream.end = 0;
- npStream.lastmodified = 0;
- npStream.notifyData = notifyData;
- offset = 0;
-
- receivedFirstChunk = NO;
- stopped = NO;
-
- URLHandle = [[IFURLHandle alloc] initWithURL:URL attributes:theAttributes flags:0];
- if(URLHandle){
- [URLHandle addClient:self];
- [URLHandle loadInBackground];
- }else{
- return nil;
- }
+ isFirstChunk = YES;
+ stopped = YES;
return self;
}
@@ -86,25 +77,43 @@ static NSString *getCarbonPath(NSString *posixPath);
}
free((void *)npStream.url);
[URL release];
+ [attributes release];
[super dealloc];
}
-- (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
+- (void)startLoad
{
- [[view webController] _didStartLoading:URL];
+ URLHandle = [[IFURLHandle alloc] initWithURL:URL attributes:attributes flags:0];
+ if(URLHandle){
+ [URLHandle addClient:self];
+ [URLHandle loadInBackground];
+ }
}
-- (void)IFURLHandle:(IFURLHandle *)sender resourceDataDidBecomeAvailable:(NSData *)data
+- (void)stop
+{
+ if(!stopped){
+ stopped = YES;
+ if([URLHandle statusCode] == IFURLHandleStatusLoading)
+ [URLHandle cancelLoadInBackground];
+ [URLHandle removeClient:self];
+ [URLHandle release];
+ }
+ [view release];
+ view = nil;
+}
+
+- (void)receivedData:(NSData *)data
{
int32 numBytes;
NPError npErr;
- if(!receivedFirstChunk){
- receivedFirstChunk = YES;
+ if(isFirstChunk){
+ isFirstChunk = NO;
//FIXME: Need a way to check if stream is seekable
- npErr = NPP_NewStream(instance, (char *)[[sender contentType] cString], &npStream, NO, &transferMode);
+ npErr = NPP_NewStream(instance, (char *)[mimeType cString], &npStream, NO, &transferMode);
WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_NewStream: %d %s\n", npErr, [[URL absoluteString] cString]);
if(npErr != NPERR_NO_ERROR){
@@ -134,19 +143,23 @@ static NSString *getCarbonPath(NSString *posixPath);
offset += [data length];
}
-
- [[view webController] _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
- forResourceHandle: sender fromDataSource: [view webDataSource] complete: NO];
}
-- (void)IFURLHandleResourceDidFinishLoading:(IFURLHandle *)sender data: (NSData *)data
+- (void)receivedError
+{
+ NPError npErr;
+
+ npErr = NPP_DestroyStream(instance, &npStream, NPRES_NETWORK_ERR);
+ WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_DestroyStream: %d\n", npErr);
+}
+
+- (void)finishedLoadingWithData:(NSData *)data
{
NPError npErr;
NSFileManager *fileManager;
NSString *filename;
- // FIXME: Need a better way to get a file name from a URL
- filename = [[URL absoluteString] lastPathComponent];
+ filename = [[URL path] lastPathComponent];
if(transferMode == NP_ASFILE || transferMode == NP_ASFILEONLY) {
// FIXME: Need to use something like mkstemp?
path = [[NSString stringWithFormat:@"/tmp/%@", filename] retain];
@@ -166,10 +179,83 @@ static NSString *getCarbonPath(NSString *posixPath);
WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_URLNotify\n");
}
- [[view webController] _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
- forResourceHandle: sender fromDataSource: [view webDataSource] complete: YES];
-
[self stop];
+}
+
+- (void)receivedData:(NSData *)data withDataSource:(IFWebDataSource *)dataSource
+{
+ if(isFirstChunk){
+ URL = [[dataSource inputURL] retain];
+ NSString *URLString = [URL absoluteString];
+ char *cURL = (char *)malloc([URLString cStringLength]+1);
+ [URLString getCString:cURL];
+
+ npStream.ndata = self;
+ npStream.url = cURL;
+ npStream.end = 0;
+ npStream.lastmodified = 0;
+ npStream.notifyData = 0;
+ offset = 0;
+ mimeType = [[dataSource contentType] retain];
+
+ IFWebFrame *frame = [dataSource webFrame];
+ IFWebView *webView = [frame webView];
+ view = [[webView documentView] retain];
+ instance = [view pluginInstance];
+
+ NPP_NewStream = [view NPP_NewStream];
+ NPP_WriteReady = [view NPP_WriteReady];
+ NPP_Write = [view NPP_Write];
+ NPP_StreamAsFile = [view NPP_StreamAsFile];
+ NPP_DestroyStream = [view NPP_DestroyStream];
+ NPP_URLNotify = [view NPP_URLNotify];
+ }
+ [self receivedData:data];
+}
+
+- (void)receivedError:(IFError *)error withDataSource:(IFWebDataSource *)dataSource
+{
+ [self receivedError];
+}
+
+- (void)finishedLoadingWithDataSource:(IFWebDataSource *)dataSource
+{
+ [self finishedLoadingWithData:[dataSource data]];
+}
+
+- (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
+{
+ [[view webController] _didStartLoading:URL];
+}
+
+- (void)IFURLHandle:(IFURLHandle *)sender resourceDataDidBecomeAvailable:(NSData *)data
+{
+ if(isFirstChunk){
+ NSString *URLString = [[sender url] absoluteString];
+ char *cURL = (char *)malloc([URLString cStringLength]+1);
+ [URLString getCString:cURL];
+
+ npStream.ndata = self;
+ npStream.url = cURL;
+ npStream.end = 0;
+ npStream.lastmodified = 0;
+ npStream.notifyData = notifyData;
+ offset = 0;
+ mimeType = [[sender contentType] retain];
+ }
+ [self receivedData:data];
+
+ [[view webController] _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
+ forResourceHandle: sender fromDataSource: [view webDataSource] complete: NO];
+}
+
+- (void)IFURLHandleResourceDidFinishLoading:(IFURLHandle *)sender data: (NSData *)data
+{
+ [[view webController] _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
+ forResourceHandle: sender fromDataSource: [view webDataSource] complete: YES];
+
+ [self finishedLoadingWithData:data];
+
[[view webController] _didStopLoading:URL];
}
@@ -177,8 +263,9 @@ static NSString *getCarbonPath(NSString *posixPath);
{
[[view webController] _receivedProgress:[IFLoadProgress progress]
forResourceHandle: sender fromDataSource: [view webDataSource] complete: YES];
+
+ [self receivedError];
- [self stop];
[[view webController] _didStopLoading:URL];
}
@@ -192,7 +279,8 @@ static NSString *getCarbonPath(NSString *posixPath);
partialProgress: loadProgress fromDataSource: [view webDataSource]];
[loadProgress release];
- [self stop];
+ [self receivedError];
+
[[view webController] _didStopLoading:URL];
}
@@ -203,19 +291,6 @@ static NSString *getCarbonPath(NSString *posixPath);
[[view webController] _didStartLoading:toURL];
}
-
-- (void)stop
-{
- if(!stopped){
- stopped = YES;
- if([URLHandle statusCode] == IFURLHandleStatusLoading)
- [URLHandle cancelLoadInBackground];
- [URLHandle removeClient:self];
- [URLHandle release];
- [view release];
- }
-}
-
@end
static NSString *getCarbonPath(NSString *posixPath)
diff --git a/WebKit/Plugins.subproj/WebPluginView.h b/WebKit/Plugins.subproj/WebPluginView.h
index f8ea6d7..accd2d4 100644
--- a/WebKit/Plugins.subproj/WebPluginView.h
+++ b/WebKit/Plugins.subproj/WebPluginView.h
@@ -13,8 +13,9 @@
@class IFWebDataSource;
@class IFPlugin;
@class IFWebController;
+ at protocol IFDocumentView;
- at interface IFPluginView : NSView
+ at interface IFPluginView : NSView <IFDocumentView>
{
IFPluginNullEventSender *eventSender;
unsigned argsCount;
@@ -28,7 +29,7 @@
NPWindow window;
NP_Port nPort;
NPP_t instanceStruct;
-
+
BOOL canRestart, isHidden, isStarted, fullMode;
NSString *mime;
@@ -52,12 +53,13 @@
NPP_SetValueProcPtr NPP_SetValue;
}
-- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plugin url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode;
+- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plugin url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments;
-(void)stop;
- (IFWebDataSource *)webDataSource;
- (IFWebController *)webController;
+(void)getCarbonEvent:(EventRecord *)carbonEvent;
+- (NPP)pluginInstance;
- (NPP_NewStreamProcPtr)NPP_NewStream;
- (NPP_WriteReadyProcPtr)NPP_WriteReady;
- (NPP_WriteProcPtr)NPP_Write;
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index 2d017a4..b2abe64 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -261,14 +261,12 @@ static char *newCString(NSString *string)
return cString;
}
-- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plugin url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode
+- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plugin url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments
{
NSString *baseURLString;
[super initWithFrame: r];
- // The following line doesn't work for Flash, so I have create a NPP_t struct and point to it
- //instance = malloc(sizeof(NPP_t));
instance = &instanceStruct;
instance->ndata = self;
@@ -300,37 +298,30 @@ static char *newCString(NSString *string)
baseURL = [[NSURL URLWithString:baseURLString] retain];
isHidden = [arguments objectForKey:@"hidden"] != nil;
- fullMode = [arguments objectForKey:@"wkfullmode"] != nil;
argsCount = 0;
- if (fullMode) {
- cAttributes = 0;
- cValues = 0;
- } else {
- // Convert arguments dictionary to 2 string arrays.
- // These arrays are passed to NPP_New, but the strings need to be
- // modifiable and live the entire life of the plugin.
-
- cAttributes = new char * [[arguments count]];
- cValues = new char * [[arguments count]];
-
- NSEnumerator *e = [arguments keyEnumerator];
- NSString *key;
- while ((key = [e nextObject])) {
- if (![key isEqualToString:@"wkfullmode"]) {
- cAttributes[argsCount] = newCString(key);
- cValues[argsCount] = newCString([arguments objectForKey:key]);
- argsCount++;
- }
- }
- }
+
+ // Convert arguments dictionary to 2 string arrays.
+ // These arrays are passed to NPP_New, but the strings need to be
+ // modifiable and live the entire life of the plugin.
+
+ cAttributes = new char * [[arguments count]];
+ cValues = new char * [[arguments count]];
+ NSEnumerator *e = [arguments keyEnumerator];
+ NSString *key;
+ while ((key = [e nextObject])) {
+ cAttributes[argsCount] = newCString(key);
+ cValues[argsCount] = newCString([arguments objectForKey:key]);
+ argsCount++;
+ }
streams = [[NSMutableArray alloc] init];
notificationData = [[NSMutableDictionary dictionaryWithCapacity:1] retain];
// Initialize globals
canRestart = YES;
isStarted = NO;
+ fullMode = NO;
return self;
}
@@ -394,7 +385,6 @@ static char *newCString(NSString *string)
-(void)start
{
- NPSavedData saved;
NPError npErr;
NSNotificationCenter *notificationCenter;
NSWindow *theWindow;
@@ -405,7 +395,7 @@ static char *newCString(NSString *string)
isStarted = YES;
- npErr = NPP_New((char *)[mime cString], instance, fullMode ? NP_FULL : NP_EMBED, argsCount, cAttributes, cValues, &saved);
+ npErr = NPP_New((char *)[mime cString], instance, fullMode ? NP_FULL : NP_EMBED, argsCount, cAttributes, cValues, NULL);
WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_New: %d\n", npErr);
// Create a WindowRef is one doesn't already exist
@@ -434,6 +424,7 @@ static char *newCString(NSString *string)
if(srcURL){
stream = [[IFPluginStream alloc] initWithURL:srcURL pluginPointer:instance];
if(stream){
+ [stream startLoad];
[streams addObject:stream];
[stream release];
}
@@ -491,6 +482,76 @@ static char *newCString(NSString *string)
return webController;
}
+#pragma mark IFDOCUMENTVIEW
+
+- initWithFrame:(NSRect)frame
+{
+ [super initWithFrame:frame];
+
+ instance = &instanceStruct;
+ instance->ndata = self;
+
+ argsCount = 0;
+ cAttributes = 0;
+ cValues = 0;
+
+ canRestart = YES;
+ isStarted = NO;
+ fullMode = YES;
+
+ [self setFrame:NSMakeRect(0, 0, 1, 1)];
+
+ return self;
+}
+
+- (void)provisionalDataSourceChanged:(IFWebDataSource *)dataSource
+{
+ IFPlugin *plugin;
+
+ mime = [[dataSource contentType] retain];
+ plugin = [[IFPluginDatabase installedPlugins] pluginForMimeType:mime];
+
+ if(![plugin load])
+ return;
+
+ // copy function pointers
+ NPP_New = [plugin NPP_New];
+ NPP_Destroy = [plugin NPP_Destroy];
+ NPP_SetWindow = [plugin NPP_SetWindow];
+ NPP_NewStream = [plugin NPP_NewStream];
+ NPP_WriteReady = [plugin NPP_WriteReady];
+ NPP_Write = [plugin NPP_Write];
+ NPP_StreamAsFile = [plugin NPP_StreamAsFile];
+ NPP_DestroyStream = [plugin NPP_DestroyStream];
+ NPP_HandleEvent = [plugin NPP_HandleEvent];
+ NPP_URLNotify = [plugin NPP_URLNotify];
+ NPP_GetValue = [plugin NPP_GetValue];
+ NPP_SetValue = [plugin NPP_SetValue];
+ NPP_Print = [plugin NPP_Print];
+
+ [self start];
+}
+
+- (void)provisionalDataSourceCommitted:(IFWebDataSource *)dataSource
+{
+
+}
+
+- (void)dataSourceUpdated:(IFWebDataSource *)dataSource
+{
+
+}
+
+- (void)layout
+{
+ NSRect superFrame = [[self _IF_parentWebView] frame];
+
+ [self setFrame:NSMakeRect(0, 0, superFrame.size.width, superFrame.size.height)];
+ [self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+}
+
+
+
#pragma mark NSVIEW
- (void)drawRect:(NSRect)rect
@@ -506,6 +567,12 @@ static char *newCString(NSString *string)
return YES;
}
+- (void)removeFromSuperview
+{
+ [self stop];
+ [super removeFromSuperview];
+}
+
#pragma mark NOTIFICATIONS
-(void) viewHasMoved:(NSNotification *)notification
@@ -591,6 +658,7 @@ static char *newCString(NSString *string)
if(!target){
stream = [[IFPluginStream alloc] initWithURL:url pluginPointer:instance notifyData:notifyData attributes:attributes];
if(stream){
+ [stream startLoad];
[streams addObject:stream];
[stream release];
}else{
@@ -753,6 +821,10 @@ static char *newCString(NSString *string)
[self sendUpdateEvent];
}
+- (NPP)pluginInstance
+{
+ return instance;
+}
- (NPP_NewStreamProcPtr)NPP_NewStream
{
diff --git a/WebKit/WebCoreSupport.subproj/IFWebCoreViewFactory.m b/WebKit/WebCoreSupport.subproj/IFWebCoreViewFactory.m
index 063bb72..76559aa 100644
--- a/WebKit/WebCoreSupport.subproj/IFWebCoreViewFactory.m
+++ b/WebKit/WebCoreSupport.subproj/IFWebCoreViewFactory.m
@@ -6,11 +6,13 @@
// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
//
-#import "IFWebCoreViewFactory.h"
-#import "IFPluginDatabase.h"
-#import "IFPluginView.h"
-#import "IFNullPluginView.h"
-#import "WebKitDebug.h"
+
+#import <WebKit/IFNullPluginView.h>
+#import <WebKit/IFPlugin.h>
+#import <WebKit/IFPluginDatabase.h>
+#import <WebKit/IFPluginView.h>
+#import <WebKit/IFWebCoreViewFactory.h>
+#import <WebKit/WebKitDebug.h>
@implementation IFWebCoreViewFactory
@@ -57,7 +59,7 @@
if (plugin == nil) {
return [[[IFNullPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) mimeType:mimeType arguments:arguments] autorelease];
}
- return [[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) plugin:plugin url:[NSURL URLWithString:pluginURL] mime:mimeType arguments:arguments mode:NP_EMBED] autorelease];
+ return [[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) plugin:plugin url:[NSURL URLWithString:pluginURL] mime:mimeType arguments:arguments] autorelease];
}
- (NSArray *)pluginsInfo
@@ -82,7 +84,7 @@
if (plugin == nil) {
return [[[IFNullPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) mimeType:@"application/x-java-applet" arguments:argsCopy] autorelease];
}
- return [[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) plugin:plugin url:nil mime:@"application/x-java-applet" arguments:argsCopy mode:NP_EMBED] autorelease];
+ return [[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) plugin:plugin url:nil mime:@"application/x-java-applet" arguments:argsCopy] autorelease];
}
@end
diff --git a/WebKit/WebCoreSupport.subproj/WebViewFactory.m b/WebKit/WebCoreSupport.subproj/WebViewFactory.m
index 063bb72..76559aa 100644
--- a/WebKit/WebCoreSupport.subproj/WebViewFactory.m
+++ b/WebKit/WebCoreSupport.subproj/WebViewFactory.m
@@ -6,11 +6,13 @@
// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
//
-#import "IFWebCoreViewFactory.h"
-#import "IFPluginDatabase.h"
-#import "IFPluginView.h"
-#import "IFNullPluginView.h"
-#import "WebKitDebug.h"
+
+#import <WebKit/IFNullPluginView.h>
+#import <WebKit/IFPlugin.h>
+#import <WebKit/IFPluginDatabase.h>
+#import <WebKit/IFPluginView.h>
+#import <WebKit/IFWebCoreViewFactory.h>
+#import <WebKit/WebKitDebug.h>
@implementation IFWebCoreViewFactory
@@ -57,7 +59,7 @@
if (plugin == nil) {
return [[[IFNullPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) mimeType:mimeType arguments:arguments] autorelease];
}
- return [[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) plugin:plugin url:[NSURL URLWithString:pluginURL] mime:mimeType arguments:arguments mode:NP_EMBED] autorelease];
+ return [[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) plugin:plugin url:[NSURL URLWithString:pluginURL] mime:mimeType arguments:arguments] autorelease];
}
- (NSArray *)pluginsInfo
@@ -82,7 +84,7 @@
if (plugin == nil) {
return [[[IFNullPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) mimeType:@"application/x-java-applet" arguments:argsCopy] autorelease];
}
- return [[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) plugin:plugin url:nil mime:@"application/x-java-applet" arguments:argsCopy mode:NP_EMBED] autorelease];
+ return [[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) plugin:plugin url:nil mime:@"application/x-java-applet" arguments:argsCopy] autorelease];
}
@end
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 06c3513..8f180ac 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -258,6 +258,7 @@
F5A7B11B02BC8413018635CA,
);
isa = PBXHeadersBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
};
0867D69EFE84028FC02AAC07 = {
buildActionMask = 2147483647;
@@ -274,6 +275,7 @@
F8CA15C0029A39FC01000122,
);
isa = PBXResourcesBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
};
0867D69FFE84028FC02AAC07 = {
buildActionMask = 2147483647;
@@ -336,6 +338,7 @@
F5A7B11C02BC8413018635CA,
);
isa = PBXSourcesBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
};
0867D6A0FE84028FC02AAC07 = {
buildActionMask = 2147483647;
@@ -348,12 +351,14 @@
F82162D9029F4FB501000131,
);
isa = PBXFrameworksBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
};
0867D6A2FE84028FC02AAC07 = {
buildActionMask = 2147483647;
files = (
);
isa = PBXRezBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
};
089C1665FE841158C02AAC07 = {
children = (
@@ -433,6 +438,7 @@
isa = PBXShellScriptBuildPhase;
neededFileNames = (
);
+ runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "make embed";
};
diff --git a/WebKit/WebView.subproj/IFLocationChangeHandler.h b/WebKit/WebView.subproj/IFLocationChangeHandler.h
index 5dfc500..aa9f9dd 100644
--- a/WebKit/WebView.subproj/IFLocationChangeHandler.h
+++ b/WebKit/WebView.subproj/IFLocationChangeHandler.h
@@ -50,7 +50,7 @@ typedef enum {
// Sent after locationChangeStarted.
// Implementations typically call haveContentPolicy:forLocationChangeHandler: on IFWebController
// after determining the appropriate policy, perhaps by presenting a non-blocking dialog to the user.
-- (void)requestContentPolicyForMIMEType: (NSString *)type;
+- (void)requestContentPolicyForMIMEType: (NSString *)type dataSource: (IFWebDataSource *)dataSource;
- (void)locationChangeCommitted;
@@ -62,6 +62,6 @@ typedef enum {
// Sent when errors are encountered with an un-implementable policy, i.e.
// file i/o failure, launch services failure, type mismatches, etc.
-- (void)unableToImplementContentPolicy: (IFError *)error;
+- (void)unableToImplementContentPolicy: (IFError *)error forDataSource: (IFWebDataSource *)dataSource;
@end
diff --git a/WebKit/WebView.subproj/IFMainURLHandleClient.mm b/WebKit/WebView.subproj/IFMainURLHandleClient.mm
index 5d9f0cf..5f8b074 100644
--- a/WebKit/WebView.subproj/IFMainURLHandleClient.mm
+++ b/WebKit/WebView.subproj/IFMainURLHandleClient.mm
@@ -132,15 +132,17 @@
// Check the mime type and ask the client for the content policy.
if(isFirstChunk){
- // Make assumption here that if the contentType is the default
+
+ // Make assumption that if the contentType is the default
// and there is no extension, this is text/html
if([contentType isEqualToString:IFDefaultMIMEType] && [[[url path] pathExtension] isEqualToString:@""])
contentType = @"text/html";
+
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(contentType));
[dataSource _setContentType:contentType];
[dataSource _setEncoding:[sender characterSet]];
- [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:contentType];
+ [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:contentType dataSource:dataSource];
}
contentPolicy = [dataSource contentPolicy];
diff --git a/WebKit/WebView.subproj/IFWebController.h b/WebKit/WebView.subproj/IFWebController.h
index 212611f..accd598 100644
--- a/WebKit/WebView.subproj/IFWebController.h
+++ b/WebKit/WebView.subproj/IFWebController.h
@@ -178,7 +178,7 @@ typedef enum {
// 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;
+- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forDataSource: (IFWebDataSource *)dataSource;
// API to manage animated images.
- (void)stopAnimatedImages;
diff --git a/WebKit/WebView.subproj/IFWebController.mm b/WebKit/WebView.subproj/IFWebController.mm
index 172039d..6ba18bd 100644
--- a/WebKit/WebView.subproj/IFWebController.mm
+++ b/WebKit/WebView.subproj/IFWebController.mm
@@ -223,47 +223,37 @@
}
-- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forLocationChangeHandler: (id <IFLocationChangeHandler>)handler
+- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forDataSource: (IFWebDataSource *)dataSource
{
- IFWebDataSource *mainDataSource, *mainProvisionalDataSource, *dataSource;
NSString *MIMEType;
if(policy == IFContentPolicyNone)
[NSException raise:NSInvalidArgumentException format:@"Can't set policy of IFContentPolicyNone. Use IFContentPolicyIgnore instead"];
- mainProvisionalDataSource = [_private->mainFrame provisionalDataSource];
- mainDataSource = [_private->mainFrame dataSource];
-
- dataSource = [mainDataSource _recursiveDataSourceForLocationChangeHandler:handler];
- if(!dataSource)
- dataSource = [mainProvisionalDataSource _recursiveDataSourceForLocationChangeHandler:handler];
+ if([dataSource contentPolicy] != IFContentPolicyNone){
+ [NSException raise:NSGenericException format:@"Content policy can only be set once on for a dataSource."];
+ }else{
+ [dataSource _setContentPolicy:policy];
+ [dataSource _setDownloadPath:path];
- if(dataSource){
- if([dataSource contentPolicy] != IFContentPolicyNone){
- [NSException raise:NSGenericException format:@"Content policy can only be set once on a location change handler."];
- }else{
- [dataSource _setContentPolicy:policy];
- [dataSource _setDownloadPath:path];
-
- if(policy == IFContentPolicyShow){
- MIMEType = [dataSource contentType];
- if([[self class] canShowMIMEType:MIMEType]){
- id documentView;
- IFWebView *webView;
- id <IFDocumentRepresentation> dataRepresentation, oldRepresentation;
-
- // Check if the data source was already bound?
- oldRepresentation = [dataSource representation];
- dataRepresentation = [IFWebDataSource createRepresentationForMIMEType:MIMEType];
- if (!oldRepresentation || ![oldRepresentation isKindOfClass: [dataRepresentation class]])
- [dataSource _setRepresentation:dataRepresentation];
- webView = [[dataSource webFrame] webView];
- documentView = [IFWebView createViewForMIMEType:MIMEType];
- [webView _setDocumentView: documentView];
- [documentView provisionalDataSourceChanged: dataSource];
- }else{
- // return error with unableToImplementContentPolicy
- }
+ if(policy == IFContentPolicyShow){
+ MIMEType = [dataSource contentType];
+ if([[self class] canShowMIMEType:MIMEType]){
+ id documentView;
+ IFWebView *webView;
+ id <IFDocumentRepresentation> dataRepresentation, oldRepresentation;
+
+ // Check if the data source was already bound?
+ oldRepresentation = [dataSource representation];
+ dataRepresentation = [IFWebDataSource createRepresentationForMIMEType:MIMEType];
+ if (!oldRepresentation || ![oldRepresentation isKindOfClass: [dataRepresentation class]])
+ [dataSource _setRepresentation:dataRepresentation];
+ webView = [[dataSource webFrame] webView];
+ documentView = [IFWebView createViewForMIMEType:MIMEType];
+ [webView _setDocumentView: documentView];
+ [documentView provisionalDataSourceChanged: dataSource];
+ }else{
+ // return error with unableToImplementContentPolicy
}
}
}
diff --git a/WebKit/WebView.subproj/IFWebDataSourcePrivate.h b/WebKit/WebView.subproj/IFWebDataSourcePrivate.h
index 96b0bf5..3947ea3 100644
--- a/WebKit/WebView.subproj/IFWebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/IFWebDataSourcePrivate.h
@@ -91,7 +91,6 @@
- (void)_setContentPolicy:(IFContentPolicy)policy;
- (void)_setContentType:(NSString *)type;
- (void)_setEncoding:(NSString *)encoding;
-- (IFWebDataSource *) _recursiveDataSourceForLocationChangeHandler:(id <IFLocationChangeHandler>)handler;
- (void)_clearErrors;
- (void)_setMainDocumentError: (IFError *)error;
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index 212611f..accd598 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -178,7 +178,7 @@ typedef enum {
// 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;
+- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forDataSource: (IFWebDataSource *)dataSource;
// API to manage animated images.
- (void)stopAnimatedImages;
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index 172039d..6ba18bd 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -223,47 +223,37 @@
}
-- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forLocationChangeHandler: (id <IFLocationChangeHandler>)handler
+- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forDataSource: (IFWebDataSource *)dataSource
{
- IFWebDataSource *mainDataSource, *mainProvisionalDataSource, *dataSource;
NSString *MIMEType;
if(policy == IFContentPolicyNone)
[NSException raise:NSInvalidArgumentException format:@"Can't set policy of IFContentPolicyNone. Use IFContentPolicyIgnore instead"];
- mainProvisionalDataSource = [_private->mainFrame provisionalDataSource];
- mainDataSource = [_private->mainFrame dataSource];
-
- dataSource = [mainDataSource _recursiveDataSourceForLocationChangeHandler:handler];
- if(!dataSource)
- dataSource = [mainProvisionalDataSource _recursiveDataSourceForLocationChangeHandler:handler];
+ if([dataSource contentPolicy] != IFContentPolicyNone){
+ [NSException raise:NSGenericException format:@"Content policy can only be set once on for a dataSource."];
+ }else{
+ [dataSource _setContentPolicy:policy];
+ [dataSource _setDownloadPath:path];
- if(dataSource){
- if([dataSource contentPolicy] != IFContentPolicyNone){
- [NSException raise:NSGenericException format:@"Content policy can only be set once on a location change handler."];
- }else{
- [dataSource _setContentPolicy:policy];
- [dataSource _setDownloadPath:path];
-
- if(policy == IFContentPolicyShow){
- MIMEType = [dataSource contentType];
- if([[self class] canShowMIMEType:MIMEType]){
- id documentView;
- IFWebView *webView;
- id <IFDocumentRepresentation> dataRepresentation, oldRepresentation;
-
- // Check if the data source was already bound?
- oldRepresentation = [dataSource representation];
- dataRepresentation = [IFWebDataSource createRepresentationForMIMEType:MIMEType];
- if (!oldRepresentation || ![oldRepresentation isKindOfClass: [dataRepresentation class]])
- [dataSource _setRepresentation:dataRepresentation];
- webView = [[dataSource webFrame] webView];
- documentView = [IFWebView createViewForMIMEType:MIMEType];
- [webView _setDocumentView: documentView];
- [documentView provisionalDataSourceChanged: dataSource];
- }else{
- // return error with unableToImplementContentPolicy
- }
+ if(policy == IFContentPolicyShow){
+ MIMEType = [dataSource contentType];
+ if([[self class] canShowMIMEType:MIMEType]){
+ id documentView;
+ IFWebView *webView;
+ id <IFDocumentRepresentation> dataRepresentation, oldRepresentation;
+
+ // Check if the data source was already bound?
+ oldRepresentation = [dataSource representation];
+ dataRepresentation = [IFWebDataSource createRepresentationForMIMEType:MIMEType];
+ if (!oldRepresentation || ![oldRepresentation isKindOfClass: [dataRepresentation class]])
+ [dataSource _setRepresentation:dataRepresentation];
+ webView = [[dataSource webFrame] webView];
+ documentView = [IFWebView createViewForMIMEType:MIMEType];
+ [webView _setDocumentView: documentView];
+ [documentView provisionalDataSourceChanged: dataSource];
+ }else{
+ // return error with unableToImplementContentPolicy
}
}
}
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index 96b0bf5..3947ea3 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -91,7 +91,6 @@
- (void)_setContentPolicy:(IFContentPolicy)policy;
- (void)_setContentType:(NSString *)type;
- (void)_setEncoding:(NSString *)encoding;
-- (IFWebDataSource *) _recursiveDataSourceForLocationChangeHandler:(id <IFLocationChangeHandler>)handler;
- (void)_clearErrors;
- (void)_setMainDocumentError: (IFError *)error;
diff --git a/WebKit/WebView.subproj/WebFrameLoadDelegate.h b/WebKit/WebView.subproj/WebFrameLoadDelegate.h
index 5dfc500..aa9f9dd 100644
--- a/WebKit/WebView.subproj/WebFrameLoadDelegate.h
+++ b/WebKit/WebView.subproj/WebFrameLoadDelegate.h
@@ -50,7 +50,7 @@ typedef enum {
// Sent after locationChangeStarted.
// Implementations typically call haveContentPolicy:forLocationChangeHandler: on IFWebController
// after determining the appropriate policy, perhaps by presenting a non-blocking dialog to the user.
-- (void)requestContentPolicyForMIMEType: (NSString *)type;
+- (void)requestContentPolicyForMIMEType: (NSString *)type dataSource: (IFWebDataSource *)dataSource;
- (void)locationChangeCommitted;
@@ -62,6 +62,6 @@ typedef enum {
// Sent when errors are encountered with an un-implementable policy, i.e.
// file i/o failure, launch services failure, type mismatches, etc.
-- (void)unableToImplementContentPolicy: (IFError *)error;
+- (void)unableToImplementContentPolicy: (IFError *)error forDataSource: (IFWebDataSource *)dataSource;
@end
diff --git a/WebKit/WebView.subproj/WebLocationChangeDelegate.h b/WebKit/WebView.subproj/WebLocationChangeDelegate.h
index 5dfc500..aa9f9dd 100644
--- a/WebKit/WebView.subproj/WebLocationChangeDelegate.h
+++ b/WebKit/WebView.subproj/WebLocationChangeDelegate.h
@@ -50,7 +50,7 @@ typedef enum {
// Sent after locationChangeStarted.
// Implementations typically call haveContentPolicy:forLocationChangeHandler: on IFWebController
// after determining the appropriate policy, perhaps by presenting a non-blocking dialog to the user.
-- (void)requestContentPolicyForMIMEType: (NSString *)type;
+- (void)requestContentPolicyForMIMEType: (NSString *)type dataSource: (IFWebDataSource *)dataSource;
- (void)locationChangeCommitted;
@@ -62,6 +62,6 @@ typedef enum {
// Sent when errors are encountered with an un-implementable policy, i.e.
// file i/o failure, launch services failure, type mismatches, etc.
-- (void)unableToImplementContentPolicy: (IFError *)error;
+- (void)unableToImplementContentPolicy: (IFError *)error forDataSource: (IFWebDataSource *)dataSource;
@end
diff --git a/WebKit/WebView.subproj/WebLocationChangeHandler.h b/WebKit/WebView.subproj/WebLocationChangeHandler.h
index 5dfc500..aa9f9dd 100644
--- a/WebKit/WebView.subproj/WebLocationChangeHandler.h
+++ b/WebKit/WebView.subproj/WebLocationChangeHandler.h
@@ -50,7 +50,7 @@ typedef enum {
// Sent after locationChangeStarted.
// Implementations typically call haveContentPolicy:forLocationChangeHandler: on IFWebController
// after determining the appropriate policy, perhaps by presenting a non-blocking dialog to the user.
-- (void)requestContentPolicyForMIMEType: (NSString *)type;
+- (void)requestContentPolicyForMIMEType: (NSString *)type dataSource: (IFWebDataSource *)dataSource;
- (void)locationChangeCommitted;
@@ -62,6 +62,6 @@ typedef enum {
// Sent when errors are encountered with an un-implementable policy, i.e.
// file i/o failure, launch services failure, type mismatches, etc.
-- (void)unableToImplementContentPolicy: (IFError *)error;
+- (void)unableToImplementContentPolicy: (IFError *)error forDataSource: (IFWebDataSource *)dataSource;
@end
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 5d9f0cf..5f8b074 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -132,15 +132,17 @@
// Check the mime type and ask the client for the content policy.
if(isFirstChunk){
- // Make assumption here that if the contentType is the default
+
+ // Make assumption that if the contentType is the default
// and there is no extension, this is text/html
if([contentType isEqualToString:IFDefaultMIMEType] && [[[url path] pathExtension] isEqualToString:@""])
contentType = @"text/html";
+
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(contentType));
[dataSource _setContentType:contentType];
[dataSource _setEncoding:[sender characterSet]];
- [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:contentType];
+ [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:contentType dataSource:dataSource];
}
contentPolicy = [dataSource contentPolicy];
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 5d9f0cf..5f8b074 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -132,15 +132,17 @@
// Check the mime type and ask the client for the content policy.
if(isFirstChunk){
- // Make assumption here that if the contentType is the default
+
+ // Make assumption that if the contentType is the default
// and there is no extension, this is text/html
if([contentType isEqualToString:IFDefaultMIMEType] && [[[url path] pathExtension] isEqualToString:@""])
contentType = @"text/html";
+
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(contentType));
[dataSource _setContentType:contentType];
[dataSource _setEncoding:[sender characterSet]];
- [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:contentType];
+ [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:contentType dataSource:dataSource];
}
contentPolicy = [dataSource contentPolicy];
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index 212611f..accd598 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -178,7 +178,7 @@ typedef enum {
// 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;
+- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forDataSource: (IFWebDataSource *)dataSource;
// API to manage animated images.
- (void)stopAnimatedImages;
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 172039d..6ba18bd 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -223,47 +223,37 @@
}
-- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forLocationChangeHandler: (id <IFLocationChangeHandler>)handler
+- (void)haveContentPolicy: (IFContentPolicy)policy andPath: (NSString *)path forDataSource: (IFWebDataSource *)dataSource
{
- IFWebDataSource *mainDataSource, *mainProvisionalDataSource, *dataSource;
NSString *MIMEType;
if(policy == IFContentPolicyNone)
[NSException raise:NSInvalidArgumentException format:@"Can't set policy of IFContentPolicyNone. Use IFContentPolicyIgnore instead"];
- mainProvisionalDataSource = [_private->mainFrame provisionalDataSource];
- mainDataSource = [_private->mainFrame dataSource];
-
- dataSource = [mainDataSource _recursiveDataSourceForLocationChangeHandler:handler];
- if(!dataSource)
- dataSource = [mainProvisionalDataSource _recursiveDataSourceForLocationChangeHandler:handler];
+ if([dataSource contentPolicy] != IFContentPolicyNone){
+ [NSException raise:NSGenericException format:@"Content policy can only be set once on for a dataSource."];
+ }else{
+ [dataSource _setContentPolicy:policy];
+ [dataSource _setDownloadPath:path];
- if(dataSource){
- if([dataSource contentPolicy] != IFContentPolicyNone){
- [NSException raise:NSGenericException format:@"Content policy can only be set once on a location change handler."];
- }else{
- [dataSource _setContentPolicy:policy];
- [dataSource _setDownloadPath:path];
-
- if(policy == IFContentPolicyShow){
- MIMEType = [dataSource contentType];
- if([[self class] canShowMIMEType:MIMEType]){
- id documentView;
- IFWebView *webView;
- id <IFDocumentRepresentation> dataRepresentation, oldRepresentation;
-
- // Check if the data source was already bound?
- oldRepresentation = [dataSource representation];
- dataRepresentation = [IFWebDataSource createRepresentationForMIMEType:MIMEType];
- if (!oldRepresentation || ![oldRepresentation isKindOfClass: [dataRepresentation class]])
- [dataSource _setRepresentation:dataRepresentation];
- webView = [[dataSource webFrame] webView];
- documentView = [IFWebView createViewForMIMEType:MIMEType];
- [webView _setDocumentView: documentView];
- [documentView provisionalDataSourceChanged: dataSource];
- }else{
- // return error with unableToImplementContentPolicy
- }
+ if(policy == IFContentPolicyShow){
+ MIMEType = [dataSource contentType];
+ if([[self class] canShowMIMEType:MIMEType]){
+ id documentView;
+ IFWebView *webView;
+ id <IFDocumentRepresentation> dataRepresentation, oldRepresentation;
+
+ // Check if the data source was already bound?
+ oldRepresentation = [dataSource representation];
+ dataRepresentation = [IFWebDataSource createRepresentationForMIMEType:MIMEType];
+ if (!oldRepresentation || ![oldRepresentation isKindOfClass: [dataRepresentation class]])
+ [dataSource _setRepresentation:dataRepresentation];
+ webView = [[dataSource webFrame] webView];
+ documentView = [IFWebView createViewForMIMEType:MIMEType];
+ [webView _setDocumentView: documentView];
+ [documentView provisionalDataSourceChanged: dataSource];
+ }else{
+ // return error with unableToImplementContentPolicy
}
}
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list