Commit f13819b2 authored by mrowe@apple.com's avatar mrowe@apple.com

Refactor Mac plugin stream code to use the shared NetscapePlugInStreamLoader implementation.

Reviewed by Maciej Stachowiak.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@28795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 007f8309
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.
......
......@@ -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
......
This diff is collapsed.
......@@ -29,10 +29,6 @@
#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
};
}
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.
......
......@@ -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 */; };
......@@ -410,6 +413,7 @@
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; };
......@@ -417,6 +421,8 @@
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; };
......@@ -1044,6 +1050,8 @@
06693DDB0BFBA85200216072 /* WebInspectorClient.mm */,
9345D4EA0365C5B2008635CE /* WebJavaScriptTextInputPanel.h */,
9345D4EB0365C5B2008635CE /* WebJavaScriptTextInputPanel.m */,
5DF7B1CF0D161FCF0062CD32 /* WebNetscapePlugInStreamLoaderClient.h */,
5DF7B1D00D161FD00062CD32 /* WebNetscapePlugInStreamLoaderClient.mm */,
84723BE3056D719E0044BFEA /* WebKeyGenerator.h */,
84723BE4056D719E0044BFEA /* WebKeyGenerator.m */,
93EB178E09F88D510091F8FF /* WebSystemInterface.h */,
......@@ -1072,6 +1080,7 @@
F5883BE1025E5E9D01000102 /* WebNullPluginView.mm */,
F5F717200288493C018635CA /* WebPluginDatabase.h */,
F5F717210288493C018635CA /* WebPluginDatabase.m */,
5D4ADD680D1620350064BBB0 /* WebPlugInStreamLoaderDelegate.h */,
);
name = Plugins;
path = mac/Plugins;
......@@ -1166,6 +1175,7 @@
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 */,
......@@ -1259,6 +1269,7 @@
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 */,
......@@ -1269,6 +1280,7 @@
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 */,
......@@ -1309,7 +1321,6 @@
9398109B0824BF01008DF038 /* WebViewInternal.h in Headers */,
939810710824BF01008DF038 /* WebViewPrivate.h in Headers */,
939810970824BF01008DF038 /* npfunctions.h in Headers */,
51CBFCAD0D10E6C5002DBF51 /* WebCachedPagePlatformData.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1375,15 +1386,15 @@
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;
};
......@@ -1564,6 +1575,7 @@
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 */,
......
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.
......
......@@ -29,7 +29,7 @@
#import <Foundation/Foundation.h>
#import <WebKit/npfunctions.h>
#import <WebCore/WebPlugInStreamLoaderDelegate.h>
#import <WebKit/WebPlugInStreamLoaderDelegate.h>
@class WebBaseNetscapePluginView;
@class NSURLResponse;
......
......@@ -35,10 +35,13 @@ namespace WebCore {
}
@class NSURLRequest;
class WebNetscapePlugInStreamLoaderClient;
@interface WebNetscapePluginStream : WebBaseNetscapePluginStream
{
WebCore::FrameLoader* _frameLoader;
WebCore::NetscapePlugInStreamLoader* _loader;
WebNetscapePlugInStreamLoaderClient* _client;
NSURLRequest *request;
}
......
......@@ -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:.
......
/*
* 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;
};
/*
* Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
* 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
......@@ -26,111 +26,32 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "config.h"
#import "NetscapePlugInStreamLoader.h"
#import <WebKit/WebNetscapePlugInStreamLoaderClient.h>
#import <WebCore/NetscapePlugInStreamLoader.h>
#import <WebCore/ResourceResponse.h>
#import "DocumentLoader.h"
#import "FrameLoader.h"
#import "ResourceError.h"
#import "ResourceResponse.h"
#import "SharedBuffer.h"
#import <wtf/PassRefPtr.h>
using namespace WebCore;
namespace WebCore {
NetscapePlugInStreamLoader::NetscapePlugInStreamLoader(Frame* frame, id <WebPlugInStreamLoaderDelegate> stream)
: ResourceLoader(frame, true, true)
, m_stream(stream)
{
setShouldBufferData(false);
}
NetscapePlugInStreamLoader::~NetscapePlugInStreamLoader()
void WebNetscapePlugInStreamLoaderClient::didReceiveResponse(NetscapePlugInStreamLoader*, const ResourceResponse& theResponse)
{
}
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)
void WebNetscapePlugInStreamLoaderClient::didReceiveData(NetscapePlugInStreamLoader*, const char* data, int length)
{
// 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)
void WebNetscapePlugInStreamLoaderClient::didFail(NetscapePlugInStreamLoader*, 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);
m_stream = 0;
}
void NetscapePlugInStreamLoader::didCancel(const ResourceError& error)
void WebNetscapePlugInStreamLoaderClient::didFinishLoading(NetscapePlugInStreamLoader*)
{
// 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);
}
[m_stream.get() finishedLoading];
m_stream = 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment