|
1 /* |
|
2 * Copyright (c) 2007 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: DrmUtilityDownloadManager implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "drmutilitydownloadmanager.h" |
|
21 #include "drmutilitydmgrwrapper.h" |
|
22 |
|
23 // CONSTANTS |
|
24 _LIT( KDrmUtilityDmgrHandlerName, "\\system\\libs\\DrmUtilityDmgrWrapper.dll" ); |
|
25 |
|
26 typedef TAny* (*NewDMgrL)(); |
|
27 |
|
28 const TInt KFirstFunction( 1 ); |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CDrmUtilityDownloadManager::CDrmUtilityDownloadManager |
|
34 // C++ default constructor can NOT contain any code, that |
|
35 // might leave. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CDrmUtilityDownloadManager::CDrmUtilityDownloadManager() |
|
39 { |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CDrmUtilityDownloadManager::ConstructL |
|
44 // Symbian 2nd phase constructor can leave. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 void CDrmUtilityDownloadManager::ConstructL() |
|
48 { |
|
49 User::LeaveIfError( iDMgrDll.Load( KDrmUtilityDmgrHandlerName ) ); |
|
50 NewDMgrL createDMgr = (NewDMgrL) iDMgrDll.Lookup( KFirstFunction ); |
|
51 if ( !createDMgr ) |
|
52 { |
|
53 User::Leave( KErrGeneral ); |
|
54 } |
|
55 // Create the class, leaves in case of failure |
|
56 iDMgrHandler = (CDrmUtilityDmgrWrapper*) (*createDMgr)(); |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CDrmUtilityDownloadManager::NewL |
|
61 // Two-phased constructor. |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 CDrmUtilityDownloadManager* CDrmUtilityDownloadManager::NewL() |
|
65 { |
|
66 CDrmUtilityDownloadManager* self( |
|
67 new( ELeave ) CDrmUtilityDownloadManager() ); |
|
68 |
|
69 CleanupStack::PushL( self ); |
|
70 self->ConstructL(); |
|
71 CleanupStack::Pop(); |
|
72 |
|
73 return self; |
|
74 } |
|
75 |
|
76 // Destructor |
|
77 CDrmUtilityDownloadManager::~CDrmUtilityDownloadManager() |
|
78 { |
|
79 delete iDMgrHandler; |
|
80 iDMgrDll.Close(); |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CDrmUtilityDownloadManager::DownloadAndHandleRoapTriggerL |
|
85 // |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 void CDrmUtilityDownloadManager::DownloadAndHandleRoapTriggerL( |
|
89 const HBufC8* aUrl, CCoeEnv& aCoeEnv ) |
|
90 { |
|
91 iDMgrHandler->DownloadAndHandleRoapTriggerL( aUrl, aCoeEnv ); |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CDrmUtilityDownloadManager::DownloadAndHandleRoapTriggerL |
|
96 // |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 void CDrmUtilityDownloadManager::DownloadAndHandleRoapTriggerL( |
|
100 const HBufC8* aUrl ) |
|
101 { |
|
102 iDMgrHandler->DownloadAndHandleRoapTriggerL( aUrl ); |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // CDrmUtilityDownloadManager::GetErrorUrlL |
|
107 // |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 HBufC8* CDrmUtilityDownloadManager::GetErrorUrlL() |
|
111 { |
|
112 return iDMgrHandler->GetErrorUrlL(); |
|
113 } |
|
114 |