contentmgmt/contentaccessfwfordrm/source/f32agent/f32agentdata.cpp
branchRCL_3
changeset 62 a71299154b21
parent 61 641f389e9157
equal deleted inserted replaced
61:641f389e9157 62:a71299154b21
    41 	self->ConstructL(aFile, aUniqueId);
    41 	self->ConstructL(aFile, aUniqueId);
    42 	CleanupStack::Pop(self);
    42 	CleanupStack::Pop(self);
    43 	return self;
    43 	return self;
    44 	}
    44 	}
    45 
    45 
    46 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
    47 
       
    48 CF32AgentData* CF32AgentData::NewL(const TDesC8& aHeaderData)
       
    49 	{
       
    50 	CF32AgentData* self = new (ELeave) CF32AgentData;
       
    51 	CleanupStack::PushL(self);
       
    52 	self->ConstructL(aHeaderData);
       
    53 	CleanupStack::Pop(self);
       
    54 	return self;
       
    55 	}
       
    56 	
       
    57 void CF32AgentData::ConstructL(const TDesC8& aHeaderData)
       
    58 	{
       
    59 	if(aHeaderData.Length() > 0)
       
    60 		iHeaderData = aHeaderData.AllocL();
       
    61 	else
       
    62 		User::Leave(KErrMissingWmdrmHeaderData);
       
    63 	}
       
    64 	
       
    65 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
    66 
    46 
    67 CF32AgentData::CF32AgentData()
    47 CF32AgentData::CF32AgentData()
    68 	{
    48 	{
    69 	}
    49 	}
    70 
    50 
    77 		iFs.Close();
    57 		iFs.Close();
    78 		}
    58 		}
    79 
    59 
    80 	delete iVirtualPath;
    60 	delete iVirtualPath;
    81 	
    61 	
    82 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
    83 	delete iHeaderData;			
       
    84 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
    85 	}
    62 	}
    86   
    63   
    87 void CF32AgentData::ConstructL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
    64 void CF32AgentData::ConstructL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
    88 	{
    65 	{
    89 	iVirtualPath = CVirtualPath::NewL(aVirtualPath);
    66 	iVirtualPath = CVirtualPath::NewL(aVirtualPath);
   232 		}
   209 		}
   233 	}
   210 	}
   234 
   211 
   235 TInt CF32AgentData::GetAttribute(TInt aAttribute, TInt& aValue)
   212 TInt CF32AgentData::GetAttribute(TInt aAttribute, TInt& aValue)
   236 	{
   213 	{
   237 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   214 	if(iVirtualPath)
   238 	if(iHeaderData)
       
   239 		{
       
   240 		return TF32DefaultAttributes::GetAttribute(*iHeaderData, aAttribute, aValue);
       
   241 		}
       
   242 		
       
   243 	else if(iVirtualPath)
       
   244 		{
   215 		{
   245 		return TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iVirtualPath->URI());
   216 		return TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iVirtualPath->URI());
   246 		}
   217 		}
   247 		
       
   248 	else
   218 	else
   249 		{
   219 		{
   250 		return TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iFile);
   220 		return TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iFile);
   251 		}
   221 		}
   252 #else
       
   253 	if(iVirtualPath)
       
   254 		{
       
   255 		return TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iVirtualPath->URI());
       
   256 		}
       
   257 	else
       
   258 		{
       
   259 		return TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iFile);
       
   260 		}
       
   261 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   262 	}
   222 	}
   263 
   223 
   264 TInt CF32AgentData::GetAttributeSet(RAttributeSet& aAttributeSet)
   224 TInt CF32AgentData::GetAttributeSet(RAttributeSet& aAttributeSet)
   265 	{
   225 	{
   266 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   267 	if(iHeaderData)
       
   268 		{
       
   269 		return TF32DefaultAttributes::GetAttributeSet(*iHeaderData, aAttributeSet);
       
   270 		}
       
   271 		
       
   272 	else if(iVirtualPath)
       
   273 		{
       
   274 		return TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iVirtualPath->URI());
       
   275 		}
       
   276 			
       
   277 	else
       
   278 		{
       
   279 		return TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iFile);
       
   280 		}
       
   281 #else
       
   282 	if(iVirtualPath)
   226 	if(iVirtualPath)
   283 		{
   227 		{
   284 		return TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iVirtualPath->URI());
   228 		return TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iVirtualPath->URI());
   285 		}	
   229 		}	
   286 	else
   230 	else
   287 		{
   231 		{
   288 		return TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iFile);
   232 		return TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iFile);
   289 		}	
   233 		}	
   290 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT		
       
   291 	}
   234 	}
   292 
   235 
   293 TInt CF32AgentData::GetStringAttribute(TInt aAttribute, TDes& aValue)
   236 TInt CF32AgentData::GetStringAttribute(TInt aAttribute, TDes& aValue)
   294 	{
   237 	{
   295 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   238 	if(iVirtualPath)
   296 	if(iHeaderData)
       
   297 		{
       
   298 		return TF32DefaultAttributes::GetStringAttribute(*iHeaderData, aAttribute, aValue);
       
   299 		}
       
   300 	
       
   301 	else if(iVirtualPath)
       
   302 		{
   239 		{
   303 		return TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iVirtualPath->URI());
   240 		return TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iVirtualPath->URI());
   304 		}
   241 		}
   305 	else
   242 	else
   306 		{
   243 		{
   307 		return TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iFile);
   244 		return TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iFile);
   308 		}
   245 		}
   309 #else
       
   310 	if(iVirtualPath)
       
   311 		{
       
   312 		return TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iVirtualPath->URI());
       
   313 		}
       
   314 	else
       
   315 		{
       
   316 		return TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iFile);
       
   317 		}
       
   318 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT	
       
   319 	}
   246 	}
   320 
   247 
   321 TInt CF32AgentData::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet)
   248 TInt CF32AgentData::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet)
   322 	{
   249 	{
   323 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   250 	if(iVirtualPath)
   324 	if(iHeaderData)
       
   325 		{
       
   326 		return TF32DefaultAttributes::GetStringAttributeSet(*iHeaderData, aStringAttributeSet);
       
   327 		}
       
   328 		
       
   329 	else if(iVirtualPath)
       
   330 		{
   251 		{
   331 		return TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iVirtualPath->URI());
   252 		return TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iVirtualPath->URI());
   332 		}
   253 		}
   333 	else
   254 	else
   334 		{
   255 		{
   335 		return TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iFile);
   256 		return TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iFile);
   336 		}
   257 		}
   337 #else
       
   338 	if(iVirtualPath)
       
   339 		{
       
   340 		return TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iVirtualPath->URI());
       
   341 		}
       
   342 	else
       
   343 		{
       
   344 		return TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iFile);
       
   345 		}
       
   346 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   347 	}
   258 	}
   348 
   259 
   349 CF32AgentUi& CF32AgentData::AgentUiL()
   260 CF32AgentUi& CF32AgentData::AgentUiL()
   350 	{
   261 	{
   351 	if(!iAgentUi)
   262 	if(!iAgentUi)
   354 		iAgentUi = TF32AgentUiFactory::CreateF32AgentUiL();
   265 		iAgentUi = TF32AgentUiFactory::CreateF32AgentUiL();
   355 		}
   266 		}
   356 	return *iAgentUi;
   267 	return *iAgentUi;
   357 	}
   268 	}
   358 
   269 
   359 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   270 
   360 
       
   361 TInt CF32AgentData::Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputDataPacket)
       
   362 	{
       
   363 	if(aEncryptedInputDataPacket.Length() <= 0)
       
   364 		{
       
   365 		return KErrInsufficientDataPacketLength;
       
   366 		}
       
   367 	
       
   368 	aDecryptedOutputDataPacket = aEncryptedInputDataPacket;
       
   369 	return KErrNone;
       
   370 	}
       
   371 			
       
   372 void CF32AgentData::Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputDataPacket, TRequestStatus& aStatus)
       
   373 	{
       
   374 	TRequestStatus* status = &aStatus;
       
   375 	if(aEncryptedInputDataPacket.Length() <= 0)
       
   376 		{
       
   377 		User::RequestComplete(status, KErrInsufficientDataPacketLength);		
       
   378 		}
       
   379 	
       
   380 	aDecryptedOutputDataPacket = aEncryptedInputDataPacket;
       
   381 	User::RequestComplete(status, KErrNone);
       
   382 	}
       
   383 
       
   384 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT