Refactor Mac plugin stream code to use the shared NetscapePlugInStreamLoader implemen...
authormrowe@apple.com <mrowe@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Dec 2007 06:00:49 +0000 (06:00 +0000)
committermrowe@apple.com <mrowe@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Dec 2007 06:00:49 +0000 (06:00 +0000)
Reviewed by Maciej Stachowiak.

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

14 files changed:
WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/loader/NetscapePlugInStreamLoader.h
WebCore/loader/mac/NetscapePlugInStreamLoaderMac.mm [deleted file]
WebKit/ChangeLog
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/mac/ChangeLog
WebKit/mac/Plugins/WebBaseNetscapePluginStream.h
WebKit/mac/Plugins/WebNetscapePluginStream.h
WebKit/mac/Plugins/WebNetscapePluginStream.mm
WebKit/mac/Plugins/WebPlugInStreamLoaderDelegate.h [moved from WebCore/loader/mac/WebPlugInStreamLoaderDelegate.h with 94% similarity]
WebKit/mac/WebCoreSupport/WebNetscapePlugInStreamLoaderClient.h [new file with mode: 0644]
WebKit/mac/WebCoreSupport/WebNetscapePlugInStreamLoaderClient.mm [new file with mode: 0644]

index 775e9fc..ac2fc31 100644 (file)
@@ -1,3 +1,15 @@
+2007-12-16  Mark Rowe  <mrowe@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        Refactor Mac plugin stream code to use the shared NetscapePlugInStreamLoader implementation.
+
+        * WebCore.base.exp:
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/NetscapePlugInStreamLoader.h:
+        * loader/mac/NetscapePlugInStreamLoaderMac.mm: Removed.
+        * loader/mac/WebPlugInStreamLoaderDelegate.h: Moved to WebKit.
+
 2007-12-16  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Maciej.
index f1b5037..3c87bc6 100644 (file)
@@ -362,7 +362,7 @@ __ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE
 __ZN7WebCore21reportThreadViolationEPKc
 __ZN7WebCore24notifyHistoryItemChangedE
 __ZN7WebCore26CSSMutableStyleDeclarationC1Ev
-__ZN7WebCore26NetscapePlugInStreamLoader6createEPNS_5FrameEP11objc_object
+__ZN7WebCore26NetscapePlugInStreamLoader6createEPNS_5FrameEPNS_32NetscapePlugInStreamLoaderClientE
 __ZN7WebCore26usesTestModeFocusRingColorEv
 __ZN7WebCore29setUsesTestModeFocusRingColorEb
 __ZN7WebCore33setDefaultThreadViolationBehaviorENS_23ThreadViolationBehaviorE
@@ -630,7 +630,6 @@ __ZNK7WebCore19ResourceRequestBase7isEmptyEv
 __ZNK7WebCore19SelectionController17isInPasswordFieldEv
 __ZNK7WebCore20ResourceResponseBase14httpStatusCodeEv
 __ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv
-__ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv
 __ZNK7WebCore20ResourceResponseBase16textEncodingNameEv
 __ZNK7WebCore20ResourceResponseBase17suggestedFilenameEv
 __ZNK7WebCore20ResourceResponseBase3urlEv
index f3d21cd..c7e16b7 100644 (file)
                51FAFE340CECBF2D00BB3F24 /* DatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
                550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DD0AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp */; };
+               5DFE8F560D16477B0076E937 /* ScheduledAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA378BA0D15F64200B793D6 /* ScheduledAction.cpp */; };
+               5DFE8F570D16477C0076E937 /* ScheduledAction.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA378BB0D15F64200B793D6 /* ScheduledAction.h */; };
                650F53DC09D15DDA00C9B0C8 /* CSSGrammar.h in Headers */ = {isa = PBXBuildFile; fileRef = 650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */; };
                650F53DD09D15DDF00C9B0C8 /* CSSGrammar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6565814409D13043000E61D7 /* CSSGrammar.cpp */; };
                651B4D8509AC83370029F1EF /* DeprecatedStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 651B4D8309AC83370029F1EF /* DeprecatedStringList.cpp */; };
                656D373F0ADBA5DE00A4554D /* ResourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D37270ADBA5DE00A4554D /* ResourceLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
                656D37410ADBA5DE00A4554D /* MainResourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D37290ADBA5DE00A4554D /* MainResourceLoader.h */; };
                656D37430ADBA5DE00A4554D /* NetscapePlugInStreamLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D372B0ADBA5DE00A4554D /* NetscapePlugInStreamLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               656D37440ADBA5DE00A4554D /* NetscapePlugInStreamLoaderMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 656D372C0ADBA5DE00A4554D /* NetscapePlugInStreamLoaderMac.mm */; };
-               656D37450ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D372D0ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                656D37480ADBA5DE00A4554D /* SubresourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D37300ADBA5DE00A4554D /* SubresourceLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6582A13F09999CD600BEEB6D /* DeprecatedString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6582A13D09999CD600BEEB6D /* DeprecatedString.cpp */; };
                6582A14009999CD600BEEB6D /* DeprecatedString.h in Headers */ = {isa = PBXBuildFile; fileRef = 6582A13E09999CD600BEEB6D /* DeprecatedString.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCA169A30BFD55B40019CA76 /* JSHTMLTableCaptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA169A10BFD55B40019CA76 /* JSHTMLTableCaptionElement.h */; };
                BCA378160D15C64600B793D6 /* PausedTimeouts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA378140D15C64600B793D6 /* PausedTimeouts.cpp */; };
                BCA378170D15C64600B793D6 /* PausedTimeouts.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA378150D15C64600B793D6 /* PausedTimeouts.h */; };
