contentmgmt/referencedrmagent/RefTestAgent/RefTestAgent/Reftestagentmanager.cpp
changeset 15 da2ae96f639b
parent 8 35751d3474b7
child 19 cd501b96611d
equal deleted inserted replaced
10:afc583cfa176 15:da2ae96f639b
   218 	}
   218 	}
   219 
   219 
   220 TBool CRefTestAgentManager::IsRecognizedL(const TDesC& aUri, TContentShareMode /*aShareMode*/) const
   220 TBool CRefTestAgentManager::IsRecognizedL(const TDesC& aUri, TContentShareMode /*aShareMode*/) const
   221 	{
   221 	{
   222 	TBool result = EFalse;
   222 	TBool result = EFalse;
   223 	
       
   224 	// Check that the file has content only, otherwise it should
   223 	// Check that the file has content only, otherwise it should
   225 	// be put through the supplier API before it can be used
   224 	// be put through the supplier API before it can be used
   226 	TPtrC extension(aUri.Right(KRtaExtensionContent().Length()));
   225 	TPtrC extension(aUri.Right(KRtaExtensionContent().Length()));
   227 	if(extension.CompareF(KRtaExtensionContent) == 0)
   226 	if(extension.CompareF(KRtaExtensionContent) == 0)
   228 		{
   227 		{
   236 	TBool result = EFalse;
   235 	TBool result = EFalse;
   237 	
   236 	
   238 	// Get the name of the file
   237 	// Get the name of the file
   239 	TFileName fileName;
   238 	TFileName fileName;
   240 	aFile.Name(fileName);
   239 	aFile.Name(fileName);
   241 
   240 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   241     TPtrC extension(fileName.Right(KRtaExtensionContent().Length()));     
       
   242     TPtrC wmdrmExtn(fileName.Right(KRtaWmdrmFileExtension().Length()));     
       
   243     if((extension.CompareF(KRtaExtensionContent) == 0) || (wmdrmExtn.CompareF(KRtaWmdrmFileExtension) == 0))     
       
   244         {     
       
   245         result = ETrue;     
       
   246         }     
       
   247       
       
   248 #else 
   242 	// Check that the file has content only, otherwise it should
   249 	// Check that the file has content only, otherwise it should
   243 	// be put through the supplier API before it can be used
   250 	// be put through the supplier API before it can be used
   244 	TPtrC extension(fileName.Right(KRtaExtensionContent().Length()));
   251 	TPtrC extension(fileName.Right(KRtaExtensionContent().Length()));
   245 	if(extension.CompareF(KRtaExtensionContent) == 0)
   252 	if(extension.CompareF(KRtaExtensionContent) == 0)
   246 		{
   253 		{
   247 		result = ETrue;
   254 		result = ETrue;
   248 		}
   255 		}
       
   256 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   249 	return result;
   257 	return result;
   250 	}
   258 	}
   251 
   259 
   252 TBool CRefTestAgentManager::RecognizeFileL(const TDesC& aFileName, const TDesC8& aBuffer, TDes8& aFileMimeType, TDes8& aContentMimeType) const
   260 TBool CRefTestAgentManager::RecognizeFileL(const TDesC& aFileName, const TDesC8& aBuffer, TDes8& aFileMimeType, TDes8& aContentMimeType) const
   253 	{
   261 	{
   254 	TBool result = EFalse;
   262 	TBool result = EFalse;
   255 	
   263 	
   256 	// Check filename extension
   264 	// Check filename extension
   257 	TPtrC extension(aFileName.Right(KRtaExtensionContent().Length()));
   265 	TPtrC extension(aFileName.Right(KRtaExtensionContent().Length()));
       
   266 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   267     TPtrC wmdrmExtn(aFileName.Right(KRtaWmdrmFileExtension().Length()));     
       
   268     if(wmdrmExtn.CompareF(KRtaWmdrmFileExtension) == 0)     
       
   269         {     
       
   270         aFileMimeType.Copy(KRtaWmaContentType);     
       
   271         aContentMimeType.Copy(KRtaWmaContentType);     
       
   272         result = ETrue;     
       
   273         }     
       
   274          
       
   275     else if(extension.CompareF(KRtaExtensionContent) == 0)     
       
   276         {     
       
   277         aFileMimeType.Copy(KRtaMimeContent());     
       
   278         CRefTestAgentArchive::GetDefaultMimeTypeFromHeaderL(aBuffer, aContentMimeType);     
       
   279         result = ETrue;      
       
   280         }     
       
   281 #else    
   258 	if(extension.CompareF(KRtaExtensionContent) == 0)
   282 	if(extension.CompareF(KRtaExtensionContent) == 0)
   259 		{
   283 		{
   260 		// It's a content file ready for applications to read
   284 		// It's a content file ready for applications to read
   261 		aFileMimeType.Copy(KRtaMimeContent());
   285 		aFileMimeType.Copy(KRtaMimeContent());
   262 		CRefTestAgentArchive::GetDefaultMimeTypeFromHeaderL(aBuffer, aContentMimeType);
   286 		CRefTestAgentArchive::GetDefaultMimeTypeFromHeaderL(aBuffer, aContentMimeType);
   263 		result = ETrue;	
   287 		result = ETrue;	
   264 		}
   288 		}
       
   289 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   265 	else
   290 	else
   266 		{
   291 		{
   267 		extension.Set(aFileName.Right(KRtaExtensionContentRights().Length()));
   292 		extension.Set(aFileName.Right(KRtaExtensionContentRights().Length()));
   268 		if(extension.CompareF(KRtaExtensionContentRights) == 0)
   293 		if(extension.CompareF(KRtaExtensionContentRights) == 0)
   269 			{
   294 			{
   334 	{
   359 	{
   335 	}
   360 	}
   336 #endif
   361 #endif
   337 
   362 
   338 
   363 
       
   364 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
       
   365       
       
   366 TBool CRefTestAgentManager::IsRecognizedL(const TDesC8& aHeaderData) const
       
   367     {
       
   368     TBool result = EFalse;
       
   369     if(aHeaderData.Find(KRtaAsfHeaderObject) != KErrNotFound)     
       
   370         {     
       
   371         result = ETrue;     
       
   372         }     
       
   373              
       
   374     return result;     
       
   375     }
       
   376      
       
   377 TBool CRefTestAgentManager::RecognizeContentL(const TDesC8& aHeaderData, TDes8& aFileMimeType, TDes8& aContentMimeType) const     
       
   378     {     
       
   379     TBool result = EFalse;     
       
   380     if(aHeaderData.Find(KRtaAsfHeaderObject) != KErrNotFound)     
       
   381         {     
       
   382         aFileMimeType.Copy(KRtaWmaContentType);     
       
   383         aContentMimeType.Copy(KRtaWmaContentType);     
       
   384         result = ETrue;     
       
   385         }     
       
   386          
       
   387     return result;     
       
   388     }     
       
   389          
       
   390 TInt CRefTestAgentManager::GetAttribute(const TDesC8& aHeaderData, TInt aAttribute, TInt& aValue)     
       
   391     {     
       
   392     return iManagerSession.GetAttribute(aHeaderData, aAttribute, aValue);     
       
   393     }     
       
   394       
       
   395 TInt CRefTestAgentManager::GetAttributeSet(const TDesC8& aHeaderData, RAttributeSet& aAttributeSet)     
       
   396     {     
       
   397     return iManagerSession.GetAttributeSet(aHeaderData, aAttributeSet);     
       
   398     }     
       
   399       
       
   400 TInt CRefTestAgentManager::GetStringAttribute(const TDesC8& aHeaderData, TInt aAttribute, TDes& aValue)      
       
   401     {     
       
   402     return iManagerSession.GetStringAttribute(aHeaderData, aAttribute, aValue);     
       
   403     }     
       
   404       
       
   405 TInt CRefTestAgentManager::GetStringAttributeSet(const TDesC8& aHeaderData, RStringAttributeSet& aAttributeSet)      
       
   406     {     
       
   407     return iManagerSession.GetStringAttributeSet(aHeaderData, aAttributeSet);     
       
   408     }     
       
   409          
       
   410 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT 
       
   411