65
|
1 |
/*
|
|
2 |
* Copyright (c) 2004 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 the License "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: Handle special load events such as network connection,
|
|
15 |
* deal with non-http or non-html requests
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
#include "BrowserLoadObserver.h"
|
|
23 |
#include "ApiProvider.h"
|
|
24 |
#include "Display.h"
|
|
25 |
#include "BrowserContentView.h"
|
|
26 |
#include "CommonConstants.h"
|
|
27 |
#include "BrowserAppUi.h"
|
|
28 |
#include "logger.h"
|
|
29 |
#include "BrowserWindow.h"
|
|
30 |
#include "BrowserWindowManager.h"
|
|
31 |
#include "BrowserDialogsProviderProxy.h"
|
|
32 |
|
|
33 |
#include <FeatMgr.h>
|
|
34 |
#include <mconnection.h>
|
|
35 |
#include <browserdialogsprovider.h>
|
|
36 |
|
|
37 |
#ifdef I__LOG_EVENT_TIME
|
|
38 |
// defines a local timer with name 'localTime'
|
|
39 |
#define START_TIMER( localTime ) TTime localTime; localTime.HomeTime();
|
|
40 |
|
|
41 |
// count the elapsed time based on timer 'localTime'
|
|
42 |
// and increment number of timers called ( numOfTimer )
|
|
43 |
#define STOP_TIMER( localTime, numOfTimer ) \
|
|
44 |
TTime locTime__a; locTime__a.HomeTime(); \
|
|
45 |
TInt64 updateTime = locTime__a.MicroSecondsFrom( localTime ).Int64(); \
|
|
46 |
LOG_WRITE_FORMAT( "Update time: %d", updateTime ); \
|
|
47 |
++numOfTimer; \
|
|
48 |
CBrowserLoadObserver::iTotalUpdateTime += updateTime;
|
|
49 |
#else // I__LOG_EVENT_TIME
|
|
50 |
// empty macros
|
|
51 |
#define START_TIMER( a )
|
|
52 |
#define STOP_TIMER( a, b )
|
|
53 |
#endif // I__LOG_EVENT_TIME
|
|
54 |
|
|
55 |
// ---------------------------------------------------------
|
|
56 |
// CBrowserLoadObserver::NewL()
|
|
57 |
// ---------------------------------------------------------
|
|
58 |
//
|
|
59 |
CBrowserLoadObserver* CBrowserLoadObserver::NewL(
|
|
60 |
MApiProvider& aApiProvider,
|
|
61 |
CBrowserContentView& aContentView,
|
|
62 |
CBrowserWindow& aWindow )
|
|
63 |
{
|
|
64 |
CBrowserLoadObserver* self =
|
|
65 |
new (ELeave) CBrowserLoadObserver( aApiProvider, aContentView, aWindow );
|
|
66 |
CleanupStack::PushL( self );
|
|
67 |
self->ConstructL( );
|
|
68 |
CleanupStack::Pop(); // self
|
|
69 |
return self;
|
|
70 |
}
|
|
71 |
|
|
72 |
// ---------------------------------------------------------
|
|
73 |
// CBrowserLoadObserver::~CBrowserLoadObserver()
|
|
74 |
// ---------------------------------------------------------
|
|
75 |
//
|
|
76 |
CBrowserLoadObserver::~CBrowserLoadObserver()
|
|
77 |
{
|
|
78 |
// iApiProvider, iContentView, iWindow not owned by CBRowserLoadObserver.
|
|
79 |
// invalidate pointer for a cleaner/clearer destruction
|
|
80 |
iApiProvider = NULL;
|
|
81 |
iContentView = NULL;
|
|
82 |
iWindow = NULL;
|
|
83 |
}
|
|
84 |
|
|
85 |
// ----------------------------------------------------------------------------
|
|
86 |
// CBrowserLoadObserver::HandleBrowserLoadEventL()
|
|
87 |
// ----------------------------------------------------------------------------
|
|
88 |
//
|
|
89 |
void CBrowserLoadObserver::HandleBrowserLoadEventL(
|
|
90 |
TBrCtlDefs::TBrCtlLoadEvent aLoadEvent,
|
|
91 |
TUint aSize,
|
|
92 |
TUint16 aTransactionId)
|
|
93 |
{
|
|
94 |
LOG_ENTERFN("CBrowserLoadObserver::HandleBrowserLoadEventL");
|
|
95 |
LOG_WRITE_FORMAT(" LoadEvent: %d", aLoadEvent );
|
|
96 |
LOG_WRITE_FORMAT(" Size: %d", aSize );
|
|
97 |
LOG_WRITE_FORMAT(" TrId: %d", aTransactionId );
|
|
98 |
LOG_WRITE_FORMAT(" LoadState: %d", iLoadState );
|
|
99 |
LOG_WRITE_FORMAT(" LoadType: %d", iLoadUrlType );
|
|
100 |
if( aLoadEvent == TBrCtlDefs::EEventNewContentDisplayed )
|
|
101 |
{
|
|
102 |
iWindow->ResetPageOverviewLocalSettingL();
|
|
103 |
iWindow->SetImagesLoaded(EFalse);
|
|
104 |
}
|
|
105 |
HandleLoadEventOtherL( aLoadEvent, aSize, aTransactionId );
|
|
106 |
}
|
|
107 |
|
|
108 |
// ----------------------------------------------------------------------------
|
|
109 |
// CBrowserLoadObserver::HandleLoadEventOtherL()
|
|
110 |
// ----------------------------------------------------------------------------
|
|
111 |
//
|
|
112 |
void CBrowserLoadObserver::HandleLoadEventOtherL(
|
|
113 |
TBrCtlDefs::TBrCtlLoadEvent aLoadEvent,
|
|
114 |
TUint aSize,
|
|
115 |
TUint16 aTransactionId )
|
|
116 |
{
|
|
117 |
#define STATECHECK( a ) { if( (iLoadState & a) == 0 ) break; }
|
|
118 |
|
|
119 |
TInt err( KErrNone );
|
|
120 |
switch( aLoadEvent )
|
|
121 |
{
|
|
122 |
case TBrCtlDefs::EEventLoadError:
|
|
123 |
{
|
|
124 |
if(LoadStatus( ELoadStatusSecurePage ))
|
|
125 |
{
|
|
126 |
ClearStatus( ELoadStatusSecurePage );
|
|
127 |
ClearStatus( ELoadStatusAllItemIsSecure );
|
|
128 |
SetStatus ( ELoadStatusSecurePageVisited );
|
|
129 |
UpdateSecureIndicatorL();
|
|
130 |
}
|
|
131 |
ClearStatus();
|
|
132 |
SetStatus( ELoadStatusMainError );
|
|
133 |
break;
|
|
134 |
}
|
|
135 |
case TBrCtlDefs::EEventEnteringSecurePage:
|
|
136 |
{
|
|
137 |
SetStatus( ELoadStatusSecurePage );
|
|
138 |
SetStatus( ELoadStatusAllItemIsSecure );
|
|
139 |
UpdateSecureIndicatorL();
|
|
140 |
break;
|
|
141 |
}
|
|
142 |
case TBrCtlDefs::EEventSomeItemsNotSecure:
|
|
143 |
{
|
|
144 |
ClearStatus( ELoadStatusAllItemIsSecure );
|
|
145 |
UpdateSecureIndicatorL();
|
|
146 |
break;
|
|
147 |
}
|
|
148 |
case TBrCtlDefs::EEventSecureItemInNonSecurePage:
|
|
149 |
{
|
|
150 |
SetStatus( ELoadStatusSecureItemNonSecurePage );
|
|
151 |
UpdateSecureIndicatorL();
|
|
152 |
break;
|
|
153 |
}
|
|
154 |
case TBrCtlDefs::EEventExitingSecurePage:
|
|
155 |
case TBrCtlDefs::EEventSubmittingToNonSecurePage:
|
|
156 |
{
|
|
157 |
ClearStatus( ELoadStatusSecurePage );
|
|
158 |
ClearStatus( ELoadStatusAllItemIsSecure );
|
|
159 |
SetStatus ( ELoadStatusSecurePageVisited );
|
|
160 |
UpdateSecureIndicatorL();
|
|
161 |
break;
|
|
162 |
}
|
|
163 |
case TBrCtlDefs::EEventTitleAvailable:
|
|
164 |
{
|
|
165 |
SetStatus( ELoadStatusTitleAvailable );
|
|
166 |
NewTitleAvailableL();
|
|
167 |
break;
|
|
168 |
}
|
|
169 |
case TBrCtlDefs::EEventNewContentStart:
|
|
170 |
{
|
|
171 |
#ifdef I__LOG_EVENT_TIME
|
|
172 |
iStartDownloadTime.HomeTime();
|
|
173 |
iTotalUpdateTime = 0;
|
|
174 |
iNumberOfUpdates = 0;
|
|
175 |
#endif // I__LOG_EVENT_TIME
|
|
176 |
StateChange( ELoadStateResponseInProgress );
|
|
177 |
iApiProvider->SetProgressShown( ETrue );
|
|
178 |
iApiProvider->Display().StartProgressAnimationL();
|
|
179 |
|
|
180 |
// in case we're in bookmarks view and a background page load is in
|
|
181 |
// progress, don't update the softkeys
|
|
182 |
if( iApiProvider->IsForeGround() && InBrowserContentView() )
|
|
183 |
{
|
|
184 |
if( CBrowserAppUi::Static()->ActiveView() )
|
|
185 |
{
|
|
186 |
CBrowserAppUi::Static()->ActiveView()->UpdateCbaL();
|
|
187 |
}
|
|
188 |
}
|
|
189 |
iApiProvider->WindowMgr().NotifyObserversL( EWindowLoadStart, iWindow->WindowId() );
|
|
190 |
break;
|
|
191 |
}
|
|
192 |
case TBrCtlDefs::EEventUrlLoadingStart:
|
|
193 |
{
|
|
194 |
STATECHECK( ELoadStateResponseInProgress )
|
|
195 |
iApiProvider->Display().StartProgressAnimationL();
|
|
196 |
|
|
197 |
// If the load is not initiated from the bookmarks view (ie. engine initiated
|
|
198 |
// via some timer on a page like cnn.com) then don't change view to content view
|
|
199 |
if (iBrowserInitLoad)
|
|
200 |
{
|
|
201 |
iApiProvider->SetViewToBeActivatedIfNeededL(KUidBrowserContentViewId);
|
|
202 |
iBrowserInitLoad = EFalse;
|
|
203 |
}
|
|
204 |
|
|
205 |
// add transaction to ProgressBar
|
|
206 |
iApiProvider->Display().AddTransActIdL( aTransactionId );
|
|
207 |
|
|
208 |
// Display the status pane, while loading
|
|
209 |
if ( InBrowserContentView() && iContentView->FullScreenMode() )
|
|
210 |
{
|
|
211 |
iContentView->ShowFsStatusPane(ETrue);
|
|
212 |
}
|
|
213 |
break;
|
|
214 |
}
|
|
215 |
// first content chunk arrived
|
|
216 |
case TBrCtlDefs::EEventNewUrlContentArrived:
|
|
217 |
{
|
|
218 |
STATECHECK( ELoadStateResponseInProgress )
|
|
219 |
SetStatus( ELoadStatusFirstChunkArrived );
|
|
220 |
// set MaxData for this transaction
|
|
221 |
iApiProvider->Display().AddProgressDataL(
|
|
222 |
aTransactionId, 0, aSize );
|
|
223 |
break;
|
|
224 |
}
|
|
225 |
// additional content chunk arrived
|
|
226 |
case TBrCtlDefs::EEventMoreUrlContentArrived:
|
|
227 |
{
|
|
228 |
STATECHECK( ELoadStateResponseInProgress )
|
|
229 |
START_TIMER( t1 );
|
|
230 |
// set RecvdData for this transaction
|
|
231 |
iApiProvider->Display().AddProgressDataL(
|
|
232 |
aTransactionId, aSize, 0 );
|
|
233 |
if( iApiProvider->IsForeGround() )
|
|
234 |
{
|
|
235 |
iApiProvider->Display().NotifyProgress();
|
|
236 |
}
|
|
237 |
STOP_TIMER( t1, iNumberOfUpdates );
|
|
238 |
break;
|
|
239 |
}
|
|
240 |
// content is processed, new fetch is allowed.
|
|
241 |
// some more event may still remain
|
|
242 |
case TBrCtlDefs::EEventContentFinished:
|
|
243 |
{
|
|
244 |
StateChange( ELoadStateIdle );
|
|
245 |
if( !ContentDisplayed() )
|
|
246 |
{
|
|
247 |
SetContentDisplayed( ETrue );
|
|
248 |
}
|
|
249 |
|
|
250 |
if( !iApiProvider->ExitInProgress() &&
|
|
251 |
iApiProvider->IsForeGround() )
|
|
252 |
{
|
|
253 |
iApiProvider->Display().StopProgressAnimationL();
|
|
254 |
}
|
|
255 |
User::ResetInactivityTime();
|
|
256 |
|
|
257 |
if( LoadUrlType() == ELoadUrlTypeEmbeddedBrowserWithUrl &&
|
|
258 |
!LoadStatus( ELoadStatusFirstChunkArrived ) &&
|
|
259 |
!iApiProvider->ExitInProgress() )
|
|
260 |
{
|
|
261 |
// Don't do anything; let the embedder close the browser
|
|
262 |
}
|
|
263 |
// No content to be shown, go back to where we came from
|
|
264 |
else if ( !iRestoreContentFlag )
|
|
265 |
{
|
|
266 |
CBrowserAppUi::Static()->ActivateLocalViewL(
|
|
267 |
iApiProvider->LastActiveViewId() );
|
|
268 |
if( iApiProvider->IsForeGround() )
|
|
269 |
{
|
|
270 |
if ( CBrowserAppUi::Static()->ActiveView() )
|
|
271 |
{
|
|
272 |
CBrowserAppUi::Static()->ActiveView()->UpdateCbaL();
|
|
273 |
}
|
|
274 |
}
|
|
275 |
}
|
|
276 |
else
|
|
277 |
{
|
|
278 |
ContentArrivedL();
|
|
279 |
|
|
280 |
// in case we're in bookmarks view and a background page load is in
|
|
281 |
// progress, don't update the softkeys
|
|
282 |
if( iApiProvider->IsForeGround() && InBrowserContentView() )
|
|
283 |
{
|
|
284 |
if ( CBrowserAppUi::Static()->ActiveView() )
|
|
285 |
{
|
|
286 |
CBrowserAppUi::Static()->ActiveView()->UpdateCbaL();
|
|
287 |
}
|
|
288 |
}
|
|
289 |
}
|
|
290 |
#ifdef I__LOG_EVENT_TIME
|
|
291 |
TTime endDownloadTime;
|
|
292 |
endDownloadTime.HomeTime();
|
|
293 |
TInt64 dlTime = endDownloadTime.MicroSecondsFrom(iStartDownloadTime).Int64();
|
|
294 |
LOG_WRITE_FORMAT( "Total download time: %d", dlTime );
|
|
295 |
LOG_WRITE_FORMAT( "Total update time: %d", iTotalUpdateTime );
|
|
296 |
LOG_WRITE_FORMAT( "Total number of updates: %d", iNumberOfUpdates );
|
|
297 |
if( iNumberOfUpdates )
|
|
298 |
{
|
|
299 |
LOG_WRITE_FORMAT( "Average update time: %d",
|
|
300 |
iTotalUpdateTime / iNumberOfUpdates );
|
|
301 |
}
|
|
302 |
if( dlTime )
|
|
303 |
{
|
|
304 |
LOG_WRITE_FORMAT( "Total update time (%% of download time): %d",
|
|
305 |
iTotalUpdateTime / (dlTime / 100) );
|
|
306 |
}
|
|
307 |
#endif // I__LOG_EVENT_TIME
|
|
308 |
break;
|
|
309 |
}
|
|
310 |
// first chunk displayed, no parameter
|
|
311 |
case TBrCtlDefs::EEventNewContentDisplayed:
|
|
312 |
{
|
|
313 |
iApiProvider->WindowMgr().SetContentExist( ETrue );
|
|
314 |
SetStatus( ELoadStatusFirstChunkDisplayed );
|
|
315 |
SetRestoreContentFlag( ETrue );
|
|
316 |
ContentArrivedL();
|
|
317 |
if( !ContentDisplayed() )
|
|
318 |
{
|
|
319 |
SetContentDisplayed( ETrue );
|
|
320 |
}
|
|
321 |
break;
|
|
322 |
}
|
|
323 |
// additional chunk displayed, no parameter
|
|
324 |
case TBrCtlDefs::EEventMoreContentDisplayed:
|
|
325 |
{
|
|
326 |
SetStatus( ELoadStatusContentDisplayed );
|
|
327 |
SetRestoreContentFlag( ETrue );
|
|
328 |
ContentArrivedL();
|
|
329 |
break;
|
|
330 |
}
|
|
331 |
// last chunk arrived
|
|
332 |
case TBrCtlDefs::EEventUrlLoadingFinished:
|
|
333 |
{
|
|
334 |
iApiProvider->Display().TransActIdComplete( aTransactionId );
|
|
335 |
SetRestoreContentFlag( ETrue );
|
|
336 |
ContentArrivedL();
|
|
337 |
TRAP( err, iApiProvider->LogAccessToRecentUrlL( iWindow->BrCtlInterface() ) );
|
|
338 |
break;
|
|
339 |
}
|
|
340 |
case TBrCtlDefs::EEventLoadFinished:
|
|
341 |
{
|
|
342 |
if( !iApiProvider->ExitInProgress() &&
|
|
343 |
iApiProvider->IsForeGround() )
|
|
344 |
{
|
|
345 |
iApiProvider->Display().StopProgressAnimationL();
|
|
346 |
|
|
347 |
// Turn off status pane, SK, and Cba
|
|
348 |
// If in content view, set to fullscreen after download complete
|
|
349 |
if ( InBrowserContentView() && iContentView->FullScreenMode() )
|
|
350 |
{
|
|
351 |
iContentView->ShowFsStatusPane(EFalse);
|
|
352 |
}
|
|
353 |
}
|
|
354 |
iApiProvider->WindowMgr().NotifyObserversL( EWindowLoadStop, iWindow->WindowId() );
|
|
355 |
break;
|
|
356 |
}
|
|
357 |
case TBrCtlDefs::EEventAuthenticationFailed:
|
|
358 |
{
|
|
359 |
// don't add url to Adaptive Bookmarks
|
|
360 |
ClearStatus( ELoadStatusFirstChunkArrived );
|
|
361 |
break;
|
|
362 |
}
|
|
363 |
// Large file upload events
|
|
364 |
case TBrCtlDefs::EEventUploadStart:
|
|
365 |
{
|
|
366 |
iMaxUploadContent = aSize;
|
|
367 |
iWindow->DialogsProviderProxy().UploadProgressNoteL(
|
|
368 |
iMaxUploadContent, 0, EFalse, this );
|
|
369 |
break;
|
|
370 |
}
|
|
371 |
case TBrCtlDefs::EEventUploadIncrement:
|
|
372 |
{
|
|
373 |
iWindow->DialogsProviderProxy().UploadProgressNoteL(
|
|
374 |
iMaxUploadContent, aSize, EFalse, this );
|
|
375 |
break;
|
|
376 |
}
|
|
377 |
case TBrCtlDefs::EEventUploadFinished:
|
|
378 |
{
|
|
379 |
iWindow->DialogsProviderProxy().UploadProgressNoteL(
|
|
380 |
iMaxUploadContent, aSize, ETrue, this );
|
|
381 |
break;
|
|
382 |
}
|
|
383 |
default:
|
|
384 |
break;
|
|
385 |
}
|
|
386 |
#undef STATECHECK
|
|
387 |
}
|
|
388 |
|
|
389 |
// ----------------------------------------------------------------------------
|
|
390 |
// CBrowserLoadObserver::CBrowserLoadObserver()
|
|
391 |
// ----------------------------------------------------------------------------
|
|
392 |
//
|
|
393 |
CBrowserLoadObserver::CBrowserLoadObserver(
|
|
394 |
MApiProvider& aApiProvider,
|
|
395 |
CBrowserContentView& aContentView,
|
|
396 |
CBrowserWindow& aWindow ) :
|
|
397 |
iApiProvider( &aApiProvider ),
|
|
398 |
iContentView( &aContentView ),
|
|
399 |
iWindow( &aWindow ),
|
|
400 |
iLoadState( ELoadStateIdle ),
|
|
401 |
iLoadUrlType( ELoadUrlTypeOther ),
|
|
402 |
iStatus( 0 )
|
|
403 |
{
|
|
404 |
}
|
|
405 |
|
|
406 |
// ----------------------------------------------------------------------------
|
|
407 |
// CBrowserLoadObserver::ConstructL()
|
|
408 |
// ----------------------------------------------------------------------------
|
|
409 |
//
|
|
410 |
void CBrowserLoadObserver::ConstructL()
|
|
411 |
{
|
|
412 |
}
|
|
413 |
|
|
414 |
// ----------------------------------------------------------------------------
|
|
415 |
// CBrowserLoadObserver::DoStartLoad()
|
|
416 |
// ----------------------------------------------------------------------------
|
|
417 |
//
|
|
418 |
void CBrowserLoadObserver::DoStartLoad(
|
|
419 |
TBrowserLoadUrlType aLoadUrlType )
|
|
420 |
{
|
|
421 |
/*
|
|
422 |
LOG_WRITE("-------------------")
|
|
423 |
LOG_WRITE_FORMAT(" UrlType: %d ", aLoadUrlType )
|
|
424 |
*/
|
|
425 |
// __ASSERT_DEBUG instead of condition?
|
|
426 |
if( iLoadState == ELoadStateIdle )
|
|
427 |
{
|
|
428 |
if (LoadStatus(ELoadStatusSecurePageVisited))
|
|
429 |
{
|
|
430 |
ClearStatus();
|
|
431 |
SetStatus(ELoadStatusSecurePageVisited);
|
|
432 |
}
|
|
433 |
else
|
|
434 |
{
|
|
435 |
ClearStatus();
|
|
436 |
}
|
|
437 |
|
|
438 |
iLoadUrlType = aLoadUrlType;
|
|
439 |
iRestoreContentFlag = EFalse;
|
|
440 |
}
|
|
441 |
|
|
442 |
iBrowserInitLoad = ETrue;
|
|
443 |
}
|
|
444 |
|
|
445 |
// ----------------------------------------------------------------------------
|
|
446 |
// CBrowserLoadObserver::DoEndLoad()
|
|
447 |
// ----------------------------------------------------------------------------
|
|
448 |
//
|
|
449 |
void CBrowserLoadObserver::DoEndLoad(
|
|
450 |
TBool aIsUserInitiated )
|
|
451 |
{
|
|
452 |
// LOG_WRITE( "Cancelling.")
|
|
453 |
if( aIsUserInitiated)
|
|
454 |
{
|
|
455 |
// wait for the remaining load events
|
|
456 |
StateChange( ELoadStateLoadDone );
|
|
457 |
}
|
|
458 |
else // don't wait for anything
|
|
459 |
{
|
|
460 |
StateChange( ELoadStateIdle );
|
|
461 |
}
|
|
462 |
|
|
463 |
// first arrives ContentFinished and then UrlLoadingFinished!
|
|
464 |
// what to do with status?
|
|
465 |
// updatesoftkeys() done in appui
|
|
466 |
|
|
467 |
CBrowserViewBase* view = CBrowserAppUi::Static()->ActiveView();
|
|
468 |
if( view ) // just to be sure
|
|
469 |
{
|
|
470 |
TVwsViewId activeViewId = view->ViewId();
|
|
471 |
if( activeViewId.iViewUid == KUidBrowserBookmarksViewId)
|
|
472 |
{
|
|
473 |
SetRestoreContentFlag( EFalse );
|
|
474 |
}
|
|
475 |
}
|
|
476 |
}
|
|
477 |
|
|
478 |
// ----------------------------------------------------------------------------
|
|
479 |
// CBrowserLoadObserver::NewTitleAvailableL()
|
|
480 |
// ----------------------------------------------------------------------------
|
|
481 |
//
|
|
482 |
void CBrowserLoadObserver::NewTitleAvailableL()
|
|
483 |
{
|
|
484 |
if( iWindow->IsWindowActive() )
|
|
485 |
{
|
|
486 |
CBrowserViewBase* view = CBrowserAppUi::Static()->ActiveView();
|
|
487 |
if( view ) // just to be sure
|
|
488 |
{
|
|
489 |
TVwsViewId activeViewId = view->ViewId();
|
|
490 |
if( activeViewId.iViewUid == KUidBrowserContentViewId )
|
|
491 |
{
|
|
492 |
iContentView->UpdateTitleL( *iApiProvider );
|
|
493 |
}
|
|
494 |
}
|
|
495 |
}
|
|
496 |
SetRestoreContentFlag( ETrue );
|
|
497 |
}
|
|
498 |
|
|
499 |
// ----------------------------------------------------------------------------
|
|
500 |
// CBrowserLoadObserver::InBrowserContentView()
|
|
501 |
// ----------------------------------------------------------------------------
|
|
502 |
//
|
|
503 |
TBool CBrowserLoadObserver::InBrowserContentView()
|
|
504 |
{
|
|
505 |
CBrowserViewBase* view = CBrowserAppUi::Static()->ActiveView();
|
|
506 |
if( view ) // just to be sure
|
|
507 |
{
|
|
508 |
TVwsViewId activeViewId = view->ViewId();
|
|
509 |
return ( activeViewId.iViewUid == KUidBrowserContentViewId );
|
|
510 |
}
|
|
511 |
|
|
512 |
return EFalse;
|
|
513 |
}
|
|
514 |
|
|
515 |
|
|
516 |
// ----------------------------------------------------------------------------
|
|
517 |
// CBrowserLoadObserver::ContentArrivedL()
|
|
518 |
// ----------------------------------------------------------------------------
|
|
519 |
//
|
|
520 |
void CBrowserLoadObserver::ContentArrivedL()
|
|
521 |
{
|
|
522 |
if( iApiProvider->Connection().Connected()
|
|
523 |
&& iApiProvider->Preferences().HttpSecurityWarningsStatSupressed() )
|
|
524 |
{
|
|
525 |
TInt secureUpdate = EAknIndicatorStateOff;
|
|
526 |
if( LoadStatus( ELoadStatusSecurePage ) )
|
|
527 |
{
|
|
528 |
if( LoadStatus( ELoadStatusAllItemIsSecure ) )
|
|
529 |
{
|
|
530 |
secureUpdate = EAknIndicatorStateOn;
|
|
531 |
}
|
|
532 |
}
|
|
533 |
iApiProvider->Display().UpdateSecureIndicatorL( secureUpdate );
|
|
534 |
}
|
|
535 |
}
|
|
536 |
|
|
537 |
//-----------------------------------------------------------------------------
|
|
538 |
// CBrowserLoadObserver::ReportDialogEvent
|
|
539 |
//-----------------------------------------------------------------------------
|
|
540 |
// Handles dialog provider events
|
|
541 |
void CBrowserLoadObserver::ReportDialogEventL(
|
|
542 |
TInt aType,
|
|
543 |
TInt aFlags )
|
|
544 |
{
|
|
545 |
switch( aType )
|
|
546 |
{
|
|
547 |
case MBrowserDialogsProviderObserver::ENotifyError:
|
|
548 |
// aFlags contains error code
|
|
549 |
{
|
|
550 |
// If card not in deck error, go to first card of deck
|
|
551 |
SetRestoreContentFlag( aFlags == KBrsrWmlbrowserCardNotInDeck );
|
|
552 |
break;
|
|
553 |
}
|
|
554 |
case MBrowserDialogsProviderObserver::ENotifyHttpError:
|
|
555 |
// aFlags contains error code
|
|
556 |
{
|
|
557 |
SetRestoreContentFlag( EFalse );
|
|
558 |
break;
|
|
559 |
}
|
|
560 |
case MBrowserDialogsProviderObserver::EUserAuthentication:
|
|
561 |
{
|
|
562 |
SetRestoreContentFlag( aFlags ); // False == Cancelled
|
|
563 |
break;
|
|
564 |
}
|
|
565 |
case MBrowserDialogsProviderObserver::EConfirm:
|
|
566 |
// aFlags contains Cancel status
|
|
567 |
{
|
|
568 |
// if confirmation query was cancelled, step back to idle
|
|
569 |
if( !aFlags )
|
|
570 |
{
|
|
571 |
DoEndLoad( EFalse );
|
|
572 |
}
|
|
573 |
SetRestoreContentFlag( !aFlags );
|
|
574 |
break;
|
|
575 |
}
|
|
576 |
case MBrowserDialogsProviderObserver::EUploadProgress:
|
|
577 |
{
|
|
578 |
// Cancel fetching - dialog is cancelled
|
|
579 |
if ( aFlags == KErrCancel )
|
|
580 |
{
|
|
581 |
iWindow->BrCtlInterface().HandleCommandL(
|
|
582 |
(TInt)TBrCtlDefs::ECommandCancelFetch +
|
|
583 |
(TInt)TBrCtlDefs::ECommandIdBase );
|
|
584 |
}
|
|
585 |
break;
|
|
586 |
}
|
|
587 |
default:
|
|
588 |
break;
|
|
589 |
}
|
|
590 |
}
|
|
591 |
|
|
592 |
//-----------------------------------------------------------------------------
|
|
593 |
// CBrowserLoadObserver::UpdateSecureIndicatorL
|
|
594 |
//-----------------------------------------------------------------------------
|
|
595 |
//
|
|
596 |
void CBrowserLoadObserver::UpdateSecureIndicatorL()
|
|
597 |
{
|
|
598 |
TBool status = LoadStatus( ELoadStatusAllItemIsSecure );
|
|
599 |
iApiProvider->Display().UpdateSecureIndicatorL(
|
|
600 |
status &&
|
|
601 |
!iApiProvider->Preferences().HttpSecurityWarningsStatSupressed() );
|
|
602 |
}
|
|
603 |
|
|
604 |
//-----------------------------------------------------------------------------
|
|
605 |
// CBrowserLoadObserver::LoadUrlType
|
|
606 |
//-----------------------------------------------------------------------------
|
|
607 |
//
|
|
608 |
CBrowserLoadObserver::TBrowserLoadUrlType CBrowserLoadObserver::LoadUrlType() const
|
|
609 |
{
|
|
610 |
return iLoadUrlType;
|
|
611 |
}
|
|
612 |
|
|
613 |
//-----------------------------------------------------------------------------
|
|
614 |
// CBrowserLoadObserver::LoadState
|
|
615 |
//-----------------------------------------------------------------------------
|
|
616 |
//
|
|
617 |
CBrowserLoadObserver::TBrowserLoadState CBrowserLoadObserver::LoadState() const
|
|
618 |
{
|
|
619 |
return iLoadState;
|
|
620 |
}
|
|
621 |
//-----------------------------------------------------------------------------
|
|
622 |
// CBrowserLoadObserver::StateChange
|
|
623 |
//-----------------------------------------------------------------------------
|
|
624 |
//
|
|
625 |
void CBrowserLoadObserver::StateChange( TBrowserLoadState aNextState )
|
|
626 |
{
|
|
627 |
if( ELoadStateIdle == iLoadState &&
|
|
628 |
iLoadState != aNextState )
|
|
629 |
{
|
|
630 |
iNewContentDisplayed = EFalse;
|
|
631 |
iApiProvider->WindowMgr().NotifyObserversL( EWindowCntDisplayed, iWindow->WindowId() );
|
|
632 |
}
|
|
633 |
iLoadState = aNextState;
|
|
634 |
}
|
|
635 |
|
|
636 |
//-----------------------------------------------------------------------------
|
|
637 |
// CBrowserLoadObserver::SetContentDisplayed
|
|
638 |
//-----------------------------------------------------------------------------
|
|
639 |
//
|
|
640 |
|
|
641 |
void CBrowserLoadObserver::SetContentDisplayed( TBool aValue )
|
|
642 |
{
|
|
643 |
iNewContentDisplayed = aValue;
|
|
644 |
TRAP_IGNORE( iApiProvider->WindowMgr().NotifyObserversL( EWindowCntDisplayed, iWindow->WindowId()));
|
|
645 |
}
|
|
646 |
|
|
647 |
|
|
648 |
// End of file
|