-               BCA378BC0D15F64200B793D6 /* ScheduledAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA378BA0D15F64200B793D6 /* ScheduledAction.cpp */; };
-               BCA378BD0D15F64200B793D6 /* ScheduledAction.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA378BB0D15F64200B793D6 /* ScheduledAction.h */; };
                BCA85A100C3AEAF4006F8308 /* DOMSVGNumberInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA85A0F0C3AEAF4006F8308 /* DOMSVGNumberInternal.h */; };
                BCAA90C30A7EBA60008B1229 /* ScrollBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCAA90C20A7EBA60008B1229 /* ScrollBar.cpp */; };
                BCB16B8B0979B01400467741 /* DeprecatedArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16B880979B01400467741 /* DeprecatedArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
                656D37270ADBA5DE00A4554D /* ResourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceLoader.h; sourceTree = "<group>"; };
                656D37290ADBA5DE00A4554D /* MainResourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MainResourceLoader.h; sourceTree = "<group>"; };
                656D372B0ADBA5DE00A4554D /* NetscapePlugInStreamLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NetscapePlugInStreamLoader.h; sourceTree = "<group>"; };
-               656D372C0ADBA5DE00A4554D /* NetscapePlugInStreamLoaderMac.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = NetscapePlugInStreamLoaderMac.mm; sourceTree = "<group>"; };
-               656D372D0ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebPlugInStreamLoaderDelegate.h; sourceTree = "<group>"; };
                656D37300ADBA5DE00A4554D /* SubresourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SubresourceLoader.h; sourceTree = "<group>"; };
                6582A13D09999CD600BEEB6D /* DeprecatedString.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DeprecatedString.cpp; sourceTree = "<group>"; };
                6582A13E09999CD600BEEB6D /* DeprecatedString.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DeprecatedString.h; sourceTree = "<group>"; };
                                93A1EA9F0A5634C9006960A0 /* ImageDocumentMac.mm */,
                                656D371A0ADBA5DE00A4554D /* LoaderNSURLExtras.h */,
                                656D371B0ADBA5DE00A4554D /* LoaderNSURLExtras.m */,
-                               656D372C0ADBA5DE00A4554D /* NetscapePlugInStreamLoaderMac.mm */,
                                51AA3F6E0BD5AA9E00892971 /* ResourceLoaderMac.mm */,
-                               656D372D0ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h */,
                        );
                        path = mac;
                        sourceTree = "<group>";
                                BC64B4CC0CB4295D005F2B62 /* CachedFont.h in Headers */,
                                BCB16C1C0979C3BD00467741 /* CachedImage.h in Headers */,
                                510184690B08602A004A825F /* CachedPage.h in Headers */,
+                               51CBFC990D10E483002DBF51 /* CachedPagePlatformData.h in Headers */,
                                BCB16C200979C3BD00467741 /* CachedResource.h in Headers */,
                                BCFB2E5E0979E46400BA703D /* CachedResourceClient.h in Headers */,
                                BCB16C220979C3BD00467741 /* CachedResourceClientWalker.h in Headers */,
                                A81872200977D3C0005826D9 /* ChildNodeList.h in Headers */,
                                14D823520AF92A790004F057 /* Chrome.h in Headers */,
                                14D824080AF93AEB0004F057 /* ChromeClient.h in Headers */,
+                               BC4BF9E50D11E133007D247F /* ClassNames.h in Headers */,
+                               BC904B770D10998F00680D32 /* ClassNodeList.h in Headers */,
                                85031B3E0A44EFC700F992E0 /* Clipboard.h in Headers */,
                                4B8AF4AA0B1CE02B00687690 /* ClipboardAccessPolicy.h in Headers */,
                                85031B400A44EFC700F992E0 /* ClipboardEvent.h in Headers */,
                                65DF323009D1DDBC000BE325 /* JSEntity.h in Headers */,
                                93F9B7750BA5FDDD00854064 /* JSEntityReference.h in Headers */,
                                14E8378E09F85D4F00B85AE4 /* JSEvent.h in Headers */,
+                               B25BE5110D06B70800B524C6 /* JSEventTargetBase.h in Headers */,
+                               B28BC31A0D135E5400CDBA27 /* JSEventTargetBase.lut.h in Headers */,
                                BCD9C2710C17AA81005C90A2 /* JSEventTargetNode.h in Headers */,
                                BC6DC7A10C1A4BFA004E2017 /* JSHTMLAllCollection.h in Headers */,
                                1A4A2DF00A1B852A00C807F8 /* JSHTMLAnchorElement.h in Headers */,
                                B27535800B053814002CE64F /* Path.h in Headers */,
                                A88DD4870B4629A300C02990 /* PathTraversalState.h in Headers */,
                                B22279710D00BF220071B782 /* PatternAttributes.h in Headers */,
