Commit 922a50eb authored by andersca@apple.com's avatar andersca@apple.com
Browse files

2008-10-27 Anders Carlsson <andersca@apple.com>

        Reviewed by Darin Adler.

        Change the Obj-C init methods to simply call WebNetscapePluginStream::create.
        
        * Plugins/WebBaseNetscapePluginStream.h:
        (WebNetscapePluginStream::create):
        * Plugins/WebBaseNetscapePluginStream.mm:
        (-[WebBaseNetscapePluginStream initWithFrameLoader:]):
        (WebNetscapePluginStream::WebNetscapePluginStream):
        (-[WebBaseNetscapePluginStream initWithRequest:plugin:notifyData:sendNotification:]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 71d0d106
2008-10-27 Anders Carlsson <andersca@apple.com>
Reviewed by Darin Adler.
Change the Obj-C init methods to simply call WebNetscapePluginStream::create.
* Plugins/WebBaseNetscapePluginStream.h:
(WebNetscapePluginStream::create):
* Plugins/WebBaseNetscapePluginStream.mm:
(-[WebBaseNetscapePluginStream initWithFrameLoader:]):
(WebNetscapePluginStream::WebNetscapePluginStream):
(-[WebBaseNetscapePluginStream initWithRequest:plugin:notifyData:sendNotification:]):
2008-10-27 Anders Carlsson <andersca@apple.com>
Reviewed by Kevin Decker.
......
......@@ -53,10 +53,15 @@ class WebNetscapePluginStream : public RefCounted<WebNetscapePluginStream>
, private WebCore::NetscapePlugInStreamLoaderClient
{
public:
static PassRefPtr<WebNetscapePluginStream> create(WebBaseNetscapePluginStream *stream)
static PassRefPtr<WebNetscapePluginStream> create(WebBaseNetscapePluginStream *stream, NSURLRequest *request, NPP plugin, bool sendNotification, void* notifyData)
{
return adoptRef(new WebNetscapePluginStream(stream));
return adoptRef(new WebNetscapePluginStream(stream, request, plugin, sendNotification, notifyData));
}
static PassRefPtr<WebNetscapePluginStream> create(WebBaseNetscapePluginStream *stream, WebCore::FrameLoader* frameLoader)
{
return adoptRef(new WebNetscapePluginStream(stream, frameLoader));
}
virtual ~WebNetscapePluginStream() { }
NPP plugin() const { return m_plugin; }
......@@ -128,27 +133,8 @@ public:
WebBaseNetscapePluginStream *m_pluginStream;
private:
WebNetscapePluginStream(WebBaseNetscapePluginStream *stream)
: m_plugin(0)
, m_transferMode(0)
, m_offset(0)
, m_fileDescriptor(-1)
, m_sendNotification(false)
, m_notifyData(0)
, m_headers(0)
, m_reason(NPRES_BASE)
, m_isTerminated(false)
, m_newStreamSuccessful(false)
, m_frameLoader(0)
, m_loader(0)
, m_client(0)
, m_request(0)
, m_pluginFuncs(0)
, m_deliverDataTimer(this, &WebNetscapePluginStream::deliverDataTimerFired)
, m_pluginStream(stream)
{
memset(&m_stream, 0, sizeof(NPStream));
}
WebNetscapePluginStream(WebBaseNetscapePluginStream *, WebCore::FrameLoader*);
WebNetscapePluginStream(WebBaseNetscapePluginStream *, NSURLRequest *, NPP, bool sendNotification, void* notifyData);
};
@interface WebBaseNetscapePluginStream : NSObject<WebPlugInStreamLoaderDelegate>
......
......@@ -116,48 +116,81 @@ NSError *WebNetscapePluginStream::errorForReason(NPReason reason) const
{
[super init];
_impl = WebNetscapePluginStream::create(self);
_impl->m_frameLoader = frameLoader;
_impl = WebNetscapePluginStream::create(self, frameLoader);
return self;
}
- (id)initWithRequest:(NSURLRequest *)theRequest
plugin:(NPP)thePlugin
notifyData:(void *)theNotifyData
sendNotification:(BOOL)flag
{
WebBaseNetscapePluginView *view = (WebBaseNetscapePluginView *)thePlugin->ndata;
WebNetscapePluginStream::WebNetscapePluginStream(WebBaseNetscapePluginStream *stream, WebCore::FrameLoader* frameLoader)
: m_plugin(0)
, m_transferMode(0)
, m_offset(0)
, m_fileDescriptor(-1)
, m_sendNotification(false)
, m_notifyData(0)
, m_headers(0)
, m_reason(NPRES_BASE)
, m_isTerminated(false)
, m_newStreamSuccessful(false)
, m_frameLoader(frameLoader)
, m_loader(0)
, m_client(0)
, m_request(0)
, m_pluginFuncs(0)
, m_deliverDataTimer(this, &WebNetscapePluginStream::deliverDataTimerFired)
, m_pluginStream(stream)
{
memset(&m_stream, 0, sizeof(NPStream));
}
WebNetscapePluginStream::WebNetscapePluginStream(WebBaseNetscapePluginStream *stream, NSURLRequest *request, NPP plugin, bool sendNotification, void* notifyData)
: m_requestURL([request URL])
, m_plugin(0)
, m_transferMode(0)
, m_offset(0)
, m_fileDescriptor(-1)
, m_sendNotification(sendNotification)
, m_notifyData(notifyData)
, m_headers(0)
, m_reason(NPRES_BASE)
, m_isTerminated(false)
, m_newStreamSuccessful(false)
, m_frameLoader(0)
, m_loader(0)
, m_client(0)
, m_request([request mutableCopy])
, m_pluginFuncs(0)
, m_deliverDataTimer(this, &WebNetscapePluginStream::deliverDataTimerFired)
, m_pluginStream(stream)
{
memset(&m_stream, 0, sizeof(NPStream));
WebBaseNetscapePluginView *view = (WebBaseNetscapePluginView *)plugin->ndata;
// This check has already been done by the plug-in view.
ASSERT(FrameLoader::canLoad([theRequest URL], String(), core([view webFrame])->document()));
ASSERT([theRequest URL]);
ASSERT(thePlugin);
ASSERT(FrameLoader::canLoad([request URL], String(), core([view webFrame])->document()));
_impl = WebNetscapePluginStream::create(self);
ASSERT([request URL]);
ASSERT(plugin);
// Temporarily set isTerminated to true to avoid assertion failure in dealloc in case we are released in this method.
_impl->m_isTerminated = true;
setPlugin(plugin);
_impl->m_requestURL = [theRequest URL];
_impl->setPlugin(thePlugin);
_impl->m_notifyData = theNotifyData;
_impl->m_sendNotification = flag;
_impl->m_fileDescriptor = -1;
_impl->m_newStreamSuccessful = false;
streams().add(&_impl->m_stream, thePlugin);
streams().add(&m_stream, plugin);
_impl->m_request = [theRequest mutableCopy];
if (core([view webFrame])->loader()->shouldHideReferrer([theRequest URL], core([view webFrame])->loader()->outgoingReferrer()))
[(NSMutableURLRequest *)_impl->m_request _web_setHTTPReferrer:nil];
_impl->m_client = new WebNetscapePlugInStreamLoaderClient(self);
_impl->m_loader = NetscapePlugInStreamLoader::create(core([view webFrame]), _impl->m_client).releaseRef();
_impl->m_loader->setShouldBufferData(false);
if (core([view webFrame])->loader()->shouldHideReferrer([request URL], core([view webFrame])->loader()->outgoingReferrer()))
[(NSMutableURLRequest *)m_request _web_setHTTPReferrer:nil];
_impl->m_isTerminated = false;
m_client = new WebNetscapePlugInStreamLoaderClient(stream);
m_loader = NetscapePlugInStreamLoader::create(core([view webFrame]), m_client).releaseRef();
m_loader->setShouldBufferData(false);
}
- (id)initWithRequest:(NSURLRequest *)theRequest
plugin:(NPP)thePlugin
notifyData:(void *)theNotifyData
sendNotification:(BOOL)flag
{
_impl = WebNetscapePluginStream::create(self, theRequest, thePlugin, flag, theNotifyData);
return self;
}
......
Supports Markdown
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