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

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

        Reviewed by Sam Weinig.

        Get rid of WebNetscapePlugInStreamLoaderClient, the plug-in stream is its own client.
        
        * Plugins/WebBaseNetscapePluginStream.h:
        * Plugins/WebBaseNetscapePluginStream.mm:
        (WebNetscapePluginStream::WebNetscapePluginStream):
        (-[WebBaseNetscapePluginStream dealloc]):
        (-[WebBaseNetscapePluginStream finalize]):
        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView pluginView:receivedError:]):
        (-[WebBaseNetscapePluginView pluginViewFinishedLoading:]):
        (-[WebBaseNetscapePluginView evaluateJavaScriptPluginRequest:]):
        (-[WebBaseNetscapePluginView destroyStream:reason:]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37913 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 922a50eb
2008-10-27 Anders Carlsson <andersca@apple.com>
Reviewed by Sam Weinig.
Get rid of WebNetscapePlugInStreamLoaderClient, the plug-in stream is its own client.
* Plugins/WebBaseNetscapePluginStream.h:
* Plugins/WebBaseNetscapePluginStream.mm:
(WebNetscapePluginStream::WebNetscapePluginStream):
(-[WebBaseNetscapePluginStream dealloc]):
(-[WebBaseNetscapePluginStream finalize]):
* Plugins/WebBaseNetscapePluginView.mm:
(-[WebBaseNetscapePluginView pluginView:receivedError:]):
(-[WebBaseNetscapePluginView pluginViewFinishedLoading:]):
(-[WebBaseNetscapePluginView evaluateJavaScriptPluginRequest:]):
(-[WebBaseNetscapePluginView destroyStream:reason:]):
2008-10-27 Anders Carlsson <andersca@apple.com>
Reviewed by Darin Adler.
......
......@@ -43,8 +43,6 @@ namespace WebCore {
class NetscapePlugInStreamLoader;
}
class WebNetscapePlugInStreamLoaderClient;
@class WebBaseNetscapePluginView;
@class NSURLResponse;
@class WebBaseNetscapePluginStream;
......@@ -122,7 +120,6 @@ public:
WebCore::FrameLoader* m_frameLoader;
WebCore::NetscapePlugInStreamLoader* m_loader;
WebNetscapePlugInStreamLoaderClient* m_client;
NSURLRequest *m_request;
NPPluginFuncs *m_pluginFuncs;
......@@ -137,7 +134,7 @@ private:
WebNetscapePluginStream(WebBaseNetscapePluginStream *, NSURLRequest *, NPP, bool sendNotification, void* notifyData);
};
@interface WebBaseNetscapePluginStream : NSObject<WebPlugInStreamLoaderDelegate>
@interface WebBaseNetscapePluginStream : NSObject
{
RefPtr<WebNetscapePluginStream> _impl;
}
......
......@@ -134,7 +134,6 @@ WebNetscapePluginStream::WebNetscapePluginStream(WebBaseNetscapePluginStream *st
, m_newStreamSuccessful(false)
, m_frameLoader(frameLoader)
, m_loader(0)
, m_client(0)
, m_request(0)
, m_pluginFuncs(0)
, m_deliverDataTimer(this, &WebNetscapePluginStream::deliverDataTimerFired)
......@@ -157,7 +156,6 @@ WebNetscapePluginStream::WebNetscapePluginStream(WebBaseNetscapePluginStream *st
, m_newStreamSuccessful(false)
, m_frameLoader(0)
, m_loader(0)
, m_client(0)
, m_request([request mutableCopy])
, m_pluginFuncs(0)
, m_deliverDataTimer(this, &WebNetscapePluginStream::deliverDataTimerFired)
......@@ -180,8 +178,7 @@ WebNetscapePluginStream::WebNetscapePluginStream(WebBaseNetscapePluginStream *st
if (core([view webFrame])->loader()->shouldHideReferrer([request URL], core([view webFrame])->loader()->outgoingReferrer()))
[(NSMutableURLRequest *)m_request _web_setHTTPReferrer:nil];
m_client = new WebNetscapePlugInStreamLoaderClient(stream);
m_loader = NetscapePlugInStreamLoader::create(core([view webFrame]), m_client).releaseRef();
m_loader = NetscapePlugInStreamLoader::create(core([view webFrame]), this).releaseRef();
m_loader->setShouldBufferData(false);
}
......@@ -207,7 +204,6 @@ WebNetscapePluginStream::WebNetscapePluginStream(WebBaseNetscapePluginStream *st
if (_impl->m_loader)
_impl->m_loader->deref();
delete _impl->m_client;
[_impl->m_request release];
free((void *)_impl->m_stream.url);
......@@ -232,7 +228,6 @@ WebNetscapePluginStream::WebNetscapePluginStream(WebBaseNetscapePluginStream *st
if (_impl->m_loader)
_impl->m_loader->deref();
delete _impl->m_client;
free((void *)_impl->m_stream.url);
free(_impl->m_headers);
......@@ -405,11 +400,6 @@ void WebNetscapePluginStream::startStreamWithResponse(NSURLResponse *response)
didReceiveResponse(0, response);
}
- (void)startStreamWithResponse:(NSURLResponse *)r
{
_impl->startStreamWithResponse(r);
}
bool WebNetscapePluginStream::wantsAllStreams() const
{
if (!m_pluginFuncs->getvalue)
......@@ -429,11 +419,6 @@ bool WebNetscapePluginStream::wantsAllStreams() const
return value;
}
- (BOOL)wantsAllStreams
{
return _impl->wantsAllStreams();
}
void WebNetscapePluginStream::destroyStream()
{
if (m_isTerminated)
......@@ -540,11 +525,6 @@ void WebNetscapePluginStream::cancelLoadWithError(NSError *error)
m_loader->cancel(error);
}
- (void)cancelLoadWithError:(NSError *)error
{
_impl->cancelLoadWithError(error);
}
void WebNetscapePluginStream::destroyStreamWithError(NSError *error)
{
destroyStreamWithReason(reasonForError(error));
......@@ -555,11 +535,6 @@ void WebNetscapePluginStream::didFail(WebCore::NetscapePlugInStreamLoader*, cons
destroyStreamWithError(error);
}
- (void)destroyStreamWithError:(NSError *)error
{
_impl->didFail(0, error);
}
void WebNetscapePluginStream::cancelLoadAndDestroyStreamWithError(NSError *error)
{
RetainPtr<WebBaseNetscapePluginStream> protect(m_pluginStream);
......@@ -568,11 +543,6 @@ void WebNetscapePluginStream::cancelLoadAndDestroyStreamWithError(NSError *error
setPlugin(0);
}
- (void)cancelLoadAndDestroyStreamWithError:(NSError *)error
{
return _impl->cancelLoadAndDestroyStreamWithError(error);
}
void WebNetscapePluginStream::deliverData()
{
if (!m_stream.ndata || [m_deliveryData.get() length] == 0)
......@@ -686,11 +656,6 @@ void WebNetscapePluginStream::didFinishLoading(NetscapePlugInStreamLoader*)
destroyStreamWithReason(NPRES_DONE);
}
- (void)finishedLoading
{
_impl->didFinishLoading(0);
}
void WebNetscapePluginStream::didReceiveData(NetscapePlugInStreamLoader*, const char* bytes, int length)
{
NSData *data = [[NSData alloc] initWithBytesNoCopy:(void*)bytes length:length freeWhenDone:NO];
......@@ -709,11 +674,6 @@ void WebNetscapePluginStream::didReceiveData(NetscapePlugInStreamLoader*, const
[data release];
}
- (void)receivedData:(NSData *)data
{
_impl->didReceiveData(0, (const char*)[data bytes], [data length]);
}
- (WebNetscapePluginStream *)impl
{
return _impl.get();
......
......@@ -1796,8 +1796,8 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
if (![self isStarted]) {
return;
}
[_manualStream destroyStreamWithError:error];
[_manualStream impl]->destroyStreamWithError(error);
}
- (void)pluginViewFinishedLoading:(NSView *)pluginView
......@@ -1806,7 +1806,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
ASSERT(_manualStream);
if ([self isStarted])
[_manualStream finishedLoading];
[_manualStream impl]->didFinishLoading(0);
}
#pragma mark NSTextInput implementation
......@@ -2022,21 +2022,20 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
} else if ([result length] > 0) {
// Don't call NPP_NewStream and other stream methods if there is no JS result to deliver. This is what Mozilla does.
NSData *JSData = [result dataUsingEncoding:NSUTF8StringEncoding];
WebBaseNetscapePluginStream *stream = [[WebBaseNetscapePluginStream alloc] initWithRequest:[NSURLRequest requestWithURL:URL]
plugin:plugin
notifyData:[JSPluginRequest notifyData]
sendNotification:[JSPluginRequest sendNotification]];
NSURLResponse *response = [[NSURLResponse alloc] initWithURL:URL
MIMEType:@"text/plain"
expectedContentLength:[JSData length]
textEncodingName:nil];
[stream startStreamWithResponse:response];
[response release];
RetainPtr<NSURLResponse> response(AdoptNS, [[NSURLResponse alloc] initWithURL:URL
MIMEType:@"text/plain"
expectedContentLength:[JSData length]
textEncodingName:nil]);
[stream receivedData:JSData];
[stream finishedLoading];
[stream impl]->startStreamWithResponse(response.get());
[stream impl]->didReceiveData(0, static_cast<const char*>([JSData bytes]), [JSData length]);
[stream impl]->didFinishLoading(0);
[stream release];
}
}
......@@ -2350,7 +2349,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
}
WebBaseNetscapePluginStream *browserStream = static_cast<WebBaseNetscapePluginStream *>(stream->ndata);
[browserStream cancelLoadAndDestroyStreamWithError:[browserStream impl]->errorForReason(reason)];
[browserStream impl]->cancelLoadAndDestroyStreamWithError([browserStream impl]->errorForReason(reason));
return NPERR_NO_ERROR;
}
......
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