+2006-08-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Anders.
+
+ - remove WebKit dependencies from WebPlugInStreamLoader via a protocol veil of ignorance
+
+ * Loader/WebNetscapePlugInStreamLoader.h:
+ * Loader/WebNetscapePlugInStreamLoader.m:
+ (-[WebNetscapePlugInStreamLoader initWithDelegate:frameLoader:]):
+ * Loader/WebPlugInStreamLoaderDelegate.h: Added.
+ * Plugins/WebBaseNetscapePluginStream.h:
+ * Plugins/WebNetscapePluginStream.m:
+ (-[WebNetscapePluginStream initWithRequest:pluginPointer:notifyData:sendNotification:]):
+ * WebKit.xcodeproj/project.pbxproj:
+
2006-08-15 Mark Rowe <opendarwin.org@bdash.net.nz>
Reviewed by Tim H.
#import <WebKit/WebLoader.h>
+#import <WebKit/WebPlugInStreamLoaderDelegate.h>
@class WebNetscapePluginStream;
@interface WebNetscapePlugInStreamLoader : WebLoader
{
- WebNetscapePluginStream *stream;
+ NSObject<WebPlugInStreamLoaderDelegate> *stream;
}
-- (id)initWithStream:(WebNetscapePluginStream *)theStream frameLoader:(WebFrameLoader *)fl;
+- (id)initWithDelegate:(NSObject<WebPlugInStreamLoaderDelegate> *)theStream frameLoader:(WebFrameLoader *)fl;
- (BOOL)isDone;
@end
#import <WebKit/WebFrameLoader.h>
-#import <WebKit/WebNetscapePluginStream.h>
-
@implementation WebNetscapePlugInStreamLoader
-- (id)initWithStream:(WebNetscapePluginStream *)theStream frameLoader:(WebFrameLoader *)fl
+- (id)initWithDelegate:(NSObject<WebPlugInStreamLoaderDelegate> *)theStream frameLoader:(WebFrameLoader *)fl;
{
[super init];
stream = [theStream retain];
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+@class NSURLResponse;
+@class NSError;
+@class NSData;
+
+@protocol WebPlugInStreamLoaderDelegate
+
+- (void)startStreamWithResponse:(NSURLResponse *)r;
+
+ // destroyStreamWithError tells the plug-in that the load is completed (error == nil) or ended in error.
+- (void)destroyStreamWithError:(NSError *)error;
+
+// cancelLoadAndDestoryStreamWithError calls cancelLoadWithError: then destroyStreamWithError:.
+- (void)cancelLoadAndDestroyStreamWithError:(NSError *)error;
+
+- (void)receivedData:(NSData *)data;
+- (void)finishedLoadingWithData:(NSData *)data;
+
+@end
#import <Foundation/Foundation.h>
#import <WebKit/npfunctions.h>
+#import <WebKit/WebPlugInStreamLoaderDelegate.h>
@class WebBaseNetscapePluginView;
@class NSURLResponse;
-@interface WebBaseNetscapePluginStream : NSObject
+@interface WebBaseNetscapePluginStream : NSObject<WebPlugInStreamLoaderDelegate>
{
NSMutableData *deliveryData;
NSURL *requestURL;
expectedContentLength:(long long)expectedContentLength
lastModifiedDate:(NSDate *)lastModifiedDate
MIMEType:(NSString *)MIMEType;
-- (void)startStreamWithResponse:(NSURLResponse *)r;
// cancelLoadWithError cancels the NSURLConnection and informs WebKit of the load error.
// This method is overriden by subclasses.
- (void)cancelLoadWithError:(NSError *)error;
-// destroyStreamWithError tells the plug-in that the load is completed (error == nil) or ended in error.
-- (void)destroyStreamWithError:(NSError *)error;
-
-// cancelLoadAndDestoryStreamWithError calls cancelLoadWithError: then destroyStreamWithError:.
-- (void)cancelLoadAndDestroyStreamWithError:(NSError *)error;
-
-- (void)receivedData:(NSData *)data;
-- (void)finishedLoadingWithData:(NSData *)data;
-
@end
[(NSMutableURLRequest *)request _web_setHTTPReferrer:nil];
}
- _loader = [[WebNetscapePlugInStreamLoader alloc] initWithStream:self frameLoader:[[view webFrame] _frameLoader]];
+ _loader = [[WebNetscapePlugInStreamLoader alloc] initWithDelegate:self frameLoader:[[view webFrame] _frameLoader]];
isTerminated = NO;
6550B7C8099EFAE90090D781 /* WebArchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6550B7C6099EFAE90090D781 /* WebArchiver.m */; };
658A40960A14853B005E6987 /* WebDataSourceInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 658A40950A14853B005E6987 /* WebDataSourceInternal.h */; };
65A0006908527D1A005620FA /* libWebKitSystemInterface.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 65A0006808527D1A005620FA /* libWebKitSystemInterface.a */; };
+ 65A734610A923948001B57E8 /* WebPlugInStreamLoaderDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A734600A923948001B57E8 /* WebPlugInStreamLoaderDelegate.h */; };
65C7F42C0979DE640022E453 /* WebPageBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C7F42A0979DE640022E453 /* WebPageBridge.h */; };
65C7F42D0979DE640022E453 /* WebPageBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 65C7F42B0979DE640022E453 /* WebPageBridge.m */; };
65E0F88408500917007E5CB9 /* WebNSURLRequestExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E0F88208500917007E5CB9 /* WebNSURLRequestExtras.h */; };
65836F5E07EE425900682F95 /* WebPluginContainerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginContainerPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
658A40950A14853B005E6987 /* WebDataSourceInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebDataSourceInternal.h; sourceTree = "<group>"; };
65A0006808527D1A005620FA /* libWebKitSystemInterface.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWebKitSystemInterface.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 65A734600A923948001B57E8 /* WebPlugInStreamLoaderDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPlugInStreamLoaderDelegate.h; sourceTree = "<group>"; };
65A7D44A0568AB2600E70EF6 /* WebUIDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebUIDelegatePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
65C7F42A0979DE640022E453 /* WebPageBridge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebPageBridge.h; sourceTree = "<group>"; };
65C7F42B0979DE640022E453 /* WebPageBridge.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebPageBridge.m; sourceTree = "<group>"; };
654B3C280A82C47200E1AE3D /* Loader */ = {
isa = PBXGroup;
children = (
+ 65A734600A923948001B57E8 /* WebPlugInStreamLoaderDelegate.h */,
6538B1C60A90596D00A07522 /* WebFormDataStream.h */,
6538B1C70A90596D00A07522 /* WebFormDataStream.m */,
651A93850A83F883007FEDF0 /* WebDataProtocol.h */,
51E4D3990A886B5E00ECEE2C /* WebIconDatabaseBridge.h in Headers */,
51700DAA0A9052A700DAAA8E /* WebIconLoader.h in Headers */,
6538B1C80A90596D00A07522 /* WebFormDataStream.h in Headers */,
+ 65A734610A923948001B57E8 /* WebPlugInStreamLoaderDelegate.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};