--- a/contentmgmt/contentaccessfwfordrm/source/caf/content.cpp Thu Aug 19 11:38:48 2010 +0300
+++ b/contentmgmt/contentaccessfwfordrm/source/caf/content.cpp Tue Aug 31 17:00:08 2010 +0300
@@ -75,6 +75,24 @@
return self;
}
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+
+EXPORT_C CContent* CContent::NewLC(const TDesC8& aHeaderData)
+ {
+ CContent* self = new(ELeave) CContent();
+ CleanupStack::PushL(self);
+ self->ConstructL(aHeaderData);
+ return self;
+ }
+
+EXPORT_C CContent* CContent::NewL(const TDesC8& aHeaderData)
+ {
+ CContent* self=CContent::NewLC(aHeaderData);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
CContent::CContent() : iDefaultVirtualPath(KNullDesC(), KDefaultContentObject())
{
@@ -90,6 +108,10 @@
delete iVirtualPath;
}
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+ delete iHeaderData;
+#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+
// Finished with agent, this closes ECOM handle
delete iAgentFactory;
REComSession::FinalClose();
@@ -167,6 +189,35 @@
CleanupStack::PopAndDestroy(2, resolver); // actualUri
}
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+
+void CContent::ConstructL(const TDesC8& aHeaderData)
+ {
+ if(aHeaderData.Length() <= 0)
+ {
+ User::Leave(KErrMissingWmdrmHeaderData);
+ }
+
+ iHeaderData = aHeaderData.AllocL();
+
+ CAgentResolver* resolver = CAgentResolver::NewLC(EFalse);
+
+ // Find the agent who handles the file
+ CAgentInfo& agentInfo = resolver->ResolveFileL(aHeaderData);
+
+ // copy the agent name and Uid
+ iAgent = agentInfo.Agent();
+
+ // Construct the agent factory (ECOM handle)
+ iAgentFactory = CAgentFactory::NewL(iAgent.ImplementationUid());
+ // Construct the CAgentContent object
+ iAgentContent = iAgentFactory->CreateContentBrowserL(aHeaderData);
+
+ // Finished with resolver (and the agentInfo object it owns)
+ CleanupStack::PopAndDestroy(resolver);
+ }
+
+#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
EXPORT_C TInt CContent::OpenContainer(const TDesC &aUniqueId)
{
@@ -300,12 +351,26 @@
EXPORT_C CData* CContent::OpenContentL(TIntent aIntent)
{
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+ if(iHeaderData != NULL)
+ return OpenContentL(aIntent, *iHeaderData);
+ else
+ return OpenContentL(aIntent, iDefaultVirtualPath.UniqueId());
+#else
return OpenContentL(aIntent, iDefaultVirtualPath.UniqueId());
+#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
}
EXPORT_C CData* CContent::OpenContentLC(TIntent aIntent)
{
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+ if(iHeaderData != NULL)
+ return OpenContentLC(aIntent, *iHeaderData);
+ else
+ return OpenContentLC(aIntent, iDefaultVirtualPath.UniqueId());
+#else
return OpenContentLC(aIntent, iDefaultVirtualPath.UniqueId());
+#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
}
EXPORT_C CData* CContent::OpenContentL(TIntent aIntent, const TDesC &aUniqueId)
@@ -330,6 +395,22 @@
}
}
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+
+CData* CContent::OpenContentL(TIntent aIntent, const TDesC8& aHeaderData)
+ {
+ CData* data = OpenContentLC(aIntent, aHeaderData);
+ CleanupStack::Pop(data);
+ return data;
+ }
+
+CData* CContent::OpenContentLC(TIntent aIntent, const TDesC8& aHeaderData)
+ {
+ return CData::NewLC(iAgent.ImplementationUid(), aHeaderData, aIntent);
+ }
+
+#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+
EXPORT_C const TAgent& CContent::Agent() const
{
// The agent handling this content
@@ -362,6 +443,39 @@
return NewAttributeL(aPreloaded, EContentShareReadOnly);
}
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+EXPORT_C CAttribute* CContent::NewAttributeL(TBool aPreloaded, TContentShareMode aShareMode)
+ {
+ CAttribute* attr = NULL;
+
+ if(iVirtualPath)
+ {
+ // if we were opened with a file name
+ attr = CAttribute::NewLC(iAgent.ImplementationUid(), iDefaultVirtualPath.URI(), aShareMode);
+ }
+ else if(iHeaderData)
+ {
+ attr = CAttribute::NewLC(iAgent.ImplementationUid(), *iHeaderData);
+ }
+ else
+ {
+ // if we were opened with a file handle
+ attr = CAttribute::NewLC(iAgent.ImplementationUid(), iFile);
+ }
+
+ // If aPreloaded is set, query the agent immediately for all the attributes
+ if (aPreloaded)
+ {
+ attr->QuerySet().SetAll();
+ attr->GetL();
+ }
+
+ CleanupStack::Pop(attr);
+ return attr;
+ }
+
+#else
+
EXPORT_C CAttribute* CContent::NewAttributeL(TBool aPreloaded, TContentShareMode aShareMode)
{
CAttribute* attr = NULL;
@@ -388,6 +502,8 @@
return attr;
}
+#endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+
#endif // REMOVE_CAF1
// DLL entry point - only for EKA1