+                               BCA378170D15C64600B793D6 /* PausedTimeouts.h in Headers */,
                                B27535820B053814002CE64F /* Pen.h in Headers */,
                                935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */,
                                932871C00B20DEB70049035A /* PlatformMenuDescription.h in Headers */,
                                B2227AF30D00BF220071B782 /* SVGViewSpec.h in Headers */,
                                B2227AF60D00BF220071B782 /* SVGZoomAndPan.h in Headers */,
                                B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */,
+                               5DFE8F570D16477C0076E937 /* ScheduledAction.h in Headers */,
                                BCEC01BE0C274DAC009F4EC9 /* Screen.h in Headers */,
                                93F199B808245E59001E9ABC /* ScrollBar.h in Headers */,
                                93C09C860B0657AA005ABD4D /* ScrollTypes.h in Headers */,
                                93F199B308245E59001E9ABC /* WebCoreViewFactory.h in Headers */,
                                93F199F108245E59001E9ABC /* WebDashboardRegion.h in Headers */,
                                BC6DADEF0A195FDF00E5CD14 /* WebFontCache.h in Headers */,
-                               656D37450ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h in Headers */,
                                1CAF34810A6C405200ABE06E /* WebScriptObject.h in Headers */,
                                1CAF34830A6C405200ABE06E /* WebScriptObjectPrivate.h in Headers */,
                                85031B510A44EFC700F992E0 /* WheelEvent.h in Headers */,
                                BCB16C2D0979C3BD00467741 /* loader.h in Headers */,
                                93309DF8099E64920056E581 /* markup.h in Headers */,
                                93309E1E099E64920056E581 /* visible_units.h in Headers */,
-                               B25BE5110D06B70800B524C6 /* JSEventTargetBase.h in Headers */,
-                               51CBFC990D10E483002DBF51 /* CachedPagePlatformData.h in Headers */,
-                               BC904B770D10998F00680D32 /* ClassNodeList.h in Headers */,
-                               BC4BF9E50D11E133007D247F /* ClassNames.h in Headers */,
-                               B28BC31A0D135E5400CDBA27 /* JSEventTargetBase.lut.h in Headers */,
-                               BCA378170D15C64600B793D6 /* PausedTimeouts.h in Headers */,
-                               BCA378BD0D15F64200B793D6 /* ScheduledAction.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A81872250977D3C0005826D9 /* ChildNodeList.cpp in Sources */,
                                14D8238B0AF92DF60004F057 /* Chrome.cpp in Sources */,
                                ABAF22080C03B1C700B0BCF0 /* ChromeMac.mm in Sources */,
+                               BC4BF9E40D11E133007D247F /* ClassNames.cpp in Sources */,
+                               BC904B760D10998F00680D32 /* ClassNodeList.cpp in Sources */,
                                A784941B0B5FE507001E237A /* Clipboard.cpp in Sources */,
                                85031B3F0A44EFC700F992E0 /* ClipboardEvent.cpp in Sources */,
                                93F19AFF08245E59001E9ABC /* ClipboardMac.mm in Sources */,
                                93309DE3099E64920056E581 /* EditCommand.cpp in Sources */,
                                6550B6A3099DF0270090D781 /* EditingText.cpp in Sources */,
                                4B3043CC0AE0373B00A82647 /* Editor.cpp in Sources */,
+                               93A38B4B0D0E5808006872C2 /* EditorCommand.cpp in Sources */,
                                ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */,
                                A8C4A80809D563270003AC8D /* Element.cpp in Sources */,
                                A8CFF6CB0A1561CD000A4234 /* EllipsisBox.cpp in Sources */,
                                93F9B7740BA5FDDC00854064 /* JSEntityReference.cpp in Sources */,
                                14E8378409F85D1C00B85AE4 /* JSEvent.cpp in Sources */,
                                BCEFAF4E0C317E6900FA81F6 /* JSEventCustom.cpp in Sources */,
+                               B25BE5100D06B70800B524C6 /* JSEventTargetBase.cpp in Sources */,
                                BCD9C2700C17AA81005C90A2 /* JSEventTargetNode.cpp in Sources */,
                                1A4A2DEF0A1B852A00C807F8 /* JSHTMLAnchorElement.cpp in Sources */,
                                1A4A2DF10A1B852A00C807F8 /* JSHTMLAppletElement.cpp in Sources */,
                                A8C4A80209D563270003AC8D /* NamedMappedAttrMap.cpp in Sources */,
                                E10B9B6D0B747599003ED890 /* NativeXPathNSResolver.cpp in Sources */,
                                93CCF0600AF6CA7600018E89 /* NavigationAction.cpp in Sources */,
-                               656D37440ADBA5DE00A4554D /* NetscapePlugInStreamLoaderMac.mm in Sources */,
+                               5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */,
                                A8C4A80009D563270003AC8D /* Node.cpp in Sources */,
                                854FE7300A2297BE0058D7AD /* NodeFilter.cpp in Sources */,
                                854FE7320A2297BE0058D7AD /* NodeFilterCondition.cpp in Sources */,
                                B275357F0B053814002CE64F /* Path.cpp in Sources */,
                                B27535630B053814002CE64F /* PathCG.cpp in Sources */,
                                A88DD4890B4629B000C02990 /* PathTraversalState.cpp in Sources */,
