|
1 /* |
|
2 * Copyright (c) 2002-2004 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 CProEngDrmCommonWrapper. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CProEngDrmCommonWrapper.h" |
|
22 #include <DRMCommon.h> |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CProEngDrmCommonWrapper::CProEngDrmCommonWrapper |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 CProEngDrmCommonWrapper::CProEngDrmCommonWrapper() |
|
31 { |
|
32 } |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CProEngDrmCommonWrapper::ConstructL |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 void CProEngDrmCommonWrapper::ConstructL() |
|
39 { |
|
40 iDrmCommon = DRMCommon::NewL(); |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CProEngDrmCommonWrapper::NewL |
|
45 // Two-phased constructor. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CProEngDrmCommonWrapper* CProEngDrmCommonWrapper::NewL() |
|
49 { |
|
50 CProEngDrmCommonWrapper* self = |
|
51 new ( ELeave ) CProEngDrmCommonWrapper(); |
|
52 |
|
53 CleanupStack::PushL( self ); |
|
54 self->ConstructL(); |
|
55 CleanupStack::Pop( self ); |
|
56 |
|
57 return self; |
|
58 } |
|
59 |
|
60 // Destructor |
|
61 CProEngDrmCommonWrapper::~CProEngDrmCommonWrapper() |
|
62 { |
|
63 delete iDrmCommon; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CProEngDrmCommonWrapper::IsProtected |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 TInt CProEngDrmCommonWrapper::IsProtected( const TDesC& aFileName ) |
|
71 { |
|
72 TBool result = EFalse; |
|
73 TRAP_IGNORE( result = IsProtectedL( aFileName ) ); |
|
74 return result; |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CProEngDrmCommonWrapper::IsProtectedL |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 TInt CProEngDrmCommonWrapper::IsProtectedL( const TDesC& aFileName ) |
|
82 { |
|
83 // ignore error, default is "unprotected": |
|
84 TInt isProtected( EFalse ); |
|
85 ContentAccess::TVirtualPathPtr path( aFileName, |
|
86 ContentAccess::KDefaultContentObject ); |
|
87 CData* data = CData::NewLC( path, EContentShareReadWrite ); |
|
88 TInt result = data->GetAttribute( EIsProtected, isProtected ); |
|
89 CleanupStack::PopAndDestroy(); // data |
|
90 |
|
91 return( ( result == DRMCommon::EOk ) && isProtected ); |
|
92 } |
|
93 |
|
94 // End of File |
|
95 |