230 |
230 |
231 // --------------------------------------------------------------------------- |
231 // --------------------------------------------------------------------------- |
232 // CWmDrmDlaBrowserView::NetworkConnectionNeededL |
232 // CWmDrmDlaBrowserView::NetworkConnectionNeededL |
233 // --------------------------------------------------------------------------- |
233 // --------------------------------------------------------------------------- |
234 // |
234 // |
235 void CWmDrmDlaBrowserView::NetworkConnectionNeededL( |
235 void CWmDrmDlaBrowserView::NetworkConnectionNeededL( |
236 TInt* aConnectionPtr, |
236 TInt* aConnectionPtr, |
237 TInt* aSockSvrHandle, |
237 TInt* aSockSvrHandle, |
238 TBool* aNewConn, |
238 TBool* aNewConn, |
239 TApBearerType* aBearerType ) |
239 TApBearerType* aBearerType ) |
240 { |
240 { |
241 TInt ret( 0 ); |
241 TInt ret( 0 ); |
242 // If not connected, try to start a new connection |
242 // If not connected, try to start a new connection |
243 if ( !iConMgr->Connected() ) |
243 if ( !iConMgr->Connected() ) |
244 { |
244 { |
245 iConMgr->SetRequestedAP( iIap ); |
245 iConMgr->SetRequestedAP( iIap ); |
246 ret = iConMgr->StartConnectionL( ETrue ); |
246 ret = iConMgr->StartConnectionL( ETrue ); |
247 } |
247 } |
248 |
248 |
249 // If connected, return needed info to framework |
249 // If connected, return needed info to framework |
250 if ( !ret ) |
250 if ( !ret ) |
251 { |
251 { |
252 *aConnectionPtr = reinterpret_cast<TInt>(&iConMgr->Connection() ); |
252 *aConnectionPtr = reinterpret_cast<TInt>(&iConMgr->Connection() ); |
253 *aSockSvrHandle = iConMgr->SocketServer().Handle(); |
253 *aSockSvrHandle = iConMgr->SocketServer().Handle(); |
254 *aNewConn = EFalse; |
254 *aNewConn = EFalse; |
255 *aBearerType = EApBearerTypeAllBearers; |
255 *aBearerType = EApBearerTypeAllBearers; |
256 } |
256 } |
257 else |
257 else |
258 { |
258 { |
259 User::Leave( KErrCancel ); |
259 User::Leave( KErrCancel ); |
260 } |
260 } |
261 } |
261 } |
262 |
262 |
263 // --------------------------------------------------------------------------- |
263 // --------------------------------------------------------------------------- |
264 // CWmDrmDlaBrowserView::HandleRequestL |
264 // CWmDrmDlaBrowserView::HandleRequestL |
265 // --------------------------------------------------------------------------- |
265 // --------------------------------------------------------------------------- |
266 // |
266 // |
267 TBool CWmDrmDlaBrowserView::HandleRequestL( |
267 TBool CWmDrmDlaBrowserView::HandleRequestL( |
268 RArray<TUint>* /*aTypeArray*/, |
268 RArray<TUint>* /*aTypeArray*/, |
269 CDesCArrayFlat* /*aDesArray*/ ) |
269 CDesCArrayFlat* /*aDesArray*/ ) |
270 { |
270 { |
271 return EFalse; |
271 return EFalse; |
272 } |
272 } |
273 |
273 |
274 // --------------------------------------------------------------------------- |
274 // --------------------------------------------------------------------------- |
275 // CWmDrmDlaBrowserView::HandleDownloadL |
275 // CWmDrmDlaBrowserView::HandleDownloadL |
276 // --------------------------------------------------------------------------- |
276 // --------------------------------------------------------------------------- |
277 // |
277 // |
278 TBool CWmDrmDlaBrowserView::HandleDownloadL( |
278 TBool CWmDrmDlaBrowserView::HandleDownloadL( |
279 RArray<TUint>* aTypeArray, |
279 RArray<TUint>* aTypeArray, |
280 CDesCArrayFlat* aDesArray ) |
280 CDesCArrayFlat* aDesArray ) |
281 { |
281 { |
282 //Check that content type and local file name exists |
282 //Check that content type and local file name exists |
283 //There must be both, because download manager downloads POST-content |
283 //There must be both, because download manager downloads POST-content |
284 //in advance calling this function |
284 //in advance calling this function |
285 TInt contentTypeIndex( aTypeArray->Find( EParamReceivedContentType ) ); |
285 TInt contentTypeIndex( aTypeArray->Find( EParamReceivedContentType ) ); |
286 TInt fileNameIndex( aTypeArray->Find( EParamLocalFileName ) ); |
286 TInt fileNameIndex( aTypeArray->Find( EParamLocalFileName ) ); |
287 if ( contentTypeIndex != KErrNotFound && |
287 if ( contentTypeIndex != KErrNotFound && |
288 fileNameIndex != KErrNotFound && |
288 fileNameIndex != KErrNotFound && |
289 contentTypeIndex < aDesArray->Count() && |
289 contentTypeIndex < aDesArray->Count() && |
290 fileNameIndex < aDesArray->Count() ) |
290 fileNameIndex < aDesArray->Count() ) |
291 { |
291 { |
292 //Check that the downloaded content is license response |
292 //Check that the downloaded content is license response |
293 TPtrC16 dataTypePtr( (*aDesArray)[contentTypeIndex] ); |
293 TPtrC16 dataTypePtr( (*aDesArray)[contentTypeIndex] ); |
294 if ( dataTypePtr.CompareF( KDataTypeLicenseResponse ) == 0 ) |
294 if ( dataTypePtr.CompareF( KDataTypeLicenseResponse ) == 0 ) |
295 { |
295 { |
296 //Get the path to the license response, |
296 //Get the path to the license response, |
297 //read the response, delete the file and |
297 //read the response, delete the file and |
298 //make a license received - callback |
298 //make a license received - callback |
299 TPtrC16 filePathPtr( (*aDesArray)[fileNameIndex] ); |
299 TPtrC16 filePathPtr( (*aDesArray)[fileNameIndex] ); |
300 RFs fs; |
300 RFs fs; |
301 User::LeaveIfError( fs.Connect() ); |
301 User::LeaveIfError( fs.Connect() ); |
302 CleanupClosePushL( fs ); |
302 CleanupClosePushL( fs ); |