+                               BCA378160D15C64600B793D6 /* PausedTimeouts.cpp in Sources */,
                                B27535810B053814002CE64F /* Pen.cpp in Sources */,
                                935C477109AC4D7300A6AAB4 /* PlatformMouseEventMac.mm in Sources */,
                                BC94D1080C274F88006BC617 /* PlatformScreenMac.mm in Sources */,
                                B2227AF20D00BF220071B782 /* SVGViewSpec.cpp in Sources */,
                                B2227AF50D00BF220071B782 /* SVGZoomAndPan.cpp in Sources */,
                                B2E4EC970D00C22B00432643 /* SVGZoomEvent.cpp in Sources */,
+                               5DFE8F560D16477B0076E937 /* ScheduledAction.cpp in Sources */,
                                BCEC01BD0C274DAC009F4EC9 /* Screen.cpp in Sources */,
                                BCAA90C30A7EBA60008B1229 /* ScrollBar.cpp in Sources */,
                                9353676B09AED88B00D35CD6 /* ScrollViewMac.mm in Sources */,
                                BCB16C2C0979C3BD00467741 /* loader.cpp in Sources */,
                                93309DF7099E64920056E581 /* markup.cpp in Sources */,
                                93309E1D099E64920056E581 /* visible_units.cpp in Sources */,
