109 CleanupStack::PushL(self); |
109 CleanupStack::PushL(self); |
110 self->ConstructL(aUid, aFile, aUniqueId, aIntent); |
110 self->ConstructL(aUid, aFile, aUniqueId, aIntent); |
111 return self; |
111 return self; |
112 } |
112 } |
113 |
113 |
|
114 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
115 |
|
116 EXPORT_C CData* CData::NewL(const TDesC8& aHeaderData) |
|
117 { |
|
118 CData* self = CData::NewLC(aHeaderData); |
|
119 CleanupStack::Pop(self); |
|
120 return self; |
|
121 } |
|
122 |
|
123 EXPORT_C CData* CData::NewL(const TDesC8& aHeaderData, TIntent aIntent) |
|
124 { |
|
125 CData* self = CData::NewLC(aHeaderData, aIntent); |
|
126 CleanupStack::Pop(self); |
|
127 return self; |
|
128 } |
|
129 |
|
130 EXPORT_C CData* CData::NewLC(const TDesC8& aHeaderData) |
|
131 { |
|
132 CData* self = new (ELeave) CData(); |
|
133 CleanupStack::PushL(self); |
|
134 self->ConstructL(aHeaderData); |
|
135 return self; |
|
136 } |
|
137 |
|
138 EXPORT_C CData* CData::NewLC(const TDesC8& aHeaderData, TIntent aIntent) |
|
139 { |
|
140 CData* self = new (ELeave) CData(); |
|
141 CleanupStack::PushL(self); |
|
142 self->ConstructL(aHeaderData, aIntent); |
|
143 return self; |
|
144 } |
|
145 |
|
146 CData* CData::NewLC(TUid aAgentUid, const TDesC8& aHeaderData, TIntent aIntent) |
|
147 { |
|
148 CData* self = new (ELeave) CData(); |
|
149 CleanupStack::PushL(self); |
|
150 self->ConstructL(aAgentUid, aHeaderData, aIntent); |
|
151 return self; |
|
152 } |
|
153 |
|
154 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
155 |
114 CData::CData() |
156 CData::CData() |
115 { |
157 { |
116 } |
158 } |
117 |
159 |
118 CData::~CData() |
160 CData::~CData() |
245 iAgentFactory = CAgentFactory::NewL(iAgentUid); |
287 iAgentFactory = CAgentFactory::NewL(iAgentUid); |
246 |
288 |
247 // Create an instance of the agent's CAgentData |
289 // Create an instance of the agent's CAgentData |
248 // The agent must make a duplicate of the file handle |
290 // The agent must make a duplicate of the file handle |
249 iAgentData = iAgentFactory->CreateDataConsumerL(aFile, aUniqueId); |
291 iAgentData = iAgentFactory->CreateDataConsumerL(aFile, aUniqueId); |
250 |
292 } |
251 } |
293 |
252 |
294 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
253 |
295 |
|
296 void CData::ConstructL(const TDesC8& aHeaderData) |
|
297 { |
|
298 // Find the agent who handles the file |
|
299 CAgentResolver* resolver = CAgentResolver::NewLC(EFalse); |
|
300 CAgentInfo& agentInfo = resolver->ResolveFileL(aHeaderData); |
|
301 |
|
302 // Figure out the Uid of the agent |
|
303 TUid agentUid = agentInfo.Agent().ImplementationUid(); |
|
304 CData::ConstructL(agentUid, aHeaderData); |
|
305 |
|
306 // Cleanup resolver after creating CData to unnecessary |
|
307 // unloading and loading of agent plug-ins |
|
308 CleanupStack::PopAndDestroy(resolver); |
|
309 } |
|
310 |
|
311 void CData::ConstructL(const TDesC8& aHeaderData, TIntent aIntent) |
|
312 { |
|
313 CData::ConstructL(aHeaderData); |
|
314 |
|
315 // Ensure that client's intent is possible |
|
316 User::LeaveIfError(iAgentData->EvaluateIntent(aIntent)); |
|
317 } |
|
318 |
|
319 void CData::ConstructL(TUid aAgentUid, const TDesC8& aHeaderData) |
|
320 { |
|
321 iAgentUid = aAgentUid; |
|
322 |
|
323 iAgentFactory = CAgentFactory::NewL(iAgentUid); |
|
324 // create an instance of agent's CAgentStreamData. |
|
325 iAgentData = iAgentFactory->CreateDataConsumerL(aHeaderData); |
|
326 } |
|
327 |
|
328 void CData::ConstructL(TUid aUid, const TDesC8& aHeaderData, TIntent aIntent) |
|
329 { |
|
330 CData::ConstructL(aUid, aHeaderData); |
|
331 |
|
332 // Ensure that client's intent is possible |
|
333 User::LeaveIfError(iAgentData->EvaluateIntent(aIntent)); |
|
334 } |
|
335 |
|
336 #endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
337 |
254 EXPORT_C void CData::DataSizeL(TInt& aSize) |
338 EXPORT_C void CData::DataSizeL(TInt& aSize) |
255 { |
339 { |
256 // ask the agent for the data size of the current content object |
340 // ask the agent for the data size of the current content object |
257 iAgentData->DataSizeL(aSize); |
341 iAgentData->DataSizeL(aSize); |
258 } |
342 } |
315 |
399 |
316 EXPORT_C void CData::ReadCancel(TRequestStatus &aStatus) const |
400 EXPORT_C void CData::ReadCancel(TRequestStatus &aStatus) const |
317 { |
401 { |
318 iAgentData->ReadCancel(aStatus); |
402 iAgentData->ReadCancel(aStatus); |
319 } |
403 } |
|
404 |
|
405 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
406 |
|
407 EXPORT_C TInt CData::Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputPacket) const |
|
408 { |
|
409 return iAgentData->Read(aEncryptedInputDataPacket, aDecryptedOutputPacket); |
|
410 } |
|
411 |
|
412 EXPORT_C void CData::Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputPacket, TRequestStatus& aStatus) const |
|
413 { |
|
414 iAgentData->Read(aEncryptedInputDataPacket, aDecryptedOutputPacket, aStatus); |
|
415 } |
|
416 |
|
417 #endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
320 |
418 |
321 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
419 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
322 EXPORT_C TInt CData::Read_Unused(TInt aPos, TDes8& aDes, |
420 EXPORT_C TInt CData::Read_Unused(TInt aPos, TDes8& aDes, |
323 TInt aLength, TRequestStatus& aStatus) const |
421 TInt aLength, TRequestStatus& aStatus) const |
324 #else |
422 #else |