|
1 /* |
|
2 * Copyright (c) 2006 - 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of the Manager Interface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <caf.h> |
|
21 #include <http.h> |
|
22 #include <http/rhttpheaders.h> |
|
23 #include <stringpool.h> |
|
24 #include <w32std.h> |
|
25 #include <apparc.h> |
|
26 #include <apgtask.h> |
|
27 #include <apgcli.h> |
|
28 #include <apaserverapp.h> |
|
29 #include <sysutil.h> |
|
30 #include <wmdrmagent.h> |
|
31 |
|
32 #include "wmdrmclient.h" |
|
33 #include "wmdrmagentmanager.h" |
|
34 #include "wmdrmagentattributes.h" |
|
35 #include "asf.h" |
|
36 #include "logfn.h" |
|
37 |
|
38 using namespace ContentAccess; |
|
39 |
|
40 // ============================ MEMBER FUNCTIONS =============================== |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CWmDrmAgentManager::CWmDrmAgentManager |
|
44 // C++ default constructor can NOT contain any code, that |
|
45 // might leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CWmDrmAgentManager::CWmDrmAgentManager() |
|
49 { |
|
50 LOGFN( "CWmDrmAgentManager::CWmDrmAgentManager" ); |
|
51 } |
|
52 |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CWmDrmAgentManager::NewL |
|
56 // Two-phased constructor. |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 CWmDrmAgentManager* CWmDrmAgentManager::NewL() |
|
60 { |
|
61 LOGFN( "CWmDrmAgentManager::NewL" ); |
|
62 CWmDrmAgentManager* self=new(ELeave) CWmDrmAgentManager(); |
|
63 CleanupStack::PushL(self); |
|
64 self->ConstructL(); |
|
65 CleanupStack::Pop(self); |
|
66 return self; |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CWmDrmAgentManager::NewLC |
|
71 // Two-phased constructor. |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CWmDrmAgentManager* CWmDrmAgentManager::NewLC() |
|
75 { |
|
76 LOGFN( "CWmDrmAgentManager::NewLC" ); |
|
77 CWmDrmAgentManager* self=new(ELeave) CWmDrmAgentManager(); |
|
78 CleanupStack::PushL(self); |
|
79 self->ConstructL(); |
|
80 return self; |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CWmDrmAgentManager::~CWmDrmAgentManager |
|
85 // Destructor |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 |
|
89 CWmDrmAgentManager::~CWmDrmAgentManager() |
|
90 { |
|
91 LOGFN( "CWmDrmAgentManager::~CWmDrmAgentManager" ); |
|
92 delete iFileMan; |
|
93 iFs.Close(); |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CWmDrmAgentManager::ConstructL |
|
98 // Symbian 2nd phase constructor can leave. |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 void CWmDrmAgentManager::ConstructL() |
|
102 { |
|
103 LOGFN( "CWmDrmAgentManager::ConstructL" ); |
|
104 User::LeaveIfError(iFs.Connect()); |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CWmDrmAgentManager::DeleteFile |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 TInt CWmDrmAgentManager::DeleteFile(const TDesC& aFileName) |
|
112 { |
|
113 LOGFN( "CWmDrmAgentManager::DeleteFile" ); |
|
114 return iFs.Delete(aFileName); |
|
115 } |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // CWmDrmAgentManager::CopyFile |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 TInt CWmDrmAgentManager::CopyFile(const TDesC& aSource, |
|
122 const TDesC& aDestination) |
|
123 { |
|
124 LOGFN( "CWmDrmAgentManager::CopyFile" ); |
|
125 TInt driveNumber = 0; |
|
126 TChar drive( aDestination[0] ); |
|
127 RFile file; |
|
128 TInt size = 0; |
|
129 TInt result = KErrNone; |
|
130 |
|
131 TInt r = KErrNone; |
|
132 TBool retval(EFalse); |
|
133 |
|
134 // Check the destination drive letter |
|
135 result = iFs.CharToDrive(drive,driveNumber); |
|
136 |
|
137 if( result ) |
|
138 { |
|
139 return result; |
|
140 } |
|
141 |
|
142 // open the file to read the size |
|
143 result = file.Open(iFs, aSource, EFileShareReadersOrWriters|EFileRead); |
|
144 |
|
145 if( result ) |
|
146 { |
|
147 return result; |
|
148 } |
|
149 |
|
150 // read the size |
|
151 result = file.Size( size ); |
|
152 |
|
153 // close the file |
|
154 file.Close(); |
|
155 |
|
156 if( result ) |
|
157 { |
|
158 return result; |
|
159 } |
|
160 // check that the drive has enough space for the copy operation |
|
161 TRAP(r, retval = SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, |
|
162 size, |
|
163 driveNumber ) ); |
|
164 |
|
165 if( retval ) |
|
166 { |
|
167 return KErrDiskFull; |
|
168 } |
|
169 |
|
170 result = SetFileMan(); |
|
171 |
|
172 if( result ) |
|
173 { |
|
174 return result; |
|
175 } |
|
176 |
|
177 return iFileMan->Copy(aSource, aDestination); |
|
178 } |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // CWmDrmAgentManager::CopyFile |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 TInt CWmDrmAgentManager::CopyFile(RFile& aSource, |
|
185 const TDesC& aDestination) |
|
186 { |
|
187 LOGFN( "CWmDrmAgentManager::CopyFile (2)" ); |
|
188 TInt driveNumber = 0; |
|
189 TChar drive( aDestination[0] ); |
|
190 TInt size = 0; |
|
191 TInt result = KErrNone; |
|
192 RFile output; |
|
193 TFileName fileName; |
|
194 TInt r = KErrNone; |
|
195 TBool retval(EFalse); |
|
196 |
|
197 // Same file, do not even try to copy |
|
198 // And since they are the same don't return an error |
|
199 aSource.FullName( fileName ); |
|
200 |
|
201 if( !aDestination.CompareF( fileName ) ) |
|
202 { |
|
203 return KErrNone; |
|
204 } |
|
205 |
|
206 // Check the destination drive letter |
|
207 result = iFs.CharToDrive(drive,driveNumber); |
|
208 |
|
209 if( result ) |
|
210 { |
|
211 return result; |
|
212 } |
|
213 |
|
214 // read the size |
|
215 result = aSource.Size( size ); |
|
216 |
|
217 if( result ) |
|
218 { |
|
219 return result; |
|
220 } |
|
221 |
|
222 // check that the drive has enough space for the copy operation |
|
223 TRAP(r, retval = SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, |
|
224 size, |
|
225 driveNumber ) ); |
|
226 if( retval ) |
|
227 { |
|
228 return KErrDiskFull; |
|
229 } |
|
230 |
|
231 // Perform the copy: |
|
232 |
|
233 // Rewind just in case: |
|
234 size = 0; |
|
235 result = aSource.Seek(ESeekStart, size); |
|
236 |
|
237 if( !result ) |
|
238 { |
|
239 |
|
240 result = SetFileMan(); |
|
241 |
|
242 if( result ) |
|
243 { |
|
244 return result; |
|
245 } |
|
246 |
|
247 result = iFileMan->Copy(aSource, aDestination); |
|
248 } |
|
249 |
|
250 return result; |
|
251 } |
|
252 |
|
253 // ----------------------------------------------------------------------------- |
|
254 // CWmDrmAgentManager::RenameFile |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 TInt CWmDrmAgentManager::RenameFile(const TDesC& aSource, |
|
258 const TDesC& aDestination) |
|
259 { |
|
260 LOGFN( "CWmDrmAgentManager::RenameFile" ); |
|
261 TInt driveNumber = 0; |
|
262 TChar drive( aDestination[0] ); |
|
263 RFile file; |
|
264 TInt size = 0; |
|
265 TInt result = KErrNone; |
|
266 TInt r = KErrNone; |
|
267 TBool retval(EFalse); |
|
268 |
|
269 result = SetFileMan(); |
|
270 |
|
271 if( result ) |
|
272 { |
|
273 return result; |
|
274 } |
|
275 |
|
276 result = iFileMan->Rename(aSource, aDestination); |
|
277 |
|
278 // If the files are on a different drive, Rename will fail |
|
279 // Therefore we simulate the Move by doing a Copy, followed by Delete |
|
280 if ( result != KErrNone ) |
|
281 { |
|
282 // Check the destination drive letter |
|
283 result = iFs.CharToDrive(drive,driveNumber); |
|
284 |
|
285 if( result ) |
|
286 { |
|
287 return result; |
|
288 } |
|
289 |
|
290 // open the file to read the size |
|
291 result = file.Open(iFs, aSource, EFileShareReadersOrWriters|EFileRead); |
|
292 |
|
293 if( result ) |
|
294 { |
|
295 return result; |
|
296 } |
|
297 |
|
298 // read the size |
|
299 result = file.Size( size ); |
|
300 |
|
301 // close the file |
|
302 file.Close(); |
|
303 |
|
304 if( result ) |
|
305 { |
|
306 return result; |
|
307 } |
|
308 // check that the drive has enough space for the copy operation |
|
309 TRAP(r, retval = SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, |
|
310 size, |
|
311 driveNumber ) ); |
|
312 |
|
313 if( retval ) |
|
314 { |
|
315 return KErrDiskFull; |
|
316 } |
|
317 |
|
318 result = iFileMan->Copy(aSource,aDestination); |
|
319 if (result == KErrNone) |
|
320 { |
|
321 // If the copy was successful try and delete the original |
|
322 result = iFileMan->Delete(aSource); |
|
323 if (result != KErrNone) |
|
324 { |
|
325 // Delete failed so try to cleanup the destination file |
|
326 // as we're going to exit with an error |
|
327 // We can safely ignore any error from this as the previous error |
|
328 // is more important to propagate, since this is just cleanup |
|
329 iFileMan->Delete(aDestination); |
|
330 } |
|
331 } |
|
332 } |
|
333 return result; |
|
334 } |
|
335 |
|
336 |
|
337 // ----------------------------------------------------------------------------- |
|
338 // CWmDrmAgentManager::MkDir |
|
339 // ----------------------------------------------------------------------------- |
|
340 // |
|
341 TInt CWmDrmAgentManager::MkDir(const TDesC& aPath) |
|
342 { |
|
343 LOGFN( "CWmDrmAgentManager::MkDir" ); |
|
344 return iFs.MkDir( aPath ); |
|
345 } |
|
346 |
|
347 // ----------------------------------------------------------------------------- |
|
348 // CWmDrmAgentManager::MkDirAll |
|
349 // ----------------------------------------------------------------------------- |
|
350 // |
|
351 TInt CWmDrmAgentManager::MkDirAll(const TDesC& aPath) |
|
352 { |
|
353 LOGFN( "CWmDrmAgentManager::MkDirAll" ); |
|
354 return iFs.MkDirAll( aPath ); |
|
355 } |
|
356 |
|
357 // ----------------------------------------------------------------------------- |
|
358 // CWmDrmAgentManager::RmDir |
|
359 // ----------------------------------------------------------------------------- |
|
360 // |
|
361 TInt CWmDrmAgentManager::RmDir(const TDesC& aPath) |
|
362 { |
|
363 LOGFN( "CWmDrmAgentManager::RmDir" ); |
|
364 TInt result = KErrNone; |
|
365 |
|
366 result = SetFileMan(); |
|
367 |
|
368 if( result ) |
|
369 { |
|
370 return result; |
|
371 } |
|
372 |
|
373 return iFileMan->RmDir( aPath ); |
|
374 } |
|
375 |
|
376 // ----------------------------------------------------------------------------- |
|
377 // CWmDrmAgentManager::GetDir |
|
378 // ----------------------------------------------------------------------------- |
|
379 // |
|
380 TInt CWmDrmAgentManager::GetDir(const TDesC& aName, TUint aEntryAttMask, |
|
381 TUint aEntrySortKey, CDir*& aEntryList) const |
|
382 { |
|
383 LOGFN( "CWmDrmAgentManager::GetDir" ); |
|
384 return iFs.GetDir( aName, aEntryAttMask, aEntrySortKey, aEntryList ); |
|
385 } |
|
386 |
|
387 // ----------------------------------------------------------------------------- |
|
388 // CWmDrmAgentManager::GetDir |
|
389 // ----------------------------------------------------------------------------- |
|
390 // |
|
391 TInt CWmDrmAgentManager::GetDir(const TDesC& aName,TUint aEntryAttMask, |
|
392 TUint aEntrySortKey, CDir*& aEntryList,CDir*& aDirList) const |
|
393 { |
|
394 LOGFN( "CWmDrmAgentManager::GetDir (2)" ); |
|
395 return iFs.GetDir( aName, aEntryAttMask, aEntrySortKey, aEntryList, aDirList ); |
|
396 } |
|
397 |
|
398 // ----------------------------------------------------------------------------- |
|
399 // CWmDrmAgentManager::GetDir |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 TInt CWmDrmAgentManager::GetDir(const TDesC& aName, |
|
403 const TUidType& aEntryUid,TUint aEntrySortKey, |
|
404 CDir*& aFileList) const |
|
405 { |
|
406 LOGFN( "CWmDrmAgentManager::GetDir (3)" ); |
|
407 return iFs.GetDir( aName, aEntryUid, aEntrySortKey, aFileList ); |
|
408 } |
|
409 |
|
410 // ----------------------------------------------------------------------------- |
|
411 // CWmDrmAgentManager::GetAttribute |
|
412 // ----------------------------------------------------------------------------- |
|
413 // |
|
414 TInt CWmDrmAgentManager::GetAttribute(TInt aAttribute, TInt& aValue, |
|
415 const TVirtualPathPtr& aVirtualPath) |
|
416 { |
|
417 |
|
418 TInt r = KErrNone; |
|
419 TInt err = KErrNone; |
|
420 |
|
421 LOGFN( "CWmDrmAgentManager::GetAttribute" ); |
|
422 TRAP(err, r = CWmDrmAgentManager::GetAttributeCreateFileL( |
|
423 aAttribute, aValue, aVirtualPath)); |
|
424 |
|
425 if(err != KErrNone) |
|
426 { |
|
427 return err; |
|
428 } |
|
429 |
|
430 return r; |
|
431 } |
|
432 // ----------------------------------------------------------------------------- |
|
433 // CWmDrmAgentManager::GetAttributeCreateFileL |
|
434 // |
|
435 // ----------------------------------------------------------------------------- |
|
436 // |
|
437 TInt CWmDrmAgentManager::GetAttributeCreateFileL(TInt aAttribute, TInt& aValue, |
|
438 const TVirtualPathPtr& aVirtualPath) |
|
439 { |
|
440 TInt r = KErrNone; |
|
441 |
|
442 CAsf *asfFile = CAsf::NewL(aVirtualPath.URI()); |
|
443 CleanupStack::PushL(asfFile); |
|
444 r = TWmDrmAgentAttributes::GetAttributeL(asfFile, |
|
445 aAttribute, aValue, aVirtualPath); |
|
446 CleanupStack::PopAndDestroy(); |
|
447 return r; |
|
448 } |
|
449 |
|
450 // ----------------------------------------------------------------------------- |
|
451 // CWmDrmAgentManager::GetAttributeSet |
|
452 // ----------------------------------------------------------------------------- |
|
453 // |
|
454 TInt CWmDrmAgentManager::GetAttributeSet(RAttributeSet& aAttributeSet, |
|
455 const TVirtualPathPtr& aVirtualPath) |
|
456 { |
|
457 |
|
458 TInt r = KErrNone; |
|
459 TInt err = KErrNone; |
|
460 |
|
461 LOGFN( "CWmDrmAgentManager::GetAttributeSet" ); |
|
462 TRAP(err, r = CWmDrmAgentManager::GetAttributeSetCreateFileL( |
|
463 aAttributeSet, aVirtualPath)); |
|
464 |
|
465 if(err != KErrNone) |
|
466 { |
|
467 return err; |
|
468 } |
|
469 return r; |
|
470 } |
|
471 // ----------------------------------------------------------------------------- |
|
472 // CWmDrmAgentManager::GetAttributeSetCreateFileL |
|
473 // |
|
474 // ----------------------------------------------------------------------------- |
|
475 TInt CWmDrmAgentManager::GetAttributeSetCreateFileL( |
|
476 RAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath) |
|
477 { |
|
478 TInt r = KErrNone; |
|
479 |
|
480 CAsf *asfFile = CAsf::NewL(aVirtualPath.URI()); |
|
481 CleanupStack::PushL(asfFile); |
|
482 r = TWmDrmAgentAttributes::GetAttributeSetL(asfFile, |
|
483 aAttributeSet, aVirtualPath); |
|
484 CleanupStack::PopAndDestroy(); |
|
485 return r; |
|
486 } |
|
487 |
|
488 // ----------------------------------------------------------------------------- |
|
489 // CWmDrmAgentManager::GetStringAttributeSet |
|
490 // ----------------------------------------------------------------------------- |
|
491 // |
|
492 TInt CWmDrmAgentManager::GetStringAttributeSet( |
|
493 RStringAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath) |
|
494 { |
|
495 TInt r = KErrNone; |
|
496 TInt err = KErrNone; |
|
497 RFile file; |
|
498 |
|
499 LOGFN( "CWmDrmAgentManager::GetStringAttributeSet" ); |
|
500 TRAP(err, r = CWmDrmAgentManager::GetStringAttributeSetCreateFileL( |
|
501 aAttributeSet, aVirtualPath )); |
|
502 |
|
503 if(err != KErrNone) |
|
504 { |
|
505 return err; |
|
506 } |
|
507 return r; |
|
508 } |
|
509 // ----------------------------------------------------------------------------- |
|
510 // CWmDrmAgentManager::GetStringAttributeSetCreateFileL |
|
511 // |
|
512 // ----------------------------------------------------------------------------- |
|
513 // |
|
514 TInt CWmDrmAgentManager::GetStringAttributeSetCreateFileL( |
|
515 RStringAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath) |
|
516 { |
|
517 TInt r = KErrNone; |
|
518 CAsf *asfFile = CAsf::NewL(aVirtualPath.URI()); |
|
519 CleanupStack::PushL(asfFile); |
|
520 r = TWmDrmAgentAttributes::GetStringAttributeSetL( |
|
521 asfFile, aAttributeSet, aVirtualPath); |
|
522 CleanupStack::PopAndDestroy(); |
|
523 return r; |
|
524 } |
|
525 |
|
526 |
|
527 // ----------------------------------------------------------------------------- |
|
528 // CWmDrmAgentManager::GetStringAttribute |
|
529 // ----------------------------------------------------------------------------- |
|
530 // |
|
531 TInt CWmDrmAgentManager::GetStringAttribute(TInt aAttribute, TDes& aValue, |
|
532 const TVirtualPathPtr& aVirtualPath) |
|
533 { |
|
534 TInt r = KErrNone; |
|
535 TInt err = KErrNone; |
|
536 |
|
537 LOGFN( "CWmDrmAgentManager::GetStringAttribute" ); |
|
538 TRAP(err, r = CWmDrmAgentManager::GetStringAttributeCreateFileL( |
|
539 aAttribute, aValue, aVirtualPath )); |
|
540 if(err != KErrNone) |
|
541 { |
|
542 return err; |
|
543 } |
|
544 return r; |
|
545 } |
|
546 // ----------------------------------------------------------------------------- |
|
547 // CWmDrmAgentManager::GetStringAttributeCreateFileL |
|
548 // |
|
549 // ----------------------------------------------------------------------------- |
|
550 // |
|
551 TInt CWmDrmAgentManager::GetStringAttributeCreateFileL(TInt aAttribute, TDes& aValue, |
|
552 const TVirtualPathPtr& aVirtualPath) |
|
553 { |
|
554 TInt r = KErrNone; |
|
555 CAsf *asfFile = CAsf::NewL(aVirtualPath.URI()); |
|
556 CleanupStack::PushL(asfFile); |
|
557 r = TWmDrmAgentAttributes::GetStringAttributeL( |
|
558 asfFile, aAttribute, aValue, aVirtualPath); |
|
559 CleanupStack::PopAndDestroy(); |
|
560 return r; |
|
561 } |
|
562 |
|
563 // ----------------------------------------------------------------------------- |
|
564 // CWmDrmAgentManager::NotifyStatusChange |
|
565 // ----------------------------------------------------------------------------- |
|
566 // |
|
567 void CWmDrmAgentManager::NotifyStatusChange(const TDesC& , TEventMask , |
|
568 TRequestStatus& aStatus) |
|
569 { |
|
570 LOGFN( "CWmDrmAgentManager::NotifyStatusChange" ); |
|
571 TRequestStatus* ptr = &aStatus; |
|
572 User::RequestComplete(ptr, KErrCANotSupported); |
|
573 } |
|
574 |
|
575 // ----------------------------------------------------------------------------- |
|
576 // CWmDrmAgentManager::CancelNotifyStatusChange |
|
577 // |
|
578 // ----------------------------------------------------------------------------- |
|
579 // |
|
580 TInt CWmDrmAgentManager::CancelNotifyStatusChange(const TDesC& , |
|
581 TRequestStatus& ) |
|
582 { |
|
583 LOGFN( "CWmDrmAgentManager::CancelNotifyStatusChange" ); |
|
584 return KErrCANotSupported; |
|
585 } |
|
586 |
|
587 // ----------------------------------------------------------------------------- |
|
588 // CWmDrmAgentManager::SetProperty |
|
589 // ----------------------------------------------------------------------------- |
|
590 // |
|
591 TInt CWmDrmAgentManager::SetProperty(TAgentProperty /*aProperty*/, |
|
592 TInt /*aValue*/) |
|
593 { |
|
594 LOGFN( "CWmDrmAgentManager::SetProperty" ); |
|
595 return KErrCANotSupported; |
|
596 } |
|
597 |
|
598 // ----------------------------------------------------------------------------- |
|
599 // CWmDrmAgentManager::DisplayInfoL |
|
600 // ----------------------------------------------------------------------------- |
|
601 // |
|
602 void CWmDrmAgentManager::DisplayInfoL(TDisplayInfo /*aInfo*/, |
|
603 const TVirtualPathPtr& /*aVirtualPath*/) |
|
604 { |
|
605 LOGFN( "CWmDrmAgentManager::DisplayInfoL" ); |
|
606 User::Leave(KErrCANotSupported); |
|
607 } |
|
608 |
|
609 // ----------------------------------------------------------------------------- |
|
610 // CWmDrmAgentManager::IsRecognizedL |
|
611 // ----------------------------------------------------------------------------- |
|
612 // |
|
613 TBool CWmDrmAgentManager::IsRecognizedL( |
|
614 const TDesC& /*aUri*/, |
|
615 TContentShareMode /*aShareMode*/) const |
|
616 { |
|
617 LOGFN( "CWmDrmAgentManager::IsRecognizedL" ); |
|
618 return EFalse; |
|
619 } |
|
620 |
|
621 // ----------------------------------------------------------------------------- |
|
622 // CWmDrmAgentManager::IsRecognizedL |
|
623 // ----------------------------------------------------------------------------- |
|
624 // |
|
625 TBool CWmDrmAgentManager::IsRecognizedL(RFile& /*aFile*/) const |
|
626 { |
|
627 LOGFN( "CWmDrmAgentManager::IsRecognizedL (2)" ); |
|
628 return EFalse; |
|
629 } |
|
630 |
|
631 // ----------------------------------------------------------------------------- |
|
632 // CWmDrmAgentManager::RecognizeFileL |
|
633 // ----------------------------------------------------------------------------- |
|
634 // |
|
635 TBool CWmDrmAgentManager::RecognizeFileL( |
|
636 const TDesC& /*aFileName*/, |
|
637 const TDesC8& /*aBuffer*/, |
|
638 TDes8& /*aFileMimeType*/, |
|
639 TDes8& /*aContentMimeType*/) const |
|
640 { |
|
641 LOGFN( "CWmDrmAgentManager::RecognizeFileL" ); |
|
642 return EFalse; |
|
643 } |
|
644 |
|
645 |
|
646 // ----------------------------------------------------------------------------- |
|
647 // CWmDrmAgentManager::AgentSpecificCommand |
|
648 // ----------------------------------------------------------------------------- |
|
649 // |
|
650 TInt CWmDrmAgentManager::AgentSpecificCommand(TInt aCommand, |
|
651 const TDesC8& /*iInputBuffer*/, |
|
652 TDes8& /*aOutputBuffer*/ ) |
|
653 { |
|
654 TInt r = KErrCANotSupported; |
|
655 RWmDrmClient client; |
|
656 |
|
657 switch( aCommand ) |
|
658 { |
|
659 case DRM::EWmDrmDeleteRights: |
|
660 r = client.Connect(); |
|
661 if( !r ) |
|
662 { |
|
663 r = client.DeleteRights(); |
|
664 } |
|
665 client.Close(); |
|
666 break; |
|
667 default: |
|
668 break; |
|
669 } |
|
670 |
|
671 return r; |
|
672 } |
|
673 |
|
674 // ----------------------------------------------------------------------------- |
|
675 // CWmDrmAgentManager::AgentSpecificCommand |
|
676 // ----------------------------------------------------------------------------- |
|
677 // |
|
678 void CWmDrmAgentManager::AgentSpecificCommand(TInt , const TDesC8& , |
|
679 TDes8& , TRequestStatus& aStatus) |
|
680 { |
|
681 LOGFN( "CWmDrmAgentManager::AgentSpecificCommand (2)" ); |
|
682 TRequestStatus *ptr = &aStatus; |
|
683 User::RequestComplete(ptr, KErrCANotSupported); |
|
684 } |
|
685 |
|
686 // ----------------------------------------------------------------------------- |
|
687 // CWmDrmAgentManager:: |
|
688 // ----------------------------------------------------------------------------- |
|
689 // |
|
690 void CWmDrmAgentManager::DisplayManagementInfoL() |
|
691 { |
|
692 LOGFN( "CWmDrmAgentManager::DisplayManagementInfoL" ); |
|
693 User::Leave(KErrCANotSupported); |
|
694 } |
|
695 |
|
696 // ----------------------------------------------------------------------------- |
|
697 // CWmDrmAgentManager::PrepareHTTPRequestHeaders |
|
698 // ----------------------------------------------------------------------------- |
|
699 // |
|
700 void CWmDrmAgentManager::PrepareHTTPRequestHeaders(RStringPool& /*aStringPool*/, |
|
701 RHTTPHeaders& /*aRequestHeaders*/) const |
|
702 { |
|
703 LOGFN( "CWmDrmAgentManager::PrepareHTTPRequestHeaders" ); |
|
704 } |
|
705 |
|
706 // ----------------------------------------------------------------------------- |
|
707 // CWmDrmAgentManager::RenameDir |
|
708 // ----------------------------------------------------------------------------- |
|
709 // |
|
710 TInt CWmDrmAgentManager::RenameDir(const TDesC& /*aOldName*/, |
|
711 const TDesC& /*aNewName*/) |
|
712 { |
|
713 LOGFN( "CWmDrmAgentManager::RenameDir" ); |
|
714 return KErrCANotSupported; |
|
715 } |
|
716 |
|
717 // ----------------------------------------------------------------------------- |
|
718 // CWmDrmAgentManager::IsProtected |
|
719 // ----------------------------------------------------------------------------- |
|
720 // |
|
721 TBool CWmDrmAgentManager::IsProtectedL(const TDesC& aFileName) |
|
722 { |
|
723 TBool r = EFalse; |
|
724 CAsf* asf = NULL; |
|
725 LOGFN( "CWmDrmAgentManager::IsProtectedL" ); |
|
726 TRAP_IGNORE(asf = CAsf::NewL(aFileName)); |
|
727 if (asf != NULL && asf->iIsDrmProtected) |
|
728 { |
|
729 r = ETrue; |
|
730 } |
|
731 delete asf; |
|
732 return r; |
|
733 } |
|
734 |
|
735 // ----------------------------------------------------------------------------- |
|
736 // CWmDrmAgentManager::IsProtected |
|
737 // ----------------------------------------------------------------------------- |
|
738 // |
|
739 TBool CWmDrmAgentManager::IsProtectedL(RFile& aFile) |
|
740 { |
|
741 TBool r = EFalse; |
|
742 CAsf* asf = NULL; |
|
743 LOGFN( "CWmDrmAgentManager::IsProtectedL (2)" ); |
|
744 TRAP_IGNORE(asf = CAsf::NewL(aFile)); |
|
745 if (asf != NULL && asf->iIsDrmProtected) |
|
746 { |
|
747 r = ETrue; |
|
748 } |
|
749 delete asf; |
|
750 return r; |
|
751 } |
|
752 |
|
753 |
|
754 // ----------------------------------------------------------------------------- |
|
755 // CWmDrmAgentManager::SetFileMan |
|
756 // ----------------------------------------------------------------------------- |
|
757 // |
|
758 TInt CWmDrmAgentManager::SetFileMan() |
|
759 { |
|
760 TInt err = KErrNone; |
|
761 if( !iFileMan ) |
|
762 { |
|
763 TRAP(err, iFileMan = CFileMan::NewL(iFs) ); |
|
764 } |
|
765 return err; |
|
766 } |
|
767 |
|
768 // End of File |