|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CDRMUTILITYDMGRWRAPPER_H |
|
20 #define CDRMUTILITYDMGRWRAPPER_H |
|
21 |
|
22 #include <DownloadMgrClient.h> |
|
23 #include <aknprogressdialog.h> |
|
24 #include <eikprogi.h> |
|
25 |
|
26 /** |
|
27 * Environment gate function |
|
28 * |
|
29 * @since S60 v5.0 |
|
30 * @return pointer to DMgr handler |
|
31 */ |
|
32 IMPORT_C TAny* GateFunctionDMgr(); |
|
33 |
|
34 class MDrmUtilityDmgrWrapper |
|
35 { |
|
36 |
|
37 public: |
|
38 virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) = 0; |
|
39 |
|
40 virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, |
|
41 CCoeEnv& aCoeEnv ) = 0; |
|
42 |
|
43 virtual HBufC8* GetErrorUrlL() = 0; |
|
44 |
|
45 }; |
|
46 |
|
47 /** |
|
48 * Class for downloading ROAP triggers |
|
49 * |
|
50 * @lib DrmUtilityDmgrWrapper |
|
51 * @since S60 v5.0 |
|
52 */ |
|
53 class CDrmUtilityDmgrWrapper : CBase, |
|
54 public MHttpDownloadMgrObserver, |
|
55 public MDrmUtilityDmgrWrapper, |
|
56 public MProgressDialogCallback |
|
57 { |
|
58 |
|
59 public: |
|
60 |
|
61 static CDrmUtilityDmgrWrapper* NewL(); |
|
62 |
|
63 static CDrmUtilityDmgrWrapper* NewLC(); |
|
64 |
|
65 virtual ~CDrmUtilityDmgrWrapper(); |
|
66 |
|
67 /** |
|
68 * Download a ROAP trigger from URL and handle it |
|
69 * |
|
70 * @param aUrl URL of ROAP trigger |
|
71 */ |
|
72 void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ); |
|
73 |
|
74 void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, |
|
75 CCoeEnv& aCoeEnv ); |
|
76 |
|
77 HBufC8* GetErrorUrlL(); |
|
78 |
|
79 |
|
80 // from base class MHttpDownloadMgrObserver |
|
81 |
|
82 /** |
|
83 * From MHttpDownloadMgrObserver. |
|
84 * Handle download manager events |
|
85 * |
|
86 * @param aDownload the download |
|
87 * @param aEvent the event |
|
88 */ |
|
89 void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ); |
|
90 |
|
91 public: // Call back methods of MAknProgressDialogCallback |
|
92 |
|
93 /** |
|
94 * ProgressDialog call back method. |
|
95 * Get's called when a dialog is dismissed. |
|
96 * |
|
97 * @param aButtonId ID of the button pressed |
|
98 */ |
|
99 void DialogDismissedL( TInt aButtonId ); |
|
100 |
|
101 protected: |
|
102 |
|
103 private: |
|
104 |
|
105 /** |
|
106 * C++ default constructor. |
|
107 */ |
|
108 CDrmUtilityDmgrWrapper(); |
|
109 |
|
110 void ConstructL(); |
|
111 |
|
112 /** |
|
113 * Set the browser default access point to be used |
|
114 */ |
|
115 void SetDefaultAccessPointL(); |
|
116 |
|
117 void DoDownloadAndHandleRoapTriggerL( const HBufC8* aUrl ); |
|
118 |
|
119 void ShowProgressNoteL( ); |
|
120 |
|
121 void RemoveProgressNoteL( ); |
|
122 |
|
123 void HandlePostResponseUrlL(); |
|
124 |
|
125 |
|
126 private: // data |
|
127 |
|
128 /** |
|
129 * Download manager session |
|
130 */ |
|
131 RHttpDownloadMgr iDlMgr; |
|
132 |
|
133 /** |
|
134 * Used to make downloads synchronous |
|
135 */ |
|
136 CActiveSchedulerWait iWait; |
|
137 |
|
138 /** |
|
139 * to store information on download |
|
140 */ |
|
141 TBool iDownloadSuccess; |
|
142 TBool iConnectionError; |
|
143 |
|
144 TBool iDialogDismissed; |
|
145 |
|
146 /** |
|
147 * Progess note dialog and progress info |
|
148 */ |
|
149 CAknProgressDialog* iProgressNoteDialog; // owned |
|
150 CEikProgressInfo* iProgressInfo; // not owned |
|
151 TInt iCurrentProgressValue; // owned |
|
152 TInt iProgressIncrement; // owned |
|
153 |
|
154 /** |
|
155 * Control environment |
|
156 */ |
|
157 CCoeEnv* iCoeEnv; |
|
158 |
|
159 /** |
|
160 * Is CoeEnv given |
|
161 */ |
|
162 TBool iUseCoeEnv; |
|
163 |
|
164 /** |
|
165 * Error url for ROAP temporary error |
|
166 */ |
|
167 HBufC8* iErrorUrl; |
|
168 |
|
169 /** |
|
170 * Post response url for ROAP prUrl |
|
171 */ |
|
172 HBufC8* iPostResponseUrl; |
|
173 |
|
174 }; |
|
175 |
|
176 #endif // CDRMUTILITYDMGRWRAPPER_H |