contentmgmt/contentaccessfwfordrm/source/caf/resolver.cpp
changeset 15 da2ae96f639b
parent 8 35751d3474b7
child 45 030c4fbc13d7
--- a/contentmgmt/contentaccessfwfordrm/source/caf/resolver.cpp	Fri Oct 02 13:15:59 2009 +0300
+++ b/contentmgmt/contentaccessfwfordrm/source/caf/resolver.cpp	Mon Oct 12 10:17:04 2009 +0300
@@ -352,6 +352,75 @@
 		}
 	return *iDefaultAgent;
 	}
+
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+
+CAgentInfo& CAgentResolver::ResolveFileL(const TDesC8& aHeaderData)
+	{
+	// Go through all the agents and return the one which supports the given WMDRM content.
+	
+	TInt agentsCount(iAgentInfos.Count());
+	CAgentManager* agentManager = NULL;
+	
+	for (TInt i = 0; i < agentsCount; ++i)
+		{
+		TRAPD(result, agentManager = &iAgentInfos[i]->AgentManagerL());
+		if(result != KErrNone)
+			{
+			if(KErrNoMemory == result)
+				{
+				User::Leave(result);
+				}
+			else
+				{
+				continue;	
+				}
+			}
+			
+		if (agentManager->IsRecognizedL(aHeaderData))
+			{
+			return *iAgentInfos[i];
+			}
+		}
+		
+    // will never reach here	
+	return *iDefaultAgent;
+	}
+	
+	
+EXPORT_C TBool CAgentResolver::DoRecognizeL(const TDesC8& aHeader, TDes8& aFileMimeType, TDes8& aContentMimeType)
+	{
+	// Go through all the agents and return the one which supports the given WMDRM content.
+	TInt agentsCount(iAgentInfos.Count());
+	CAgentManager* agentManager = NULL;
+	for (TInt i = 0; i < agentsCount; ++i)
+		{
+		TRAPD(result, agentManager = &iAgentInfos[i]->AgentManagerL());
+		if(result != KErrNone)
+			{
+			if(KErrNoMemory == result)
+				{
+				User::Leave(result);
+				}
+			else
+				{
+				continue;	
+				}
+			}
+			
+		if (agentManager->RecognizeContentL(aHeader, aFileMimeType, aContentMimeType))
+			{
+			// force to lower case to ensure that chosen lower case scheme for mime types is maintained
+			aFileMimeType.LowerCase();
+			aContentMimeType.LowerCase();			
+			return ETrue;
+			}
+		}
+		
+	return EFalse;
+	}
+	
+#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
 	
 TUid CAgentResolver::ResolveDirectory(const TDesC& aPath, TDes& aActualPath, TBool& aThePrivateDir) const
 	{