commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp
changeset 23 493788a4a8a4
parent 2 76350b5be3d8
child 29 3bdc3b853094
equal deleted inserted replaced
5:79d62d1d7957 23:493788a4a8a4
     1 /*
     1 /*
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 
    20 
    21 // launching embedded details view
    21 // launching embedded details view
    22 #include <aknlaunchappservice.h>
    22 #include <AknLaunchAppService.h>
    23 #include <aiwgenericparam.h>
    23 #include <AiwGenericParam.h>
    24 #include <apgcli.h>
    24 #include <apgcli.h>
    25 #include <apgtask.h>
    25 #include <apgtask.h>
    26 #include <w32std.h>
    26 #include <w32std.h>
    27 
    27 
    28 // character conversions
    28 // character conversions
    36 #include <cmconnectionmethod.h>
    36 #include <cmconnectionmethod.h>
    37 #include <cmdestination.h>
    37 #include <cmdestination.h>
    38 #include <cmconnectionmethoddef.h>
    38 #include <cmconnectionmethoddef.h>
    39 #include <cmmanager.h>
    39 #include <cmmanager.h>
    40 #ifdef __SERIES60_NATIVE_BROWSER
    40 #ifdef __SERIES60_NATIVE_BROWSER
    41 #include <browseruisdkcrkeys.h>
    41 #include <BrowserUiSDKCRKeys.h>
    42 #endif
    42 #endif
    43 
    43 
    44 #include    <wmdrmagent.h> // for WMDRM file details view
    44 #include    <wmdrmagent.h> // for WMDRM file details view
    45 #include    <drmutilitytypes.h>
    45 #include    <drmutilitytypes.h>
    46 #include    <drmuicheckrightsobserver.h>
    46 #include    <drmuicheckrightsobserver.h>
    50 
    50 
    51 #include    "drmutilitywmdrmwrapper.h"
    51 #include    "drmutilitywmdrmwrapper.h"
    52 #include    "drmutilityui.h"
    52 #include    "drmutilityui.h"
    53 
    53 
    54 #include    "drmagents.h"
    54 #include    "drmagents.h"
    55 #include    "drmclockclient.h"
    55 #include    "DRMClockClient.h"
    56 
    56 
    57 #include    "drmutilityinternaltypes.h"
    57 #include    "drmutilityinternaltypes.h"
    58 #include    "drmutilitywmdrmutilities.h"
    58 #include    "drmutilitywmdrmutilities.h"
    59 
    59 
    60 #include    "wmdrmdlawrapper.h"
    60 #include    "wmdrmdlawrapper.h"
   381 
   381 
   382                 // the rights are valid:
   382                 // the rights are valid:
   383                 // Check the duration, counts and whether the rights
   383                 // Check the duration, counts and whether the rights
   384                 // are unlimited or not
   384                 // are unlimited or not
   385                 case ContentAccess::ERightsStatusValid:
   385                 case ContentAccess::ERightsStatusValid:
   386                     DrmUtilityWmDrmUtilities::CheckWmDrmRightsL( 
   386                     DrmUtilityWmDrmUtilities::CheckWmDrmRightsL(
   387                         aUnconstrained, aTime, aCounts, *aArray[0] );
   387                         aUnconstrained, aTime, aCounts, *aArray[0] );
   388                     break;
   388                     break;
   389                 }
   389                 }
   390             }
   390             }
   391         }
   391         }
   670     __ASSERT_DEBUG( !aLaunchParam && aUrl,
   670     __ASSERT_DEBUG( !aLaunchParam && aUrl,
   671                     User::Panic( KWmDrmWrapperDebugPanicMessage,
   671                     User::Panic( KWmDrmWrapperDebugPanicMessage,
   672                                  KWmDrmWrapperDebugPanicCode ) );
   672                                  KWmDrmWrapperDebugPanicCode ) );
   673 
   673 
   674     _LIT( KZero, "0" );
   674     _LIT( KZero, "0" );
   675     _LIT( KSpace, " " );
   675     _LIT( KMarker, "\x00" );
   676 
   676 
   677     TPtr ptr( NULL, 0 );
   677     TPtr ptr( NULL, 0 );
   678 
   678 
   679     // length of startparam and drm protection type indicator and zero local id
   679     // length of startparam and drm protection type indicator and zero local id
   680     // are always 1 and total of 3 spaces are needed
   680     // are always 1 and total of 4 markers are needed
   681     TInt length( 1 + aUrl->Length() + 1 + 3 + 1 );
   681     TInt length( 1 + aUrl->Length() + 1 + 4 + 1 );
   682 
   682 
   683     aLaunchParam = HBufC::NewLC( length );
   683     aLaunchParam = HBufC::NewLC( length );
   684     ptr.Set( aLaunchParam->Des() );
   684     ptr.Set( aLaunchParam->Des() );
   685 
   685 
   686     // Start parameter is 3 or 4 for launching details view embedded or standalone from
   686     // Start parameter is 3 or 4 for launching details view embedded or standalone from
   692         }
   692         }
   693     else
   693     else
   694         {
   694         {
   695         ptr.AppendNum( EDrmLaunchParamStandAloneUtility );
   695         ptr.AppendNum( EDrmLaunchParamStandAloneUtility );
   696         }
   696         }
   697     ptr.Append( KSpace );
   697     ptr.Append( KMarker );
   698     // Default value 0 for localId in case of WM DRM file
   698     // Default value 0 for localId in case of WM DRM file
   699     ptr.Append( KZero );
   699     ptr.Append( KZero );
   700     ptr.Append( KSpace );
   700     ptr.Append( KMarker );
   701     ptr.Append( *aUrl );
   701     ptr.Append( *aUrl );
   702     ptr.Append( KSpace );
   702     ptr.Append( KMarker );
   703     // WM DRM protection scheme
   703     // WM DRM protection scheme
   704     ptr.AppendNum( EDrmSchemeWmDrm );
   704     ptr.AppendNum( EDrmSchemeWmDrm );
       
   705     ptr.Append( KMarker );
   705 
   706 
   706     CleanupStack::Pop( aLaunchParam );
   707     CleanupStack::Pop( aLaunchParam );
   707     }
   708     }
   708 
   709 
   709 // -----------------------------------------------------------------------------
   710 // -----------------------------------------------------------------------------
   733 
   734 
   734 // -----------------------------------------------------------------------------
   735 // -----------------------------------------------------------------------------
   735 // CDrmUtilityWMDrmWrapper::GetRFileFromCDataL
   736 // CDrmUtilityWMDrmWrapper::GetRFileFromCDataL
   736 // -----------------------------------------------------------------------------
   737 // -----------------------------------------------------------------------------
   737 //
   738 //
   738 void DRM::CDrmUtilityWMDrmWrapper::GetRFileFromCDataL( 
   739 void DRM::CDrmUtilityWMDrmWrapper::GetRFileFromCDataL(
   739     ContentAccess::CData& aContent,
   740     ContentAccess::CData& aContent,
   740     RFile& aFile )
   741     RFile& aFile )
   741     {
   742     {
   742     TFileName fileName;
   743     TFileName fileName;
   743     User::LeaveIfError( aContent.GetStringAttribute( DRM::EDrmFullName, fileName ) );
   744     User::LeaveIfError( aContent.GetStringAttribute( DRM::EDrmFullName, fileName ) );
   746 
   747 
   747 // -----------------------------------------------------------------------------
   748 // -----------------------------------------------------------------------------
   748 // CDrmUtilityWMDrmWrapper::IsDlaLicenseAcquisitionSilentL
   749 // CDrmUtilityWMDrmWrapper::IsDlaLicenseAcquisitionSilentL
   749 // -----------------------------------------------------------------------------
   750 // -----------------------------------------------------------------------------
   750 //
   751 //
   751 TBool DRM::CDrmUtilityWMDrmWrapper::IsDlaLicenseAcquisitionSilentL( 
   752 TBool DRM::CDrmUtilityWMDrmWrapper::IsDlaLicenseAcquisitionSilentL(
   752     RFile& aFile  )
   753     RFile& aFile  )
   753     {
   754     {
   754     LoadDlaWrapperL();
   755     LoadDlaWrapperL();
   755     return iDlaWrapper->SilentL( aFile );
   756     return iDlaWrapper->SilentL( aFile );
   756     }
   757     }
   757 
   758 
   758 // -----------------------------------------------------------------------------
   759 // -----------------------------------------------------------------------------
   759 // CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL
   760 // CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL
   760 // -----------------------------------------------------------------------------
   761 // -----------------------------------------------------------------------------
   761 //
   762 //
   762 void DRM::CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL( 
   763 void DRM::CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL(
   763     RFile& aFile )
   764     RFile& aFile )
   764     {
   765     {
   765     TInt iapId( 0 );
   766     TInt iapId( 0 );
   766     HBufC* contentUrl( NULL );
   767     HBufC* contentUrl( NULL );
   767     HBufC* htmlData( NULL );
   768     HBufC* htmlData( NULL );
   807     CleanupStack::PushL( repository );
   808     CleanupStack::PushL( repository );
   808     repository->Get( KBrowserDefaultAccessPoint, ap );
   809     repository->Get( KBrowserDefaultAccessPoint, ap );
   809     repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk );
   810     repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk );
   810     repository->Get( KBrowserNGDefaultSnapId, defaultSnap );
   811     repository->Get( KBrowserNGDefaultSnapId, defaultSnap );
   811     CleanupStack::PopAndDestroy( repository );
   812     CleanupStack::PopAndDestroy( repository );
   812     
   813 
   813     if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound )
   814     if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound )
   814         {
   815         {
   815         alwaysAsk = ETrue;
   816         alwaysAsk = ETrue;
   816         }
   817         }
   817     else
   818     else
   818         {
   819         {
   819         RCmManager cmManager;
   820         RCmManager cmManager;
   820         cmManager.OpenLC();
   821         cmManager.OpenLC();
   821         if ( !alwaysAsk )
   822         if ( !alwaysAsk )
   822             {
   823             {
   823             iapd32 = 
   824             iapd32 =
   824                 cmManager.GetConnectionMethodInfoIntL( ap, 
   825                 cmManager.GetConnectionMethodInfoIntL( ap,
   825                                                        CMManager::ECmIapId );
   826                                                        CMManager::ECmIapId );
   826             }
   827             }
   827         else if ( alwaysAsk == KDestinationSelectionMode )
   828         else if ( alwaysAsk == KDestinationSelectionMode )
   828             {
   829             {
   829             RCmDestination dest( cmManager.DestinationL( defaultSnap ) );
   830             RCmDestination dest( cmManager.DestinationL( defaultSnap ) );