|
1 /* |
|
2 * Copyright (c) 2008 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: WMDRM DLA Default HTTP Plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <gulicon.h> |
|
20 #include <wmdrmdlauinotifier.h> |
|
21 #include "wmdrmdladefaulthttpplugin.h" |
|
22 #include "wmdrmdladefaultlicacq.h" |
|
23 #include "wmdrmdladefaultmetering.h" |
|
24 #include "wmdrmdladefaultplayready.h" |
|
25 |
|
26 #define _LOGGING_FILE L"wmdrmdladefaulthttpplugin.txt" |
|
27 #include "logfn.h" |
|
28 |
|
29 // CONSTANTS |
|
30 const TUid KWmDrmDlaDefaultUiPluginUid = { 0x20019575 }; |
|
31 |
|
32 // ======== LOCAL FUNCTIONS ======== |
|
33 |
|
34 // ======== MEMBER FUNCTIONS ======== |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // CWmDrmDlaDefaultHttpPlugin::ConstructL |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 void CWmDrmDlaDefaultHttpPlugin::ConstructL() |
|
41 { |
|
42 LOGFN( "CWmDrmDlaDefaultHttpPlugin::ConstructL" ); |
|
43 iLicenseAcquisition = CWmDrmDlaDefaultLicAcq::NewL( this ); |
|
44 iMetering = CWmDrmDlaDefaultMetering::NewL( this ); |
|
45 iPlayReady = CWmDrmDlaDefaultPlayReady::NewL( this ); |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // CWmDrmDlaDefaultHttpPlugin::CWmDrmDlaDefaultHttpPlugin |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 CWmDrmDlaDefaultHttpPlugin::CWmDrmDlaDefaultHttpPlugin() |
|
53 { |
|
54 LOGFN( "CWmDrmDlaDefaultHttpPlugin::CWmDrmDlaDefaultHttpPlugin" ); |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // CWmDrmDlaDefaultHttpPlugin::NewL |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 CWmDrmDlaDefaultHttpPlugin* CWmDrmDlaDefaultHttpPlugin::NewL() |
|
62 { |
|
63 LOGFN( "CWmDrmDlaDefaultHttpPlugin::NewL" ); |
|
64 CWmDrmDlaDefaultHttpPlugin* self = |
|
65 new( ELeave ) CWmDrmDlaDefaultHttpPlugin; |
|
66 CleanupStack::PushL( self ); |
|
67 self->ConstructL(); |
|
68 CleanupStack::Pop( self ); |
|
69 return self; |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // CWmDrmDlaDefaultHttpPlugin::~CWmDrmDlaDefaultHttpPlugin |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 CWmDrmDlaDefaultHttpPlugin::~CWmDrmDlaDefaultHttpPlugin() |
|
77 { |
|
78 LOGFN( "CWmDrmDlaDefaultHttpPlugin::~CWmDrmDlaDefaultHttpPlugin" ); |
|
79 delete iLicenseAcquisition; |
|
80 delete iMetering; |
|
81 delete iPlayReady; |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // CWmDrmDlaDefaultHttpPlugin::ServiceIcon |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 CGulIcon* CWmDrmDlaDefaultHttpPlugin::ServiceIcon() |
|
89 { |
|
90 LOGFN( "CWmDrmDlaDefaultHttpPlugin::ServiceIcon" ); |
|
91 return NULL; |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // CWmDrmDlaDefaultHttpPlugin::SupportedFileL |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 TBool CWmDrmDlaDefaultHttpPlugin::SupportedFileL( |
|
99 const RFile& aFile, |
|
100 CWmDrmDlaUiNotifier*& aUiNotifier) |
|
101 { |
|
102 LOGFN( "CWmDrmDlaDefaultHttpPlugin::SupportedFileL" ); |
|
103 return iLicenseAcquisition->SupportedFileL( aFile, aUiNotifier ); |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // CWmDrmDlaDefaultHttpPlugin::SupportedDrmHeaderL |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 TBool CWmDrmDlaDefaultHttpPlugin::SupportedDrmHeaderL( |
|
111 const TDesC8& aHeader, |
|
112 CWmDrmDlaUiNotifier*& aUiNotifier ) |
|
113 { |
|
114 LOGFN( "CWmDrmDlaDefaultHttpPlugin::SupportedDrmHeaderL" ); |
|
115 return iLicenseAcquisition->SupportedDrmHeaderL( aHeader, aUiNotifier ); |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // CWmDrmDlaDefaultHttpPlugin::SupportedMeteringCertificateL |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 TBool CWmDrmDlaDefaultHttpPlugin::SupportedMeteringCertificateL( |
|
123 const TDesC8& aCertificate, |
|
124 CWmDrmDlaUiNotifier*& aUiNotifier ) |
|
125 { |
|
126 LOGFN( "CWmDrmDlaDefaultHttpPlugin::SupportedMeteringCertificateL" ); |
|
127 return iMetering->SupportedMeteringCertificateL( aCertificate, |
|
128 aUiNotifier ); |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // CWmDrmDlaDefaultHttpPlugin::SupportedInitiatorL |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 TBool CWmDrmDlaDefaultHttpPlugin::SupportedInitiatorL( |
|
136 const TDesC8& aInitiator, |
|
137 CWmDrmDlaUiNotifier*& aUiNotifier ) |
|
138 { |
|
139 LOGFN( "CWmDrmDlaDefaultHttpPlugin::SupportedInitiatorL" ); |
|
140 return iPlayReady->SupportedInitiatorL( aInitiator, aUiNotifier ); |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // CWmDrmDlaDefaultHttpPlugin::SilentL |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 TBool CWmDrmDlaDefaultHttpPlugin::SilentL( |
|
148 const RFile& aFile ) |
|
149 { |
|
150 LOGFN( "CWmDrmDlaDefaultHttpPlugin::SilentL" ); |
|
151 return iLicenseAcquisition->SilentL( aFile ); |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------------------------- |
|
155 // CWmDrmDlaDefaultHttpPlugin::ProcessDrmHeaderL |
|
156 // --------------------------------------------------------------------------- |
|
157 // |
|
158 void CWmDrmDlaDefaultHttpPlugin::ProcessDrmHeaderL( |
|
159 const TDesC8& aDrmHeader ) |
|
160 { |
|
161 LOGFN( "CWmDrmDlaDefaultHttpPlugin::ProcessDrmHeaderL" ); |
|
162 iLicenseAcquisition->ProcessDrmHeaderL( aDrmHeader ); |
|
163 } |
|
164 |
|
165 // --------------------------------------------------------------------------- |
|
166 // CWmDrmDlaDefaultHttpPlugin::ProcessInitiatorL |
|
167 // --------------------------------------------------------------------------- |
|
168 // |
|
169 void CWmDrmDlaDefaultHttpPlugin::ProcessInitiatorL( |
|
170 const TDesC8& aInitiator ) |
|
171 { |
|
172 LOGFN( "CWmDrmDlaDefaultHttpPlugin::ProcessInitiatorL" ); |
|
173 iPlayReady->ProcessInitiatorL( aInitiator ); |
|
174 } |
|
175 |
|
176 // --------------------------------------------------------------------------- |
|
177 // CWmDrmDlaDefaultHttpPlugin::AcquireLicense |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 void CWmDrmDlaDefaultHttpPlugin::AcquireLicense( |
|
181 const TDesC8& aLicenseChallenge, |
|
182 HBufC* aLicenseServerUrl, |
|
183 TRequestStatus& aStatus ) |
|
184 { |
|
185 LOGFN( "CWmDrmDlaDefaultHttpPlugin::AcquireLicense" ); |
|
186 iLicenseAcquisition->AcquireLicense( aLicenseChallenge, |
|
187 aLicenseServerUrl, |
|
188 aStatus ); |
|
189 } |
|
190 |
|
191 // --------------------------------------------------------------------------- |
|
192 // CWmDrmDlaDefaultHttpPlugin::GetLicenseResponseL |
|
193 // --------------------------------------------------------------------------- |
|
194 // |
|
195 HBufC8* CWmDrmDlaDefaultHttpPlugin::GetLicenseResponseL() |
|
196 { |
|
197 LOGFN( "CWmDrmDlaDefaultHttpPlugin::GetLicenseResponseL" ); |
|
198 return iLicenseAcquisition->GetLicenseResponseL(); |
|
199 } |
|
200 |
|
201 // --------------------------------------------------------------------------- |
|
202 // CWmDrmDlaDefaultHttpPlugin::SendLicenseStorageStatus |
|
203 // --------------------------------------------------------------------------- |
|
204 // |
|
205 void CWmDrmDlaDefaultHttpPlugin::SendLicenseStorageStatus( |
|
206 HBufC8* aTid, |
|
207 const TDesC& aUrl, |
|
208 TInt aError, |
|
209 TRequestStatus& aStatus ) |
|
210 { |
|
211 LOGFN( "CWmDrmDlaDefaultHttpPlugin::SendLicenseStorageStatus" ); |
|
212 iLicenseAcquisition->SendLicenseStorageStatus( aTid, |
|
213 aUrl, |
|
214 aError, |
|
215 aStatus ); |
|
216 } |
|
217 |
|
218 // --------------------------------------------------------------------------- |
|
219 // CWmDrmDlaDefaultHttpPlugin::SendDrmHeaderError |
|
220 // --------------------------------------------------------------------------- |
|
221 // |
|
222 void CWmDrmDlaDefaultHttpPlugin::SendDrmHeaderError( |
|
223 const TDesC& aErrorUrl, |
|
224 TInt aError, |
|
225 TRequestStatus& aStatus ) |
|
226 { |
|
227 LOGFN( "CWmDrmDlaDefaultHttpPlugin::SendDrmHeaderError" ); |
|
228 iLicenseAcquisition->SendDrmHeaderError( aErrorUrl, aError, aStatus ); |
|
229 } |
|
230 |
|
231 // --------------------------------------------------------------------------- |
|
232 // CWmDrmDlaDefaultHttpPlugin::GetContentUrlL |
|
233 // --------------------------------------------------------------------------- |
|
234 // |
|
235 HBufC* CWmDrmDlaDefaultHttpPlugin::GetContentUrlL() |
|
236 { |
|
237 LOGFN( "CWmDrmDlaDefaultHttpPlugin::GetContentUrlL" ); |
|
238 return iLicenseAcquisition->GetContentUrlL(); |
|
239 } |
|
240 |
|
241 // --------------------------------------------------------------------------- |
|
242 // CWmDrmDlaDefaultHttpPlugin::GetHtmlDataL |
|
243 // --------------------------------------------------------------------------- |
|
244 // |
|
245 HBufC* CWmDrmDlaDefaultHttpPlugin::GetHtmlDataL() |
|
246 { |
|
247 LOGFN( "CWmDrmDlaDefaultHttpPlugin::GetHtmlDataL" ); |
|
248 return iLicenseAcquisition->GetHtmlDataL(); |
|
249 } |
|
250 |
|
251 // --------------------------------------------------------------------------- |
|
252 // CWmDrmDlaDefaultHttpPlugin::CancelLicenseAcquisition |
|
253 // --------------------------------------------------------------------------- |
|
254 // |
|
255 void CWmDrmDlaDefaultHttpPlugin::CancelLicenseAcquisition() |
|
256 { |
|
257 LOGFN( "CWmDrmDlaDefaultHttpPlugin::CancelLicenseAcquisition" ); |
|
258 iLicenseAcquisition->CancelLicenseAcquisition(); |
|
259 } |
|
260 |
|
261 // --------------------------------------------------------------------------- |
|
262 // CWmDrmDlaDefaultHttpPlugin::ProcessMeteringChallenge |
|
263 // --------------------------------------------------------------------------- |
|
264 // |
|
265 void CWmDrmDlaDefaultHttpPlugin::ProcessMeteringChallenge( |
|
266 const TDesC8& aMeteringChallenge, |
|
267 const TDesC& aUrl, |
|
268 TRequestStatus& aStatus ) |
|
269 { |
|
270 LOGFN( "CWmDrmDlaDefaultHttpPlugin::ProcessMeteringChallenge" ); |
|
271 iMetering->ProcessMeteringChallenge( aMeteringChallenge, aUrl, aStatus ); |
|
272 } |
|
273 |
|
274 // --------------------------------------------------------------------------- |
|
275 // CWmDrmDlaDefaultHttpPlugin::GetMeteringResponse |
|
276 // --------------------------------------------------------------------------- |
|
277 // |
|
278 void CWmDrmDlaDefaultHttpPlugin::GetMeteringResponse( |
|
279 HBufC8*& aResponse, |
|
280 TRequestStatus& aStatus ) |
|
281 { |
|
282 LOGFN( "CWmDrmDlaDefaultHttpPlugin::GetMeteringResponse" ); |
|
283 iMetering->GetMeteringResponse( aResponse, aStatus ); |
|
284 } |
|
285 |
|
286 // --------------------------------------------------------------------------- |
|
287 // CWmDrmDlaDefaultHttpPlugin::MeteringFinished |
|
288 // --------------------------------------------------------------------------- |
|
289 // |
|
290 void CWmDrmDlaDefaultHttpPlugin::MeteringFinished() |
|
291 { |
|
292 LOGFN( "CWmDrmDlaDefaultHttpPlugin::MeteringFinished" ); |
|
293 iMetering->MeteringFinished(); |
|
294 } |
|
295 |
|
296 // --------------------------------------------------------------------------- |
|
297 // CWmDrmDlaDefaultHttpPlugin::CancelMetering |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 void CWmDrmDlaDefaultHttpPlugin::CancelMetering() |
|
301 { |
|
302 LOGFN( "CWmDrmDlaDefaultHttpPlugin::CancelMetering" ); |
|
303 iMetering->CancelMetering(); |
|
304 } |
|
305 |
|
306 // --------------------------------------------------------------------------- |
|
307 // CWmDrmDlaDefaultHttpPlugin::ProcessJoinDomainChallenge |
|
308 // --------------------------------------------------------------------------- |
|
309 // |
|
310 void CWmDrmDlaDefaultHttpPlugin::ProcessJoinDomainChallenge( |
|
311 const TDesC8& aJoinDomainChallenge, |
|
312 const TDesC& aUrl, |
|
313 TRequestStatus& aStatus ) |
|
314 { |
|
315 LOGFN( "CWmDrmDlaDefaultHttpPlugin::ProcessJoinDomainChallenge" ); |
|
316 iPlayReady->ProcessJoinDomainChallenge( aJoinDomainChallenge, |
|
317 aUrl, |
|
318 aStatus ); |
|
319 } |
|
320 |
|
321 // --------------------------------------------------------------------------- |
|
322 // CWmDrmDlaDefaultHttpPlugin::ProcessLeaveDomainChallenge |
|
323 // --------------------------------------------------------------------------- |
|
324 // |
|
325 void CWmDrmDlaDefaultHttpPlugin::ProcessLeaveDomainChallenge( |
|
326 const TDesC8& aLeaveDomainChallenge, |
|
327 const TDesC& aUrl, |
|
328 TRequestStatus& aStatus ) |
|
329 { |
|
330 LOGFN( "CWmDrmDlaDefaultHttpPlugin::ProcessLeaveDomainChallenge" ); |
|
331 iPlayReady->ProcessLeaveDomainChallenge( aLeaveDomainChallenge, |
|
332 aUrl, |
|
333 aStatus ); |
|
334 } |
|
335 |
|
336 // --------------------------------------------------------------------------- |
|
337 // CWmDrmDlaDefaultHttpPlugin::SetIapId |
|
338 // --------------------------------------------------------------------------- |
|
339 // |
|
340 void CWmDrmDlaDefaultHttpPlugin::SetIapId( TInt aIapId ) |
|
341 { |
|
342 LOGFN( "CWmDrmDlaDefaultHttpPlugin::SetIapId" ); |
|
343 iLicenseAcquisition->SetIapId( aIapId ); |
|
344 iMetering->SetIapId( aIapId ); |
|
345 iPlayReady->SetIapId( aIapId ); |
|
346 } |
|
347 |
|
348 // --------------------------------------------------------------------------- |
|
349 // CWmDrmDlaDefaultHttpPlugin::InitializeUiNotifierL |
|
350 // --------------------------------------------------------------------------- |
|
351 // |
|
352 void CWmDrmDlaDefaultHttpPlugin::InitializeUiNotifierL() |
|
353 { |
|
354 LOGFN( "CWmDrmDlaDefaultHttpPlugin::InitializeUiNotifierL" ); |
|
355 //Tries to initialize UiNotifier. If UiNotifier can't be created or |
|
356 //initialization fails, then leaves with error code, won't take ownership |
|
357 //of the notifier |
|
358 iUiNotifier = NULL; |
|
359 iUiNotifier = CWmDrmDlaUiNotifier::NewL(); |
|
360 TRAPD( err, iUiNotifier->InitializeL( KWmDrmDlaDefaultUiPluginUid ) ); |
|
361 if ( err ) |
|
362 { |
|
363 delete iUiNotifier; |
|
364 iUiNotifier = NULL; |
|
365 User::Leave( err ); |
|
366 } |
|
367 } |
|
368 |
|
369 // --------------------------------------------------------------------------- |
|
370 // CWmDrmDlaDefaultHttpPlugin::UiNotifier |
|
371 // --------------------------------------------------------------------------- |
|
372 // |
|
373 CWmDrmDlaUiNotifier* CWmDrmDlaDefaultHttpPlugin::UiNotifier() |
|
374 { |
|
375 return iUiNotifier; |
|
376 } |
|
377 |
|
378 // --------------------------------------------------------------------------- |
|
379 // CWmDrmDlaDefaultHttpPlugin::Supported |
|
380 // --------------------------------------------------------------------------- |
|
381 // |
|
382 TBool CWmDrmDlaDefaultHttpPlugin::Supported( |
|
383 const TDesC8& aString, |
|
384 const TDesC8& aIdentifier) |
|
385 { |
|
386 LOGFN( "CWmDrmDlaDefaultHttpPlugin::Supported" ); |
|
387 TBool supported( EFalse ); |
|
388 if ( aString.FindF( aIdentifier ) != KErrNotFound ) |
|
389 { |
|
390 supported = ETrue; |
|
391 } |
|
392 LOG2( "supported: %d", supported ); |
|
393 return supported; |
|
394 } |