browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadUtils.cpp
branchRCL_3
changeset 93 79859ed3eea9
parent 70 8bfb9186a8b8
child 94 919f36ff910f
equal deleted inserted replaced
92:e1bea15f9a39 93:79859ed3eea9
    18 
    18 
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include    "CDownloadUtils.h" 
    21 #include    "CDownloadUtils.h" 
    22 #include    "UiLibLogger.h"
    22 #include    "UiLibLogger.h"
    23 #include    <downloadmgrclient.h>
    23 #include    <DownloadMgrClient.h>
    24 #include    <DocumentHandler.h>
    24 #include    <DocumentHandler.h>
    25 #include    <Oma2Agent.h>
    25 #include    <Oma2Agent.h>
    26 #include    <DRMCommon.h>
    26 #include    <DRMCommon.h>
    27 #include	<apgcli.h>
    27 #include	<apgcli.h>
    28 #include    <caf/caf.h>
    28 #include    <caf/caf.h>
    29 #include    <utf.h>
    29 #include    <utf.h>
    30 #include    <Browser_Platform_Variant.hrh>
    30 #include    <Browser_platform_variant.hrh>
    31 // LOCAL CONSTANTS AND MACROS
    31 // LOCAL CONSTANTS AND MACROS
    32 
    32 
    33 #ifdef BRDO_WML_DISABLED_FF
    33 #ifdef BRDO_WML_DISABLED_FF
    34 _LIT8( KWmlType1, "text/vnd.wap.wml");
    34 _LIT8( KWmlType1, "text/vnd.wap.wml");
    35 _LIT8( KWmlType2, "text/vnd.wap.wmlc");
    35 _LIT8( KWmlType2, "text/vnd.wap.wmlc");
    44 _LIT8(KFlash, "application/x-shockwave-flash");
    44 _LIT8(KFlash, "application/x-shockwave-flash");
    45 _LIT8(Ksdp, "application/sdp");
    45 _LIT8(Ksdp, "application/sdp");
    46 _LIT8(Krng, "application/vnd.nokia.ringing-tone");
    46 _LIT8(Krng, "application/vnd.nokia.ringing-tone");
    47 _LIT8(Krn, "application/vnd.rn-realmedia");
    47 _LIT8(Krn, "application/vnd.rn-realmedia");
    48 _LIT8(Kpn, "application/x-pn-realmedia");
    48 _LIT8(Kpn, "application/x-pn-realmedia");
    49 _LIT8(KWmdrmLicenseResponseContentType,"application/vnd.ms-wmdrm.lic-resp" );
       
    50 
    49 
    51 // ============================ MEMBER FUNCTIONS ===============================
    50 // ============================ MEMBER FUNCTIONS ===============================
    52 
    51 
    53 // -----------------------------------------------------------------------------
    52 // -----------------------------------------------------------------------------
    54 // CDownloadUtils::CDownloadUtils
    53 // CDownloadUtils::CDownloadUtils
   235         CDocumentHandler* docHandler = CDocumentHandler::NewLC();
   234         CDocumentHandler* docHandler = CDocumentHandler::NewLC();
   236         TRAPD( err, canOpen = docHandler->CanOpenL( TDataType( aContentType ) ) );
   235         TRAPD( err, canOpen = docHandler->CanOpenL( TDataType( aContentType ) ) );
   237         CleanupStack::PopAndDestroy( docHandler ); // docHandler
   236         CleanupStack::PopAndDestroy( docHandler ); // docHandler
   238 
   237 
   239         if ( !(aContentType.Compare(KOma2RoContentType)) || !(aContentType.Compare(KOma2ProtectedRoType))
   238         if ( !(aContentType.Compare(KOma2RoContentType)) || !(aContentType.Compare(KOma2ProtectedRoType))
   240             || !(aContentType.Compare(KOma2TriggerContentType)) || !(aContentType.Compare(KWmdrmLicenseResponseContentType)) )
   239             || !(aContentType.Compare(KOma2TriggerContentType)) )
   241             {
   240             {
   242             canOpen = EFalse;
   241             canOpen = EFalse;
   243             }
   242             }
   244             
   243             
   245         if ( err != KErrNone ) 
   244         if ( err != KErrNone ) 
   272            || !aContentType.Compare(KWmlType3()) || !aContentType.Compare(KWmlType4()) )
   271            || !aContentType.Compare(KWmlType3()) || !aContentType.Compare(KWmlType4()) )
   273         {
   272         {
   274     	return EFalse; 
   273     	return EFalse; 
   275         }
   274         }
   276 #endif         
   275 #endif         
   277     else if ( !(aContentType.Compare(KOma2RoContentType)) || !(aContentType.Compare(KOma2ProtectedRoType))
       
   278         || !(aContentType.Compare(KOma2TriggerContentType)) || !(aContentType.Compare(KWmdrmLicenseResponseContentType)) )
       
   279         {
       
   280         return EFalse;
       
   281         }
       
   282     else
   276     else
   283         {
   277         {
   284         TBool canOpen( EFalse );
   278         TBool canOpen( EFalse );
   285         CDocumentHandler* docHandler = CDocumentHandler::NewLC();
   279         CDocumentHandler* docHandler = CDocumentHandler::NewLC();
   286         TRAPD( err, canOpen = docHandler->CanOpenL( TDataType( aContentType ) ) );
   280         TRAPD( err, canOpen = docHandler->CanOpenL( TDataType( aContentType ) ) );
   477 
   471 
   478 	  CleanupStack::PopAndDestroy(3); //fs, fileName, buffer
   472 	  CleanupStack::PopAndDestroy(3); //fs, fileName, buffer
   479     
   473     
   480     if (ret == KErrNone &&
   474     if (ret == KErrNone &&
   481         (dataType.iConfidence == CApaDataRecognizerType::ECertain) ||
   475         (dataType.iConfidence == CApaDataRecognizerType::ECertain) ||
   482         (dataType.iConfidence == CApaDataRecognizerType::EProbable) ||(dataType.iConfidence == CApaDataRecognizerType::EPossible))
   476         (dataType.iConfidence == CApaDataRecognizerType::EProbable))
   483         {
   477         {
   484         // If the file type was found, try to match it to a known file type
   478         // If the file type was found, try to match it to a known file type
   485         TPtrC8 mimeTypePtr = dataType.iDataType.Des8();
   479         TPtrC8 mimeTypePtr = dataType.iDataType.Des8();
   486         TInt len = mimeTypePtr.Length() + 1;
   480         TInt len = mimeTypePtr.Length() + 1;
   487         aContentTypeString = new(ELeave) TUint8 [len];
   481         aContentTypeString = new(ELeave) TUint8 [len];