73 CContent* self=CContent::NewLC(aFile); |
73 CContent* self=CContent::NewLC(aFile); |
74 CleanupStack::Pop(self); |
74 CleanupStack::Pop(self); |
75 return self; |
75 return self; |
76 } |
76 } |
77 |
77 |
|
78 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
79 |
|
80 EXPORT_C CContent* CContent::NewLC(const TDesC8& aHeaderData) |
|
81 { |
|
82 CContent* self = new(ELeave) CContent(); |
|
83 CleanupStack::PushL(self); |
|
84 self->ConstructL(aHeaderData); |
|
85 return self; |
|
86 } |
|
87 |
|
88 EXPORT_C CContent* CContent::NewL(const TDesC8& aHeaderData) |
|
89 { |
|
90 CContent* self=CContent::NewLC(aHeaderData); |
|
91 CleanupStack::Pop(self); |
|
92 return self; |
|
93 } |
|
94 |
|
95 #endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
78 |
96 |
79 CContent::CContent() : iDefaultVirtualPath(KNullDesC(), KDefaultContentObject()) |
97 CContent::CContent() : iDefaultVirtualPath(KNullDesC(), KDefaultContentObject()) |
80 { |
98 { |
81 } |
99 } |
82 |
100 |
165 |
187 |
166 // Finished with resolver and the CAgentInfo object it owns |
188 // Finished with resolver and the CAgentInfo object it owns |
167 CleanupStack::PopAndDestroy(2, resolver); // actualUri |
189 CleanupStack::PopAndDestroy(2, resolver); // actualUri |
168 } |
190 } |
169 |
191 |
|
192 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
193 |
|
194 void CContent::ConstructL(const TDesC8& aHeaderData) |
|
195 { |
|
196 if(aHeaderData.Length() <= 0) |
|
197 { |
|
198 User::Leave(KErrMissingWmdrmHeaderData); |
|
199 } |
|
200 |
|
201 iHeaderData = aHeaderData.AllocL(); |
|
202 |
|
203 CAgentResolver* resolver = CAgentResolver::NewLC(EFalse); |
|
204 |
|
205 // Find the agent who handles the file |
|
206 CAgentInfo& agentInfo = resolver->ResolveFileL(aHeaderData); |
|
207 |
|
208 // copy the agent name and Uid |
|
209 iAgent = agentInfo.Agent(); |
|
210 |
|
211 // Construct the agent factory (ECOM handle) |
|
212 iAgentFactory = CAgentFactory::NewL(iAgent.ImplementationUid()); |
|
213 // Construct the CAgentContent object |
|
214 iAgentContent = iAgentFactory->CreateContentBrowserL(aHeaderData); |
|
215 |
|
216 // Finished with resolver (and the agentInfo object it owns) |
|
217 CleanupStack::PopAndDestroy(resolver); |
|
218 } |
|
219 |
|
220 #endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
170 |
221 |
171 EXPORT_C TInt CContent::OpenContainer(const TDesC &aUniqueId) |
222 EXPORT_C TInt CContent::OpenContainer(const TDesC &aUniqueId) |
172 { |
223 { |
173 return iAgentContent->OpenContainer(aUniqueId); |
224 return iAgentContent->OpenContainer(aUniqueId); |
174 } |
225 } |
298 return iAgentContent->SetProperty(aProperty, aValue); |
349 return iAgentContent->SetProperty(aProperty, aValue); |
299 } |
350 } |
300 |
351 |
301 EXPORT_C CData* CContent::OpenContentL(TIntent aIntent) |
352 EXPORT_C CData* CContent::OpenContentL(TIntent aIntent) |
302 { |
353 { |
|
354 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
355 if(iHeaderData != NULL) |
|
356 return OpenContentL(aIntent, *iHeaderData); |
|
357 else |
|
358 return OpenContentL(aIntent, iDefaultVirtualPath.UniqueId()); |
|
359 #else |
303 return OpenContentL(aIntent, iDefaultVirtualPath.UniqueId()); |
360 return OpenContentL(aIntent, iDefaultVirtualPath.UniqueId()); |
|
361 #endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
304 } |
362 } |
305 |
363 |
306 EXPORT_C CData* CContent::OpenContentLC(TIntent aIntent) |
364 EXPORT_C CData* CContent::OpenContentLC(TIntent aIntent) |
307 { |
365 { |
|
366 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
367 if(iHeaderData != NULL) |
|
368 return OpenContentLC(aIntent, *iHeaderData); |
|
369 else |
|
370 return OpenContentLC(aIntent, iDefaultVirtualPath.UniqueId()); |
|
371 #else |
308 return OpenContentLC(aIntent, iDefaultVirtualPath.UniqueId()); |
372 return OpenContentLC(aIntent, iDefaultVirtualPath.UniqueId()); |
|
373 #endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
309 } |
374 } |
310 |
375 |
311 EXPORT_C CData* CContent::OpenContentL(TIntent aIntent, const TDesC &aUniqueId) |
376 EXPORT_C CData* CContent::OpenContentL(TIntent aIntent, const TDesC &aUniqueId) |
312 { |
377 { |
313 CData* data = OpenContentLC(aIntent, aUniqueId); |
378 CData* data = OpenContentLC(aIntent, aUniqueId); |
328 // create a CData based upon the file handle supplied when this CContent was created |
393 // create a CData based upon the file handle supplied when this CContent was created |
329 return CData::NewLC(iAgent.ImplementationUid(), iFile, aUniqueId, aIntent); |
394 return CData::NewLC(iAgent.ImplementationUid(), iFile, aUniqueId, aIntent); |
330 } |
395 } |
331 } |
396 } |
332 |
397 |
|
398 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
399 |
|
400 CData* CContent::OpenContentL(TIntent aIntent, const TDesC8& aHeaderData) |
|
401 { |
|
402 CData* data = OpenContentLC(aIntent, aHeaderData); |
|
403 CleanupStack::Pop(data); |
|
404 return data; |
|
405 } |
|
406 |
|
407 CData* CContent::OpenContentLC(TIntent aIntent, const TDesC8& aHeaderData) |
|
408 { |
|
409 return CData::NewLC(iAgent.ImplementationUid(), aHeaderData, aIntent); |
|
410 } |
|
411 |
|
412 #endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
413 |
333 EXPORT_C const TAgent& CContent::Agent() const |
414 EXPORT_C const TAgent& CContent::Agent() const |
334 { |
415 { |
335 // The agent handling this content |
416 // The agent handling this content |
336 return iAgent; |
417 return iAgent; |
337 } |
418 } |
360 EXPORT_C CAttribute* CContent::NewAttributeL(TBool aPreloaded) |
441 EXPORT_C CAttribute* CContent::NewAttributeL(TBool aPreloaded) |
361 { |
442 { |
362 return NewAttributeL(aPreloaded, EContentShareReadOnly); |
443 return NewAttributeL(aPreloaded, EContentShareReadOnly); |
363 } |
444 } |
364 |
445 |
|
446 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
365 EXPORT_C CAttribute* CContent::NewAttributeL(TBool aPreloaded, TContentShareMode aShareMode) |
447 EXPORT_C CAttribute* CContent::NewAttributeL(TBool aPreloaded, TContentShareMode aShareMode) |
366 { |
448 { |
367 CAttribute* attr = NULL; |
449 CAttribute* attr = NULL; |
368 |
450 |
369 if(iVirtualPath) |
451 if(iVirtualPath) |
370 { |
452 { |
371 // if we were opened with a file name |
453 // if we were opened with a file name |
372 attr = CAttribute::NewLC(iAgent.ImplementationUid(), iDefaultVirtualPath.URI(), aShareMode); |
454 attr = CAttribute::NewLC(iAgent.ImplementationUid(), iDefaultVirtualPath.URI(), aShareMode); |
373 } |
455 } |
|
456 else if(iHeaderData) |
|
457 { |
|
458 attr = CAttribute::NewLC(iAgent.ImplementationUid(), *iHeaderData); |
|
459 } |
374 else |
460 else |
375 { |
461 { |
376 // if we were opened with a file handle |
462 // if we were opened with a file handle |
377 attr = CAttribute::NewLC(iAgent.ImplementationUid(), iFile); |
463 attr = CAttribute::NewLC(iAgent.ImplementationUid(), iFile); |
378 } |
464 } |
386 |
472 |
387 CleanupStack::Pop(attr); |
473 CleanupStack::Pop(attr); |
388 return attr; |
474 return attr; |
389 } |
475 } |
390 |
476 |
|
477 #else |
|
478 |
|
479 EXPORT_C CAttribute* CContent::NewAttributeL(TBool aPreloaded, TContentShareMode aShareMode) |
|
480 { |
|
481 CAttribute* attr = NULL; |
|
482 |
|
483 if(iVirtualPath) |
|
484 { |
|
485 // if we were opened with a file name |
|
486 attr = CAttribute::NewLC(iAgent.ImplementationUid(), iDefaultVirtualPath.URI(), aShareMode); |
|
487 } |
|
488 else |
|
489 { |
|
490 // if we were opened with a file handle |
|
491 attr = CAttribute::NewLC(iAgent.ImplementationUid(), iFile); |
|
492 } |
|
493 |
|
494 // If aPreloaded is set, query the agent immediately for all the attributes |
|
495 if (aPreloaded) |
|
496 { |
|
497 attr->QuerySet().SetAll(); |
|
498 attr->GetL(); |
|
499 } |
|
500 |
|
501 CleanupStack::Pop(attr); |
|
502 return attr; |
|
503 } |
|
504 |
|
505 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
506 |
391 #endif // REMOVE_CAF1 |
507 #endif // REMOVE_CAF1 |
392 |
508 |
393 // DLL entry point - only for EKA1 |
509 // DLL entry point - only for EKA1 |
394 |
510 |
395 |
511 |