Reviewed by Anders.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Aug 2006 19:20:09 +0000 (19:20 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Aug 2006 19:20:09 +0000 (19:20 +0000)
        - 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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15881 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/Loader/WebNetscapePlugInStreamLoader.h
WebKit/Loader/WebNetscapePlugInStreamLoader.m
WebKit/Loader/WebPlugInStreamLoaderDelegate.h [new file with mode: 0644]
WebKit/Plugins/WebBaseNetscapePluginStream.h
WebKit/Plugins/WebNetscapePluginStream.m
WebKit/WebKit.xcodeproj/project.pbxproj

index c1678d292eecc635839b5aa7785c3b5712943e2b..efb8b900df0ca6bcf36235caa4dc68dbd2ea4d98 100644 (file)
@@ -1,3 +1,18 @@
+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.
index ccc3c23e91e02d7b1d89ec3ee7951be124ce5644..ee85246625d81b37f703afc14cc590bc5b2584b8 100644 (file)
 
 
 #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
 
index 6c097c29f3d25c786115f49c1559a9d4d1cdc9ad..0eae96a5032457793faa8024cf41e4277be6bf8e 100644 (file)
 
 #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];
diff --git a/WebKit/Loader/WebPlugInStreamLoaderDelegate.h b/WebKit/Loader/WebPlugInStreamLoaderDelegate.h
new file mode 100644 (file)
index 0000000..f7fa9db
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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
index 6b767ff0ec7973f5a37f7d6fdf151c7427b244e8..651015da7981c3eb357a09f5541055a032d17b03 100644 (file)
 #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
index cb2f0264514126509388da5da64ad69ed7ce3853..4ba28851a7e8592548c17ad5dc18ab8a6cd0a025 100644 (file)
@@ -72,7 +72,7 @@
         [(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;
 
index 9878437a52314a307652a5efca49b67503171ca0..a6eea38b6994034c608d0170c024c4777065653f 100644 (file)
@@ -58,6 +58,7 @@
                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;
                };