15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <f32file.h> |
18 #include <f32file.h> |
19 #include <uri8.h> |
19 #include <uri8.h> |
20 #include <escapeutils.h> |
20 #include <EscapeUtils.h> |
21 #include <apmrec.h> |
21 #include <apmrec.h> |
22 #include <apgcli.h> |
22 #include <apgcli.h> |
23 #include "ResourceHandle.h" |
23 #include "ResourceHandle.h" |
24 #include "FileConnection.h" |
24 #include "FileConnection.h" |
25 #include "FileReader.h" |
25 #include "FileReader.h" |
26 #include "ResourceHandleManagerSymbian.h" |
26 #include "ResourceHandleManagerSymbian.h" |
27 #include "StaticObjectsContainer.h" |
27 #include "StaticObjectsContainer.h" |
28 #include "ResourceRequest.h" |
28 #include "ResourceRequest.h" |
29 #include <BrCtlSpecialLoadObserver.h> |
29 #include <brctlspecialloadobserver.h> |
30 #include "BrCtl.h" |
30 #include "brctl.h" |
31 #include "DeprecatedString.h" |
31 #include "DeprecatedString.h" |
|
32 #include <PluginHandler.h> |
32 |
33 |
33 const TInt KFileReadChunkSize = 23920; // bytes |
34 const TInt KFileReadChunkSize = 23920; // bytes |
34 _LIT8( KResLoaderUCS2, "iso-10646-ucs-2" ); |
35 _LIT8( KResLoaderUCS2, "iso-10646-ucs-2" ); |
35 _LIT8( KResLoaderWapWmlc, "application/vnd.wap.wmlc" ); |
36 _LIT8( KResLoaderWapWmlc, "application/vnd.wap.wmlc" ); |
36 |
37 |
249 contentTypePtr.Set( _L8( "image/vnd.wap.wbmp" ) ); |
250 contentTypePtr.Set( _L8( "image/vnd.wap.wbmp" ) ); |
250 } |
251 } |
251 else if( extPtr.CompareF( KEcmaScriptExt() ) == 0 || |
252 else if( extPtr.CompareF( KEcmaScriptExt() ) == 0 || |
252 extPtr.CompareF( KJavaScriptExt() ) == 0 ) { |
253 extPtr.CompareF( KJavaScriptExt() ) == 0 ) { |
253 contentTypePtr.Set( _L8( "text/ecmascript" ) ); |
254 contentTypePtr.Set( _L8( "text/ecmascript" ) ); |
254 } |
255 } |
255 |
256 else { |
256 // todo plugin is missing |
257 // Symbian/S60 may not be aware of the MIMEType for the given extension |
257 // Check if it is a supported plugin |
258 // Need to query from Plugin handler if there exists a plugin which supports this extension. |
258 // CPluginHandler* pluginHandler = CPluginHandler::GetSingleton(); |
259 return contentTypeFromPluginsL(); |
259 // TUint16* mimeType16 = pluginHandler->GetPluginMimeTypeL(iFileName); |
260 } |
260 } |
261 } |
261 if( contentTypePtr.Length() ) { |
262 if( contentTypePtr.Length() ) { |
262 contentType = HBufC8::NewL( contentTypePtr.Length() ); |
263 contentType = HBufC8::NewL( contentTypePtr.Length() ); |
263 contentType->Des().Copy( contentTypePtr ); |
264 contentType->Des().Copy( contentTypePtr ); |
|
265 } |
|
266 return contentType; |
|
267 } |
|
268 |
|
269 HBufC8* FileConnection::contentTypeFromPluginsL() |
|
270 { |
|
271 HBufC8* contentType = NULL; |
|
272 |
|
273 // Get PluginHandler from StaticObjectsContainer |
|
274 PluginHandler* plg = StaticObjectsContainer::instance()->pluginHandler(); |
|
275 |
|
276 // Convert filename16 to filename8 required for pluginMimeByExtention(TPtrC8&) |
|
277 HBufC8* filename = HBufC8::NewLC(m_fileName->Length()); |
|
278 filename->Des().Copy(m_fileName->Des()); |
|
279 |
|
280 // Query MIMEtype for an extension from PluginHandler |
|
281 HBufC* mimeTypePtr = plg->pluginMimeByExtention(filename->Des()); |
|
282 |
|
283 CleanupStack::PopAndDestroy(); //filename |
|
284 |
|
285 if (mimeTypePtr) { |
|
286 // Coversion from mimeType16 to mimeType8 |
|
287 contentType = HBufC8::NewL(mimeTypePtr->Length()); |
|
288 contentType->Des().Copy(mimeTypePtr->Des()); |
264 } |
289 } |
265 return contentType; |
290 return contentType; |
266 } |
291 } |
267 |
292 |
268 // ----------------------------------------------------------------------------- |
293 // ----------------------------------------------------------------------------- |