webengine/osswebengine/WebCore/platform/network/symbian/FileConnection.cpp
branchRCL_3
changeset 93 79859ed3eea9
parent 38 6297cdf66332
child 94 919f36ff910f
equal deleted inserted replaced
92:e1bea15f9a39 93:79859ed3eea9
    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>
       
    33 
    32 
    34 const TInt KFileReadChunkSize = 23920; // bytes
    33 const TInt KFileReadChunkSize = 23920; // bytes
    35 _LIT8( KResLoaderUCS2, "iso-10646-ucs-2" );
    34 _LIT8( KResLoaderUCS2, "iso-10646-ucs-2" );
    36 _LIT8( KResLoaderWapWmlc, "application/vnd.wap.wmlc" );
    35 _LIT8( KResLoaderWapWmlc, "application/vnd.wap.wmlc" );
    37 
    36 
   250             contentTypePtr.Set( _L8( "image/vnd.wap.wbmp" ) );
   249             contentTypePtr.Set( _L8( "image/vnd.wap.wbmp" ) );
   251         }
   250         }
   252         else if( extPtr.CompareF( KEcmaScriptExt() ) == 0 ||
   251         else if( extPtr.CompareF( KEcmaScriptExt() ) == 0 ||
   253             extPtr.CompareF( KJavaScriptExt() ) == 0 ) {
   252             extPtr.CompareF( KJavaScriptExt() ) == 0 ) {
   254             contentTypePtr.Set( _L8( "text/ecmascript" ) );
   253             contentTypePtr.Set( _L8( "text/ecmascript" ) );
   255         }        
   254         }
   256         else {
   255 
   257             // Symbian/S60 may not be aware of the MIMEType for the given extension
   256         // todo plugin is missing
   258             // Need to query from Plugin handler if there exists a plugin which supports this extension.
   257         // Check if it is a supported plugin
   259             return contentTypeFromPluginsL();
   258         // CPluginHandler* pluginHandler = CPluginHandler::GetSingleton();
   260         }
   259         // TUint16* mimeType16 = pluginHandler->GetPluginMimeTypeL(iFileName);
   261     }
   260     }
   262     if( contentTypePtr.Length() ) {
   261     if( contentTypePtr.Length() ) {
   263         contentType = HBufC8::NewL( contentTypePtr.Length() );
   262         contentType = HBufC8::NewL( contentTypePtr.Length() );
   264         contentType->Des().Copy( contentTypePtr );
   263         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());
       
   289     }
   264     }
   290     return contentType;
   265     return contentType;
   291 }
   266 }
   292 
   267 
   293 // -----------------------------------------------------------------------------
   268 // -----------------------------------------------------------------------------