-                               B25BE5100D06B70800B524C6 /* JSEventTargetBase.cpp in Sources */,
-                               93A38B4B0D0E5808006872C2 /* EditorCommand.cpp in Sources */,
-                               BC904B760D10998F00680D32 /* ClassNodeList.cpp in Sources */,
-                               BC4BF9E40D11E133007D247F /* ClassNames.cpp in Sources */,
-                               BCA378160D15C64600B793D6 /* PausedTimeouts.cpp in Sources */,
-                               BCA378BC0D15F64200B793D6 /* ScheduledAction.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index e5fcb69..19b0428 100644 (file)
 #include "ResourceLoader.h"
 #include <wtf/Forward.h>
 
-#ifdef __OBJC__
-#import "WebPlugInStreamLoaderDelegate.h"
-#endif
-
 namespace WebCore {
     class NetscapePlugInStreamLoader;
 
@@ -45,16 +41,9 @@ namespace WebCore {
         virtual void didFinishLoading(NetscapePlugInStreamLoader*) { }
     };
 
-#ifdef __OBJC__
-        typedef id <WebPlugInStreamLoaderDelegate> PlugInStreamLoaderDelegate;
-#else
-        class NetscapePlugInStreamLoaderClient;
-        typedef NetscapePlugInStreamLoaderClient* PlugInStreamLoaderDelegate;
-#endif
-
     class NetscapePlugInStreamLoader : public ResourceLoader {
     public:
-        static PassRefPtr<NetscapePlugInStreamLoader> create(Frame*, PlugInStreamLoaderDelegate);
+        static PassRefPtr<NetscapePlugInStreamLoader> create(Frame*, NetscapePlugInStreamLoaderClient*);
         virtual ~NetscapePlugInStreamLoader();
 
         bool isDone() const;
@@ -67,15 +56,11 @@ namespace WebCore {
         virtual void releaseResources();
 
     private:
-        NetscapePlugInStreamLoader(Frame*, PlugInStreamLoaderDelegate);
+        NetscapePlugInStreamLoader(Frame*, NetscapePlugInStreamLoaderClient*);
 
         virtual void didCancel(const ResourceError& error);
 
-#if PLATFORM(MAC)
-        RetainPtr<PlugInStreamLoaderDelegate> m_stream;
-#else
         NetscapePlugInStreamLoaderClient* m_client;
-#endif
     };
 
 }
diff --git a/WebCore/loader/mac/NetscapePlugInStreamLoaderMac.mm b/WebCore/loader/mac/NetscapePlugInStreamLoaderMac.mm
deleted file mode 100644 (file)
index 9aac2d4..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2005, 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.
- */
-
-#import "config.h"
-#import "NetscapePlugInStreamLoader.h"
-
-#import "DocumentLoader.h"
-#import "FrameLoader.h"
-#import "ResourceError.h"
-#import "ResourceResponse.h"
-#import "SharedBuffer.h"
-#import <wtf/PassRefPtr.h>
-
-namespace WebCore {
-
-NetscapePlugInStreamLoader::NetscapePlugInStreamLoader(Frame* frame, id <WebPlugInStreamLoaderDelegate> stream)
-    : ResourceLoader(frame, true, true)
-    , m_stream(stream)
-{
-    setShouldBufferData(false);
-}
-
-NetscapePlugInStreamLoader::~NetscapePlugInStreamLoader()
-{
-}
-
-PassRefPtr<NetscapePlugInStreamLoader> NetscapePlugInStreamLoader::create(Frame* frame, id <WebPlugInStreamLoaderDelegate> d)
-{
-    return new NetscapePlugInStreamLoader(frame, d);
-}
-
-bool NetscapePlugInStreamLoader::isDone() const
-{
-    return !m_stream;
-}
-
-void NetscapePlugInStreamLoader::releaseResources()
-{
-    m_stream = nil;
-    ResourceLoader::releaseResources();
-}
-
-void NetscapePlugInStreamLoader::didReceiveResponse(const ResourceResponse& theResponse)
-{
-    // Protect self in this delegate method since the additional processing can do
-    // anything including possibly getting rid of the last reference to this object.
-    // One example of this is Radar 3266216.
-    RefPtr<NetscapePlugInStreamLoader> protect(this);
-
-    [m_stream.get() startStreamWithResponse:theResponse.nsURLResponse()];
-    
-    // Don't continue if the stream is cancelled in startStreamWithResponse or didReceiveResponse.
-    if (!m_stream)
-        return;
-    ResourceLoader::didReceiveResponse(theResponse);
-    if (!m_stream)
-        return;
-    if ([theResponse.nsURLResponse() isKindOfClass:[NSHTTPURLResponse class]] &&
-        (theResponse.httpStatusCode() >= 400 || theResponse.httpStatusCode() < 100)) {
-        NSError *error = frameLoader()->fileDoesNotExistError(theResponse);
-        [m_stream.get() cancelLoadAndDestroyStreamWithError:error];
-    }
-}
-
-void NetscapePlugInStreamLoader::didReceiveData(const char* data, int length, long long lengthReceived, bool allAtOnce)
-{
-    // Protect self in this delegate method since the additional processing can do
-    // anything including possibly getting rid of the last reference to this object.
-    // One example of this is Radar 3266216.
-    RefPtr<NetscapePlugInStreamLoader> protect(this);
-
-    NSData *nsData = [[NSData alloc] initWithBytesNoCopy:(void*)data length:length freeWhenDone:NO];
-    [m_stream.get() receivedData:nsData];
-    [nsData release];
-    
-    ResourceLoader::didReceiveData(data, length, lengthReceived, allAtOnce);
-}
-
-void NetscapePlugInStreamLoader::didFinishLoading()
-{
-    // Calling removePlugInStreamLoader will likely result in a call to deref, so we must protect.
-    RefPtr<NetscapePlugInStreamLoader> protect(this);
-
-    m_documentLoader->removePlugInStreamLoader(this);
-    [m_stream.get() finishedLoading];
-    ResourceLoader::didFinishLoading();
-}
-
-void NetscapePlugInStreamLoader::didFail(const ResourceError& error)
-{
-    // Protect self in this delegate method since the additional processing can do
-    // anything including possibly getting rid of the last reference to this object.
-    // One example of this is Radar 3266216.
-    RefPtr<NetscapePlugInStreamLoader> protect(this);
-
-    m_documentLoader->removePlugInStreamLoader(this);
-    [m_stream.get() destroyStreamWithError:error];
-    ResourceLoader::didFail(error);
-}
-
-void NetscapePlugInStreamLoader::didCancel(const ResourceError& error)
-{
-    // Calling removePlugInStreamLoader will likely result in a call to deref, so we must protect.
-    RefPtr<NetscapePlugInStreamLoader> protect(this);
-
-    m_documentLoader->removePlugInStreamLoader(this);
-    [m_stream.get() destroyStreamWithError:error];
-    ResourceLoader::didCancel(error);
-}
-
-}
index 3383d55..a244fae 100644 (file)
@@ -1,3 +1,11 @@
+2007-12-16  Mark Rowe  <mrowe@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        Refactor Mac plugin stream code to use the shared NetscapePlugInStreamLoader implementation.
+
+        * WebKit.xcodeproj/project.pbxproj: Add new files.
+
 2007-12-14  Darin Adler  <darin@apple.com>
 
         * StringsNotToBeLocalized.txt: Updated.
index 1abd78d..4ef5d30 100644 (file)
@@ -53,6 +53,7 @@
                51FDC4D30B0AF5C100F84EB3 /* WebHistoryItemPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5241ADF50B1BC48A004012BD /* WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5241ADF30B1BC48A004012BD /* WebCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5241ADF60B1BC48A004012BD /* WebCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5241ADF40B1BC48A004012BD /* WebCache.mm */; };
+               5D4ADD690D1620350064BBB0 /* WebPlugInStreamLoaderDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D4ADD680D1620350064BBB0 /* WebPlugInStreamLoaderDelegate.h */; };
                5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D7BF8120C2A1D90008CE06D /* WebInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5D7BF8150C2A1D90008CE06D /* WebInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */; };
                5DE83A7A0D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = 5DE83A740D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib */; };
