34 #include "NetScapePlugInStreamLoader.h" |
34 #include "NetScapePlugInStreamLoader.h" |
35 |
35 |
36 using namespace WebCore; |
36 using namespace WebCore; |
37 |
37 |
38 |
38 |
39 NetscapePlugInStreamLoaderClient* NetscapePlugInStreamLoaderClient::NewL(const String& url, PluginSkin* pluginskin, Frame* frame, void* notifydata) |
39 NetscapePlugInStreamLoaderClient* NetscapePlugInStreamLoaderClient::NewL(const String& url, PluginSkin* pluginskin, Frame* frame, void* notifydata, TBool notify/*=EFalse*/) |
40 { |
40 { |
41 NetscapePlugInStreamLoaderClient* self = new (ELeave) NetscapePlugInStreamLoaderClient(); |
41 NetscapePlugInStreamLoaderClient* self = new (ELeave) NetscapePlugInStreamLoaderClient(); |
42 CleanupStack::PushL( self ); |
42 CleanupStack::PushL( self ); |
43 self->ConstructL( url, pluginskin, frame, notifydata ); |
43 self->ConstructL( url, pluginskin, frame, notifydata, notify ); |
44 CleanupStack::Pop(); |
44 CleanupStack::Pop(); |
45 return self; |
45 return self; |
46 } |
46 } |
47 |
47 |
48 |
48 |
49 NetscapePlugInStreamLoaderClient* NetscapePlugInStreamLoaderClient::NewL(const ResourceRequest& request, PluginSkin* pluginskin, Frame* frame, void* notifydata) |
49 NetscapePlugInStreamLoaderClient* NetscapePlugInStreamLoaderClient::NewL(const ResourceRequest& request, PluginSkin* pluginskin, Frame* frame, void* notifydata, TBool notify/*=EFalse*/) |
50 { |
50 { |
51 NetscapePlugInStreamLoaderClient* self = new (ELeave) NetscapePlugInStreamLoaderClient(); |
51 NetscapePlugInStreamLoaderClient* self = new (ELeave) NetscapePlugInStreamLoaderClient(); |
52 CleanupStack::PushL( self ); |
52 CleanupStack::PushL( self ); |
53 |
53 |
54 self->ConstructL( request, pluginskin, frame, notifydata ); |
54 self->ConstructL( request, pluginskin, frame, notifydata, notify ); |
55 |
55 |
56 CleanupStack::Pop(); |
56 CleanupStack::Pop(); |
57 return self; |
57 return self; |
58 } |
58 } |
59 |
59 |
60 void NetscapePlugInStreamLoaderClient::ConstructL(const String& url, PluginSkin* pluginskin, Frame* frame, void* notifydata) |
60 void NetscapePlugInStreamLoaderClient::ConstructL(const String& url, PluginSkin* pluginskin, Frame* frame, void* notifydata, TBool notify/*=EFalse*/) |
61 { |
61 { |
62 m_loader = 0; |
62 m_loader = 0; |
63 m_request = 0; |
63 m_request = 0; |
64 m_pluginstream = 0; |
64 m_pluginstream = 0; |
65 m_pluginskin = pluginskin; |
65 m_pluginskin = pluginskin; |
66 m_notifydata = notifydata; |
66 m_notifydata = notifydata; |
67 m_frame = frame; |
67 m_frame = frame; |
|
68 m_notify = notify; |
68 m_pluginstream = new (ELeave) PluginStream(pluginskin, this, notifydata); |
69 m_pluginstream = new (ELeave) PluginStream(pluginskin, this, notifydata); |
69 m_request = new (ELeave) ResourceRequest(m_frame->loader()->completeURL(url)); |
70 m_request = new (ELeave) ResourceRequest(m_frame->loader()->completeURL(url)); |
70 |
71 |
71 if ( !m_frame->loader()->canLoad(m_request->url(), frame->document()) ) |
72 if ( !m_frame->loader()->canLoad(m_request->url(), frame->document()) ) |
72 return; |
73 return; |
78 m_loader = NetscapePlugInStreamLoader::create(frame,this); |
79 m_loader = NetscapePlugInStreamLoader::create(frame,this); |
79 if (m_loader) |
80 if (m_loader) |
80 m_loader->setShouldBufferData(false); |
81 m_loader->setShouldBufferData(false); |
81 } |
82 } |
82 |
83 |
83 void NetscapePlugInStreamLoaderClient::ConstructL(const ResourceRequest& request, PluginSkin* pluginskin, Frame* frame, void* notifydata) |
84 void NetscapePlugInStreamLoaderClient::ConstructL(const ResourceRequest& request, PluginSkin* pluginskin, Frame* frame, void* notifydata, TBool notify/*=EFalse*/) |
84 { |
85 { |
85 |
86 |
86 m_loader = 0; |
87 m_loader = 0; |
87 m_request = 0; |
88 m_request = 0; |
88 m_pluginstream = 0; |
89 m_pluginstream = 0; |
89 m_pluginskin = pluginskin; |
90 m_pluginskin = pluginskin; |
90 m_notifydata = notifydata; |
91 m_notifydata = notifydata; |
91 m_frame = frame; |
92 m_frame = frame; |
|
93 m_notify = notify; |
92 m_pluginstream = new (ELeave) PluginStream(pluginskin, this, notifydata); |
94 m_pluginstream = new (ELeave) PluginStream(pluginskin, this, notifydata); |
93 m_request = new (ELeave) ResourceRequest(request.url()); |
95 m_request = new (ELeave) ResourceRequest(request.url()); |
94 |
96 |
95 m_request->setCachePolicy(request.cachePolicy()); |
97 m_request->setCachePolicy(request.cachePolicy()); |
96 m_request->setTimeoutInterval(request.timeoutInterval()); |
98 m_request->setTimeoutInterval(request.timeoutInterval()); |
152 } |
154 } |
153 |
155 |
154 void NetscapePlugInStreamLoaderClient::cancelWithError(const ResourceError& error) |
156 void NetscapePlugInStreamLoaderClient::cancelWithError(const ResourceError& error) |
155 { |
157 { |
156 if (m_loader && !m_loader->isDone()){ |
158 if (m_loader && !m_loader->isDone()){ |
157 if(m_pluginskin && m_pluginskin->getNPPluginFucs()) |
|
158 m_pluginskin->getNPPluginFucs()->urlnotify(m_pluginskin->m_instance, error.failingURL(), NPRES_NETWORK_ERR, m_notifydata); |
|
159 m_loader->cancel(error); |
159 m_loader->cancel(error); |
160 } |
160 } |
161 } |
161 } |
162 |
162 |
163 void NetscapePlugInStreamLoaderClient::didReceiveResponse(const ResourceResponse& response) |
163 void NetscapePlugInStreamLoaderClient::didReceiveResponse(const ResourceResponse& response) |
198 } |
198 } |
199 |
199 |
200 void NetscapePlugInStreamLoaderClient::didFail(const ResourceError& error) |
200 void NetscapePlugInStreamLoaderClient::didFail(const ResourceError& error) |
201 { |
201 { |
202 if (m_pluginstream) { |
202 if (m_pluginstream) { |
203 m_pluginstream->destroyStream(error.errorCode() ? error.errorCode() : KErrCancel); |
203 int err = error.errorCode() ? error.errorCode() : KErrCancel; |
|
204 HBufC* failedURL = HBufC::NewLC(error.failingURL().length()); |
|
205 failedURL->Des().Copy(error.failingURL()); |
|
206 m_pluginstream->destroyStream(err, failedURL); |
|
207 CleanupStack::PopAndDestroy(failedURL); |
204 } |
208 } |
205 } |
209 } |
206 |
210 |
207 void NetscapePlugInStreamLoaderClient::didCancel(const ResourceError& error) |
211 void NetscapePlugInStreamLoaderClient::didCancel(const ResourceError& error) |
208 { |
212 { |
209 if (m_pluginstream) { |
213 if (m_pluginstream) { |
210 m_pluginstream->destroyStream(error.errorCode() ? error.errorCode() : KErrCancel); |
214 int err = error.errorCode() ? error.errorCode() : KErrCancel; |
211 } |
215 HBufC* failedURL = HBufC::NewLC(error.failingURL().length()); |
212 } |
216 failedURL->Des().Copy(error.failingURL()); |
213 |
217 m_pluginstream->destroyStream(err, failedURL); |
214 |
218 CleanupStack::PopAndDestroy(failedURL); |
215 |
219 } |
216 |
220 } |
217 |
221 |
218 |
222 |
|
223 |
|
224 |
|
225 |
|
226 |