204 |
202 |
205 iNeedToNotifyNetworkState = EFalse; |
203 iNeedToNotifyNetworkState = EFalse; |
206 // determine initial widget online/offline network state |
204 // determine initial widget online/offline network state |
207 DetermineNetworkState(); |
205 DetermineNetworkState(); |
208 iAsyncCallBack = new (ELeave) CAsyncCallBack(TCallBack(DeleteItself,this),CActive::EPriorityUserInput); |
206 iAsyncCallBack = new (ELeave) CAsyncCallBack(TCallBack(DeleteItself,this),CActive::EPriorityUserInput); |
209 #ifdef BRDO_OCC_ENABLED_FF |
|
210 iConnStageNotifier = CConnectionStageNotifierWCB::NewL(); |
|
211 //this is required, browser's connection oberver should be hit first. (incase of netscape plgins, transactions will be closed.) |
|
212 iConnStageNotifier->SetPriority(CActive::EPriorityHigh); |
|
213 iRetryConnectivity = CPeriodic::NewL(CActive::EPriorityStandard); |
|
214 #endif |
|
215 } |
207 } |
216 |
208 |
217 // ----------------------------------------------------------------------------- |
209 // ----------------------------------------------------------------------------- |
218 // CWidgetUiWindow::~CWidgetUiWindow() |
210 // CWidgetUiWindow::~CWidgetUiWindow() |
219 // Destructor |
211 // Destructor |
229 if (iEngine && iWidgetUiObserver) |
221 if (iEngine && iWidgetUiObserver) |
230 { |
222 { |
231 iEngine->RemoveLoadEventObserver( iWidgetUiObserver ); |
223 iEngine->RemoveLoadEventObserver( iWidgetUiObserver ); |
232 iEngine->RemoveStateChangeObserver( iWindowManager.View() ); |
224 iEngine->RemoveStateChangeObserver( iWindowManager.View() ); |
233 } |
225 } |
234 #ifdef BRDO_OCC_ENABLED_FF |
|
235 if ( iRetryConnectivity) |
|
236 { |
|
237 iRetryConnectivity->Cancel(); |
|
238 delete iRetryConnectivity; |
|
239 iRetryConnectivity = NULL; |
|
240 } |
|
241 #endif |
|
242 delete iEngine; |
226 delete iEngine; |
243 delete iWidgetUiObserver; |
227 delete iWidgetUiObserver; |
244 delete iUrl; |
228 delete iUrl; |
245 delete iWidgetPath; |
229 delete iWidgetPath; |
246 delete iWidgetBundleId; |
230 delete iWidgetBundleId; |
1333 User::Exit(KErrNone); |
1318 User::Exit(KErrNone); |
1334 return 0; |
1319 return 0; |
1335 } |
1320 } |
1336 |
1321 |
1337 #ifdef BRDO_OCC_ENABLED_FF |
1322 #ifdef BRDO_OCC_ENABLED_FF |
1338 // ----------------------------------------------------------------------------- |
|
1339 // CWidgetUiWindow::ConnectionStageAchievedL() |
|
1340 // ----------------------------------------------------------------------------- |
|
1341 // |
|
1342 void CWidgetUiWindow::ConnectionStageAchievedL() |
|
1343 { |
|
1344 iWindowManager.GetConnection()->Disconnect(); |
|
1345 |
|
1346 TNifProgressBuf buf = iConnStageNotifier->GetProgressBuffer(); |
|
1347 if( buf().iError == KErrDisconnected ) |
|
1348 { |
|
1349 TRAP_IGNORE( Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1350 SetRetryFlag(ETrue); |
|
1351 |
|
1352 TRAP_IGNORE( Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelQueuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1353 |
|
1354 if( iRetryConnectivity && iRetryConnectivity->IsActive()) |
|
1355 { |
|
1356 iRetryConnectivity->Cancel(); |
|
1357 } |
|
1358 iRetryConnectivity->Start(KRetryConnectivityTimeout, 0,TCallBack(RetryConnectivity,this)); |
|
1359 } |
|
1360 else |
|
1361 { |
|
1362 TRAP_IGNORE( Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1363 } |
|
1364 } |
|
1365 |
|
1366 void CWidgetUiWindow::ConnNeededStatusL( TInt aErr ) |
|
1367 { |
|
1368 StopConnectionObserving(); //Need to stop the connection observer first |
|
1369 |
|
1370 |
|
1371 if ( !iConnStageNotifier->IsActive() ) |
|
1372 { |
|
1373 TName* connectionName = iWindowManager.GetConnection()->ConnectionNameL(); |
|
1374 CleanupStack::PushL( connectionName ); |
|
1375 |
|
1376 iConnStageNotifier->StartNotificationL(connectionName, KLinkLayerClosed, this); |
|
1377 |
|
1378 CleanupStack::PopAndDestroy(); //connectionName |
|
1379 } |
|
1380 } |
|
1381 void CWidgetUiWindow::StopConnectionObserving() |
|
1382 { |
|
1383 |
|
1384 if ( iConnStageNotifier ) |
|
1385 { |
|
1386 iConnStageNotifier->Cancel(); |
|
1387 } |
|
1388 } |
|
1389 |
|
1390 // ----------------------------------------------------------------------------- |
|
1391 // CWidgetUiWindow::SetRetryFlag |
|
1392 // ----------------------------------------------------------------------------- |
|
1393 // |
|
1394 void CWidgetUiWindow::SetRetryFlag(TBool flag) |
|
1395 { |
|
1396 reConnectivityFlag = flag; |
|
1397 } |
|
1398 // ----------------------------------------------------------------------------- |
|
1399 // CWidgetUiWindow::RetryConnectivity |
|
1400 // ----------------------------------------------------------------------------- |
|
1401 // |
|
1402 TInt CWidgetUiWindow::RetryConnectivity(TAny* aWidgetUiWindow) |
|
1403 { |
|
1404 |
|
1405 TInt err = ((CWidgetUiWindow*)aWidgetUiWindow)->RetryInternetConnection(); |
|
1406 return err; |
|
1407 } |
|
1408 TInt CWidgetUiWindow::RetryInternetConnection() |
|
1409 { |
|
1410 //First cancel the timer |
|
1411 if ( iRetryConnectivity && iRetryConnectivity->IsActive() ) |
|
1412 { |
|
1413 iRetryConnectivity->Cancel(); |
|
1414 } |
|
1415 TInt err = KErrNone; |
|
1416 if ( !iWindowManager.GetConnection()->Connected() ) |
|
1417 { |
|
1418 TRAP_IGNORE( err = iWindowManager.GetConnection()->StartConnectionL( ETrue ) ); |
|
1419 } |
|
1420 if( err == KErrNone ) |
|
1421 { |
|
1422 |
|
1423 TRAP_IGNORE( Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandUnSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1424 SetRetryFlag(EFalse); |
|
1425 |
|
1426 TRAP_IGNORE(ConnNeededStatusL(err)); //Start the observer again |
|
1427 TRAP_IGNORE( Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandRetryTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1428 } |
|
1429 else |
|
1430 { |
|
1431 TRAP_IGNORE( Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandUnSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1432 SetRetryFlag(EFalse); |
|
1433 TRAP_IGNORE(Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandClearQuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1434 } |
|
1435 |
|
1436 return err; |
|
1437 } |
|
1438 // ----------------------------------------------------------------------------- |
|
1439 // CWidgetUiWindow::GetRetryFlag |
|
1440 // ----------------------------------------------------------------------------- |
|
1441 // |
|
1442 TBool CWidgetUiWindow::GetRetryFlag() |
|
1443 { |
|
1444 return reConnectivityFlag; |
|
1445 } |
|
1446 |
|
1447 void CWidgetUiWindow::CancelAllDialogs() |
1323 void CWidgetUiWindow::CancelAllDialogs() |
1448 { |
1324 { |
1449 if( iDialogsProvider) |
1325 if( iDialogsProvider) |
1450 { |
1326 { |
1451 iDialogsProvider->CancelAll(); |
1327 iDialogsProvider->CancelAll(); |