@@ -60,6 +61,8 @@
                5DE83A7C0D0F7F9400CAD12A /* WebViewEditingContextMenuOld.nib in Resources */ = {isa = PBXBuildFile; fileRef = 5DE83A780D0F7F9400CAD12A /* WebViewEditingContextMenuOld.nib */; };
                5DE83A7F0D0F7FAD00CAD12A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5DE83A7D0D0F7FAD00CAD12A /* Localizable.strings */; };
                5DE92FEF0BD7017E0059A5FD /* WebAssertions.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DE92FEE0BD7017E0059A5FD /* WebAssertions.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               5DF7B1D10D161FD00062CD32 /* WebNetscapePlugInStreamLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DF7B1CF0D161FCF0062CD32 /* WebNetscapePlugInStreamLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               5DF7B1D20D161FD00062CD32 /* WebNetscapePlugInStreamLoaderClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5DF7B1D00D161FD00062CD32 /* WebNetscapePlugInStreamLoaderClient.mm */; };
                650F74E409E488F70020118A /* WebUnarchivingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 650F74E209E488F70020118A /* WebUnarchivingState.h */; };
                650F74E509E488F70020118A /* WebUnarchivingState.m in Sources */ = {isa = PBXBuildFile; fileRef = 650F74E309E488F70020118A /* WebUnarchivingState.m */; };
                65488DA1084FBCCB00831AD0 /* WebNSDictionaryExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 65488D9F084FBCCB00831AD0 /* WebNSDictionaryExtras.h */; };
                51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryItemPrivate.h; sourceTree = "<group>"; };
                5241ADF30B1BC48A004012BD /* WebCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCache.h; sourceTree = "<group>"; };
                5241ADF40B1BC48A004012BD /* WebCache.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCache.mm; sourceTree = "<group>"; };
+               5D4ADD680D1620350064BBB0 /* WebPlugInStreamLoaderDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPlugInStreamLoaderDelegate.h; sourceTree = "<group>"; };
                5D7BF8120C2A1D90008CE06D /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; };
                5D7BF8130C2A1D90008CE06D /* WebInspector.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspector.mm; sourceTree = "<group>"; };
                5DE83A750D0F7F9400CAD12A /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/WebJavaScriptTextInputPanel.nib; sourceTree = SOURCE_ROOT; };
                5DE83A790D0F7F9400CAD12A /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/WebViewEditingContextMenuOld.nib; sourceTree = SOURCE_ROOT; };
                5DE83A7E0D0F7FAD00CAD12A /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = SOURCE_ROOT; };
                5DE92FEE0BD7017E0059A5FD /* WebAssertions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebAssertions.h; sourceTree = "<group>"; };
+               5DF7B1CF0D161FCF0062CD32 /* WebNetscapePlugInStreamLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNetscapePlugInStreamLoaderClient.h; sourceTree = "<group>"; };
+               5DF7B1D00D161FD00062CD32 /* WebNetscapePlugInStreamLoaderClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNetscapePlugInStreamLoaderClient.mm; sourceTree = "<group>"; };
                650F74E209E488F70020118A /* WebUnarchivingState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebUnarchivingState.h; sourceTree = "<group>"; };
                650F74E309E488F70020118A /* WebUnarchivingState.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebUnarchivingState.m; sourceTree = "<group>"; };
                65488D9F084FBCCB00831AD0 /* WebNSDictionaryExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSDictionaryExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                                06693DDB0BFBA85200216072 /* WebInspectorClient.mm */,
                                9345D4EA0365C5B2008635CE /* WebJavaScriptTextInputPanel.h */,
                                9345D4EB0365C5B2008635CE /* WebJavaScriptTextInputPanel.m */,
+                               5DF7B1CF0D161FCF0062CD32 /* WebNetscapePlugInStreamLoaderClient.h */,
+                               5DF7B1D00D161FD00062CD32 /* WebNetscapePlugInStreamLoaderClient.mm */,
                                84723BE3056D719E0044BFEA /* WebKeyGenerator.h */,
                                84723BE4056D719E0044BFEA /* WebKeyGenerator.m */,
                                93EB178E09F88D510091F8FF /* WebSystemInterface.h */,
                                F5883BE1025E5E9D01000102 /* WebNullPluginView.mm */,
                                F5F717200288493C018635CA /* WebPluginDatabase.h */,
                                F5F717210288493C018635CA /* WebPluginDatabase.m */,
+                               5D4ADD680D1620350064BBB0 /* WebPlugInStreamLoaderDelegate.h */,
                        );
                        name = Plugins;
                        path = mac/Plugins;
                                9398102D0824BF01008DF038 /* WebBaseNetscapePluginViewPrivate.h in Headers */,
                                9398102E0824BF01008DF038 /* WebBasePluginPackage.h in Headers */,
                                5241ADF50B1BC48A004012BD /* WebCache.h in Headers */,
+                               51CBFCAD0D10E6C5002DBF51 /* WebCachedPagePlatformData.h in Headers */,
                                14D8252F0AF955090004F057 /* WebChromeClient.h in Headers */,
                                939810490824BF01008DF038 /* WebClipView.h in Headers */,
                                065AD5A30B0C32C7005A2B1D /* WebContextMenuClient.h in Headers */,
                                939810240824BF01008DF038 /* WebNSViewExtras.h in Headers */,
                                939810250824BF01008DF038 /* WebNSWindowExtras.h in Headers */,
                                226E9E6A09D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.h in Headers */,
