menucontentsrv/srvsrc/mcsdrmobservermanager.cpp
branchRCL_3
changeset 78 1b207dd38b72
parent 0 79c6a41cd166
equal deleted inserted replaced
74:edd621764147 78:1b207dd38b72
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include "mcsdrmobservermanager.h"
    19 #include "mcsdrmobservermanager.h"
    68         }
    68         }
    69     }
    69     }
    70 
    70 
    71 // ---------------------------------------------------------------------------
    71 // ---------------------------------------------------------------------------
    72 //
    72 //
    73 // ---------------------------------------------------------------------------    
    73 // ---------------------------------------------------------------------------
    74 void RMcsDrmObserverManager::RemoveMissingObservers( 
    74 void RMcsDrmObserverManager::RemoveMissingObservers(
    75 	const RArray<TUid>& aDrmProtectedArray )
    75 	const RArray<TUid>& aDrmProtectedArray )
    76     {   
    76     {
    77     TInt index = 0;
    77     TInt index = 0;
    78     while (index < iObservers.Count() )
    78     while (index < iObservers.Count() )
    79         {
    79         {
    80         if ( aDrmProtectedArray.Find( iObservers[index]->Uid() ) == KErrNotFound	)
    80         if ( aDrmProtectedArray.Find( iObservers[index]->Uid() ) == KErrNotFound	)
    81             {
    81             {
    83             iObservers.Remove( index );
    83             iObservers.Remove( index );
    84             }
    84             }
    85         else
    85         else
    86             {
    86             {
    87             index++;
    87             index++;
    88             }       
    88             }
    89         }           
    89         }
    90     }
    90     }
    91 
    91 
    92 // ---------------------------------------------------------------------------
    92 // ---------------------------------------------------------------------------
    93 //
    93 //
    94 // ---------------------------------------------------------------------------
    94 // ---------------------------------------------------------------------------
   107     }
   107     }
   108 
   108 
   109 // ---------------------------------------------------------------------------
   109 // ---------------------------------------------------------------------------
   110 //
   110 //
   111 // ---------------------------------------------------------------------------
   111 // ---------------------------------------------------------------------------
   112 void RMcsDrmObserverManager::CreateObserversL( 
   112 void RMcsDrmObserverManager::CreateObserversL(
   113 	const RArray<TUid>& aDrmArray, 
   113         const RArray<TUid>& aDrmArray,
   114 	TDRMEventType aMask,
   114         TDRMEventType aMask,
   115     MMcsDrmObserver& aObserver )
   115         MMcsDrmObserver& aObserver )
   116 	{
   116     {
   117 	for (TInt i = 0; i < aDrmArray.Count(); i++)
   117     for (TInt i = 0; i < aDrmArray.Count(); i++)
   118 		{
   118         {
   119 		if (FindUid(aDrmArray[i]) == KErrNotFound)
   119         if (FindUid(aDrmArray[i]) == KErrNotFound)
   120 			{
   120             {
   121 			TApaAppInfo info;
   121             CMcsDrmObserver* observer= NULL;
   122 			iUtils.GetApaAppInfo(aDrmArray[i], info);
   122             if ( iUtils.IsMiddlet( aDrmArray[i] ) )
       
   123                 {
       
   124                 TBuf<KMaxFileName> contentId;
       
   125                 iUtils.GetJavaContentIdL( aDrmArray[i], contentId );
   123 
   126 
   124 			CMcsDrmObserver* observer= NULL;
   127                 observer = CMcsDrmObserver::NewL(aObserver, contentId,
   125 			if (CMenuSrvEngUtils::IsMiddlet(info) )
   128                                     aDrmArray[i], aMask);
   126 				{
   129 
   127 				TBuf<KMaxFileName> contentId;
   130                 TInt err = iObservers.Append(observer);
   128 				CMenuSrvEngUtils::GetJavaContentIdL(info.iUid, contentId);
   131                 if( err != KErrNone)
   129 				
   132                     {
   130 				observer = CMcsDrmObserver::NewL(aObserver, contentId,
   133                     delete observer;
   131 										aDrmArray[i], aMask);
   134                     User::Leave( err );
   132 				
   135                     }
   133 				TInt err = iObservers.Append(observer);
   136                 }
   134 				if( err != KErrNone)
   137             }
   135 					{
   138         }
   136 					delete observer;
   139     }
   137 					User::Leave( err );
       
   138 					}
       
   139 				}
       
   140 			}
       
   141 		}
       
   142 	}
       
   143 
   140 
   144 // ---------------------------------------------------------------------------
   141 // ---------------------------------------------------------------------------
   145 //
   142 //
   146 // ---------------------------------------------------------------------------
   143 // ---------------------------------------------------------------------------
   147 void RMcsDrmObserverManager::CreateObserversL( 
   144 void RMcsDrmObserverManager::CreateObserversL(
   148 	const RArray<TUid>& aDrmProtectedArray, 
   145 	const RArray<TUid>& aDrmProtectedArray,
   149     MMcsDrmObserver& aObserver )
   146     MMcsDrmObserver& aObserver )
   150     {
   147     {
   151     CreateObserversL(aDrmProtectedArray, KEventModify,
   148     CreateObserversL(aDrmProtectedArray, KEventModify,
   152 			aObserver);
   149 			aObserver);
   153 	}
   150 	}
   154 
   151 
   155 // ---------------------------------------------------------------------------
   152 // ---------------------------------------------------------------------------
   156 //
   153 //
   157 // ---------------------------------------------------------------------------
   154 // ---------------------------------------------------------------------------
   158 void RMcsDrmObserverManager::RefreshObserverL( 
   155 void RMcsDrmObserverManager::RefreshObserverL(
   159 		const RArray<TUid>& aDrmProtectedArray, 
   156 		const RArray<TUid>& aDrmProtectedArray,
   160 		TUid aUid, 
   157 		TUid aUid,
   161 		MMcsDrmObserver& aObserver )
   158 		MMcsDrmObserver& aObserver )
   162     {
   159     {
   163     TInt index = FindUid( aUid );
   160     TInt index = FindUid( aUid );
   164     if ( index != KErrNotFound )
   161     if ( index != KErrNotFound )
   165     	{
   162     	{