commondrm/drmutility/src/DrmUiHandlingImpl.cpp
branchRCL_3
changeset 10 89a1f2bd800d
parent 2 76350b5be3d8
child 12 8a03a285ab14
equal deleted inserted replaced
5:79d62d1d7957 10:89a1f2bd800d
     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".
  3824     const HBufC* aFullPath )
  3824     const HBufC* aFullPath )
  3825     {
  3825     {
  3826     __ASSERT_DEBUG( !aLaunchParam && aUrl && aFullPath,
  3826     __ASSERT_DEBUG( !aLaunchParam && aUrl && aFullPath,
  3827         User::Panic( KDRMUtilityDebugPanicMessage,
  3827         User::Panic( KDRMUtilityDebugPanicMessage,
  3828             KDRMUtilityDebugPanicCode ) );
  3828             KDRMUtilityDebugPanicCode ) );
  3829     _LIT( KSpace, " " );
  3829     _LIT( KMarker, "\x00" );
  3830 
  3830 
  3831     RPointerArray<CDRMPermission> uriList;
  3831     RPointerArray<CDRMPermission> uriList;
  3832     TPtr ptr( NULL, 0 );
  3832     TPtr ptr( NULL, 0 );
  3833 
  3833 
  3834     TInt localId( 0 );
  3834     TInt localId( 0 );
  3848     HBufC* localIDBuf( HBufC::NewLC( KIntegerMaxLen ) );
  3848     HBufC* localIDBuf( HBufC::NewLC( KIntegerMaxLen ) );
  3849     ptr.Set( localIDBuf->Des() );
  3849     ptr.Set( localIDBuf->Des() );
  3850     ptr.AppendNum( localId );
  3850     ptr.AppendNum( localId );
  3851 
  3851 
  3852     // length of startparam and drm protection scheme are always 1 and
  3852     // length of startparam and drm protection scheme are always 1 and
  3853     // 4 spaces are needed
  3853     // 5 markers are needed
  3854     const TInt KSpacesBetweenParams( 4 );
  3854     const TInt KMarkersForParams( 5 );
  3855     TInt length( 1 + aUrl->Length() + ptr.Length() + aFullPath->Length()
  3855     TInt length( 1 + aUrl->Length() + ptr.Length() + aFullPath->Length()
  3856         + KSpacesBetweenParams + 1 );
  3856         + KMarkersForParams + 1 );
  3857 
  3857 
  3858     aLaunchParam = HBufC::NewLC( length );
  3858     aLaunchParam = HBufC::NewLC( length );
  3859     ptr.Set( aLaunchParam->Des() );
  3859     ptr.Set( aLaunchParam->Des() );
  3860 
  3860 
  3861     // Start parameter is 3 or 4 for launching details view embedded or standalone from
  3861     // Start parameter is 3 or 4 for launching details view embedded or standalone from
  3867         }
  3867         }
  3868     else
  3868     else
  3869         {
  3869         {
  3870         ptr.AppendNum( EDrmLaunchParamStandAloneUtility );
  3870         ptr.AppendNum( EDrmLaunchParamStandAloneUtility );
  3871         }
  3871         }
  3872     ptr.Append( KSpace );
  3872     ptr.Append( KMarker );
  3873     ptr.Append( *localIDBuf );
  3873     ptr.Append( *localIDBuf );
  3874     ptr.Append( KSpace );
  3874     ptr.Append( KMarker );
  3875 
  3875 
  3876     HBufC* contentUrl( CnvUtfConverter::ConvertToUnicodeFromUtf8L( *aUrl ) );
  3876     HBufC* contentUrl( CnvUtfConverter::ConvertToUnicodeFromUtf8L( *aUrl ) );
  3877 
  3877 
  3878     ptr.Append( *contentUrl );
  3878     ptr.Append( *contentUrl );
  3879     ptr.Append( KSpace );
  3879     ptr.Append( KMarker );
  3880 
  3880 
  3881     // OMA DRM protection scheme
  3881     // OMA DRM protection scheme
  3882     ptr.AppendNum( EDrmSchemeOmaDrm );
  3882     ptr.AppendNum( EDrmSchemeOmaDrm );
  3883     ptr.Append( KSpace );
  3883     ptr.Append( KMarker );
  3884 
  3884 
  3885     ptr.Append( *aFullPath );
  3885     ptr.Append( *aFullPath );
       
  3886     ptr.Append( KMarker );
  3886 
  3887 
  3887     delete contentUrl;
  3888     delete contentUrl;
  3888 
  3889 
  3889     CleanupStack::Pop( aLaunchParam );
  3890     CleanupStack::Pop( aLaunchParam );
  3890     CleanupStack::PopAndDestroy( localIDBuf );
  3891     CleanupStack::PopAndDestroy( localIDBuf );
  3900     {
  3901     {
  3901     __ASSERT_DEBUG( !aLaunchParam && aUrl,
  3902     __ASSERT_DEBUG( !aLaunchParam && aUrl,
  3902         User::Panic( KDRMUtilityDebugPanicMessage,
  3903         User::Panic( KDRMUtilityDebugPanicMessage,
  3903             KDRMUtilityDebugPanicCode ) );
  3904             KDRMUtilityDebugPanicCode ) );
  3904     _LIT( KZero, "0" );
  3905     _LIT( KZero, "0" );
  3905     _LIT( KSpace, " " );
  3906     _LIT( KMarker, "\x00" );
  3906 
  3907 
  3907     TPtr ptr( NULL, 0 );
  3908     TPtr ptr( NULL, 0 );
  3908 
  3909 
  3909     // Length of startparam and drm protection scheme and zero local id
  3910     // Length of startparam and drm protection scheme and zero local id
  3910     // are always 1 and total of 3 spaces are needed
  3911     // are always 1 and total of 4 markers are needed
  3911     TInt length( 1 + aUrl->Length() + 1 + 3 + 1 );
  3912     TInt length( 1 + aUrl->Length() + 1 + 4 + 1 );
  3912 
  3913 
  3913     aLaunchParam = HBufC::NewLC( length );
  3914     aLaunchParam = HBufC::NewLC( length );
  3914     ptr.Set( aLaunchParam->Des() );
  3915     ptr.Set( aLaunchParam->Des() );
  3915 
  3916 
  3916     // Start parameter is 3 or 4 for launching details view embedded or standalone from
  3917     // Start parameter is 3 or 4 for launching details view embedded or standalone from
  3922         }
  3923         }
  3923     else
  3924     else
  3924         {
  3925         {
  3925         ptr.AppendNum( EDrmLaunchParamStandAloneUtility );
  3926         ptr.AppendNum( EDrmLaunchParamStandAloneUtility );
  3926         }
  3927         }
  3927     ptr.Append( KSpace );
  3928     ptr.Append( KMarker );
  3928     // Default value 0 for localId in case of WM DRM file
  3929     // Default value 0 for localId in case of WM DRM file
  3929     ptr.Append( KZero );
  3930     ptr.Append( KZero );
  3930     ptr.Append( KSpace );
  3931     ptr.Append( KMarker );
  3931     ptr.Append( *aUrl );
  3932     ptr.Append( *aUrl );
  3932     ptr.Append( KSpace );
  3933     ptr.Append( KMarker );
  3933     // WM DRM protection scheme
  3934     // WM DRM protection scheme
  3934     ptr.AppendNum( EDrmSchemeWmDrm );
  3935     ptr.AppendNum( EDrmSchemeWmDrm );
       
  3936     ptr.Append( KMarker );
  3935 
  3937 
  3936     CleanupStack::Pop( aLaunchParam );
  3938     CleanupStack::Pop( aLaunchParam );
  3937     }
  3939     }
  3938 
  3940 
  3939 // -----------------------------------------------------------------------------
  3941 // -----------------------------------------------------------------------------