+                               5DF7B1D10D161FD00062CD32 /* WebNetscapePlugInStreamLoaderClient.h in Headers */,
                                939810300824BF01008DF038 /* WebNetscapePluginEmbeddedView.h in Headers */,
                                939810310824BF01008DF038 /* WebNetscapePluginPackage.h in Headers */,
                                939810330824BF01008DF038 /* WebNetscapePluginStream.h in Headers */,
                                939810A40824BF01008DF038 /* WebPDFView.h in Headers */,
                                9398102A0824BF01008DF038 /* WebPanelAuthenticationHandler.h in Headers */,
                                A7D3C5BC0B5773C5002CA450 /* WebPasteboardHelper.h in Headers */,
+                               5D4ADD690D1620350064BBB0 /* WebPlugInStreamLoaderDelegate.h in Headers */,
                                939810350824BF01008DF038 /* WebPlugin.h in Headers */,
                                939810360824BF01008DF038 /* WebPluginContainer.h in Headers */,
                                939810B10824BF01008DF038 /* WebPluginContainerCheck.h in Headers */,
                                9398109B0824BF01008DF038 /* WebViewInternal.h in Headers */,
                                939810710824BF01008DF038 /* WebViewPrivate.h in Headers */,
                                939810970824BF01008DF038 /* npfunctions.h in Headers */,
-                               51CBFCAD0D10E6C5002DBF51 /* WebCachedPagePlatformData.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               ED3B48DF0CC51F7E00DFF1EB /* StringsNotToBeLocalized.txt in Resources */,
                                939810BA0824BF01008DF038 /* IDNScriptWhiteList.txt in Resources */,
+                               5DE83A7F0D0F7FAD00CAD12A /* Localizable.strings in Resources */,
+                               ED3B48DF0CC51F7E00DFF1EB /* StringsNotToBeLocalized.txt in Resources */,
                                939810B50824BF01008DF038 /* WebAuthenticationPanel.nib in Resources */,
-                               939810B60824BF01008DF038 /* nullplugin.tiff in Resources */,
-                               939810B70824BF01008DF038 /* url_icon.tiff in Resources */,
                                5DE83A7A0D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib in Resources */,
                                5DE83A7B0D0F7F9400CAD12A /* WebViewEditingContextMenu.nib in Resources */,
                                5DE83A7C0D0F7F9400CAD12A /* WebViewEditingContextMenuOld.nib in Resources */,
-                               5DE83A7F0D0F7FAD00CAD12A /* Localizable.strings in Resources */,
+                               939810B60824BF01008DF038 /* nullplugin.tiff in Resources */,
+                               939810B70824BF01008DF038 /* url_icon.tiff in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                939810C90824BF01008DF038 /* WebNSViewExtras.m in Sources */,
                                939810CA0824BF01008DF038 /* WebNSWindowExtras.m in Sources */,
                                226E9E6B09D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.c in Sources */,
+                               5DF7B1D20D161FD00062CD32 /* WebNetscapePlugInStreamLoaderClient.mm in Sources */,
                                939810D50824BF01008DF038 /* WebNetscapePluginEmbeddedView.mm in Sources */,
                                939810D60824BF01008DF038 /* WebNetscapePluginPackage.m in Sources */,
                                939810D80824BF01008DF038 /* WebNetscapePluginStream.mm in Sources */,
index 10746f3..7e875b3 100644 (file)
@@ -1,3 +1,24 @@
+2007-12-16  Mark Rowe  <mrowe@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        Refactor Mac plugin stream code to use the shared NetscapePlugInStreamLoader implementation.
+
+        * Plugins/WebBaseNetscapePluginStream.h:
+        * Plugins/WebNetscapePluginStream.h:
+        * Plugins/WebNetscapePluginStream.mm:
+        (-[WebNetscapePluginStream initWithRequest:plugin:notifyData:sendNotification:]):
+        (-[WebNetscapePluginStream dealloc]):
+        (-[WebNetscapePluginStream finalize]):
+        * Plugins/WebPlugInStreamLoaderDelegate.h: Moved from WebCore.
+        * WebCoreSupport/WebNetscapePlugInStreamLoaderClient.h: Added.
+        (WebNetscapePlugInStreamLoaderClient::WebNetscapePlugInStreamLoaderClient):
+        * WebCoreSupport/WebNetscapePlugInStreamLoaderClient.mm: Added.
+        (WebNetscapePlugInStreamLoaderClient::didReceiveResponse): Call through to the equivalent WebPlugInStreamLoaderDelegate method.
+        (WebNetscapePlugInStreamLoaderClient::didReceiveData): Ditto.
+        (WebNetscapePlugInStreamLoaderClient::didFail): Ditto.
+        (WebNetscapePlugInStreamLoaderClient::didFinishLoading): Ditto.
+
 2007-12-16  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
index 0236047..77cf609 100644 (file)
@@ -29,7 +29,7 @@
 #import <Foundation/Foundation.h>
 
 #import <WebKit/npfunctions.h>
-#import <WebCore/WebPlugInStreamLoaderDelegate.h>
+#import <WebKit/WebPlugInStreamLoaderDelegate.h>
 
 @class WebBaseNetscapePluginView;
 @class NSURLResponse;
index 881d79b..e9e48f0 100644 (file)
@@ -35,10 +35,13 @@ namespace WebCore {
 }
 @class NSURLRequest;
 
+class WebNetscapePlugInStreamLoaderClient;
+
 @interface WebNetscapePluginStream : WebBaseNetscapePluginStream 
 {    
     WebCore::FrameLoader* _frameLoader;
     WebCore::NetscapePlugInStreamLoader* _loader;
+    WebNetscapePlugInStreamLoaderClient* _client;
     NSURLRequest *request;
 }
 
index 630194b..8b03e01 100644 (file)
@@ -41,6 +41,7 @@
 #import <WebKit/WebNSURLRequestExtras.h>
 #import <WebKit/WebNetscapePluginEmbeddedView.h>
 #import <WebKit/WebNetscapePluginPackage.h>
+#import <WebKit/WebNetscapePlugInStreamLoaderClient.h>
 #import <WebKit/WebViewInternal.h>
 #import <WebCore/ResourceError.h>
 #import <WebCore/WebCoreObjCExtras.h>
@@ -88,7 +89,9 @@ using namespace WebCore;
     if (core([view webFrame])->loader()->shouldHideReferrer([theRequest URL], core([view webFrame])->loader()->outgoingReferrer()))
         [(NSMutableURLRequest *)request _web_setHTTPReferrer:nil];
 
-    _loader = NetscapePlugInStreamLoader::create(core([view webFrame]), self).releaseRef();
+    _client = new WebNetscapePlugInStreamLoaderClient(self);
+    _loader = NetscapePlugInStreamLoader::create(core([view webFrame]), _client).releaseRef();
+    _loader->setShouldBufferData(false);
     
     isTerminated = NO;
 
@@ -99,6 +102,7 @@ using namespace WebCore;
 {
     if (_loader)
         _loader->deref();
+    delete _client;
     [request release];
     [super dealloc];
 }
@@ -108,6 +112,7 @@ using namespace WebCore;
     ASSERT_MAIN_THREAD();
     if (_loader)
         _loader->deref();
+    delete _client;
     [super finalize];
 }
 
@@ -34,7 +34,7 @@
 
 - (void)startStreamWithResponse:(NSURLResponse *)r;
 
-    // destroyStreamWithError tells the plug-in that the load is completed (error == nil) or ended in 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:.
diff --git a/WebKit/mac/WebCoreSupport/WebNetscapePlugInStreamLoaderClient.h b/WebKit/mac/WebCoreSupport/WebNetscapePlugInStreamLoaderClient.h
new file mode 100644 (file)
index 0000000..3f74097
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2007 Apple 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.
+ */
+
+#import <WebKit/WebPlugInStreamLoaderDelegate.h>
+#import <WebCore/NetscapePlugInStreamLoader.h>
+#import <wtf/RetainPtr.h>
+
+namespace WebCore {
+    class NetscapePlugInStreamLoader;
+    class ResourceResponse;
+};
+
+typedef id <WebPlugInStreamLoaderDelegate> PlugInStreamLoaderDelegate;
+
+class WebNetscapePlugInStreamLoaderClient : public WebCore::NetscapePlugInStreamLoaderClient {
+public:
+    WebNetscapePlugInStreamLoaderClient(PlugInStreamLoaderDelegate delegate) : m_stream(delegate) { }
+    virtual void didReceiveResponse(WebCore::NetscapePlugInStreamLoader*, const WebCore::ResourceResponse&);
+    virtual void didReceiveData(WebCore::NetscapePlugInStreamLoader*, const char*, int);
+    virtual void didFail(WebCore::NetscapePlugInStreamLoader*, const WebCore::ResourceError&);
+    virtual void didFinishLoading(WebCore::NetscapePlugInStreamLoader*);
+
+private:
+    RetainPtr<PlugInStreamLoaderDelegate> m_stream;
+};
diff --git a/WebKit/mac/WebCoreSupport/WebNetscapePlugInStreamLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebNetscapePlugInStreamLoaderClient.mm
new file mode 100644 (file)
index 0000000..fcb3fbe
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2007 Apple 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.
+ */
+
+#import <WebKit/WebNetscapePlugInStreamLoaderClient.h>
+#import <WebCore/NetscapePlugInStreamLoader.h>
+#import <WebCore/ResourceResponse.h>
+
+using namespace WebCore;
+
+void WebNetscapePlugInStreamLoaderClient::didReceiveResponse(NetscapePlugInStreamLoader*, const ResourceResponse& theResponse)
+{
+    [m_stream.get() startStreamWithResponse:theResponse.nsURLResponse()];
+}
+
+void WebNetscapePlugInStreamLoaderClient::didReceiveData(NetscapePlugInStreamLoader*, const char* data, int length)
+{
+    NSData *nsData = [[NSData alloc] initWithBytesNoCopy:(void*)data length:length freeWhenDone:NO];
+    [m_stream.get() receivedData:nsData];
+    [nsData release];
+}
+
+void WebNetscapePlugInStreamLoaderClient::didFail(NetscapePlugInStreamLoader*, const ResourceError& error)
+{
+    [m_stream.get() destroyStreamWithError:error];
+    m_stream = 0;
+}
+
+void WebNetscapePlugInStreamLoaderClient::didFinishLoading(NetscapePlugInStreamLoader*)
+{
+    [m_stream.get() finishedLoading];
+    m_stream = 0;
+}