|
1 /* |
|
2 * Copyright (c) 2002-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <e32std.h> |
|
21 #include <gmxmlelement.h> |
|
22 #include <cfcontextsourcecommand.h> |
|
23 |
|
24 #include "cfextendedcontextinterface.h" |
|
25 #include "cfcontextindication.h" |
|
26 #include "cfpluginoperation.h" |
|
27 #include "CFScript.h" |
|
28 #include "CFContextSubscriptionImpl.h" |
|
29 #include "cfscriptsubscription.h" |
|
30 #include "cfoperationnode.h" |
|
31 #include "cfscriptroot.h" |
|
32 #include "cfconstants.h" |
|
33 #include "cfscriptlistener.h" |
|
34 #include "cfactionhandler.h" |
|
35 #include "cftrace.h" |
|
36 #include "cfpersistentdata.h" |
|
37 #include "cfscriptinfo.h" |
|
38 |
|
39 // MEMBER FUNCTIONS |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CCFScript::CCFScript |
|
43 // C++ default constructor can NOT contain any code, that might leave. |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 CCFScript::CCFScript( MCFExtendedContextInterface& aCF, |
|
47 MCFActionHandler& aActionHandler, |
|
48 MCFSecurityChecker& aSecurityChecker, |
|
49 MCFPlugInOperation& aPlugInOperation, |
|
50 RFs& aFs ): |
|
51 iCF( aCF ), |
|
52 iActionHandler( aActionHandler ), |
|
53 iSecurityChecker( aSecurityChecker ), |
|
54 iPlugInOperation( aPlugInOperation ), |
|
55 iFs( aFs ) |
|
56 { |
|
57 FUNC_LOG; |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CCFScript::ConstructL |
|
62 // Symbian 2nd phase constructor can leave. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 void CCFScript::ConstructL( CMDXMLNode& aStartNode, const TDesC& aName, |
|
66 TInt aScriptId, const TUid& aOwner, TInt aLength, |
|
67 MCFScriptOwner* aScriptOwner ) |
|
68 { |
|
69 FUNC_LOG; |
|
70 |
|
71 // local variable declaration & initialization |
|
72 TInt err( KErrNone ); |
|
73 |
|
74 // Script related information |
|
75 iInfo = CCFScriptInfo::NewL( aName, aScriptId, aOwner, aLength, aScriptOwner ); |
|
76 iPersistentData = CCFPersistentData::NewL( iFs, aOwner, iInfo->Name() ); |
|
77 |
|
78 // parse script to objects |
|
79 err = ParseScriptL( aStartNode ); |
|
80 ERROR_1( err, "Parse script error: %d", err ); |
|
81 |
|
82 // leave if error occurred |
|
83 User::LeaveIfError( err ); |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CCFScript::NewL |
|
88 // Two-phased constructor. |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 CCFScript* CCFScript::NewL( CMDXMLNode& aStartNode, |
|
92 const TDesC& aName, |
|
93 TInt aScriptId, |
|
94 const TUid& aOwner, |
|
95 MCFActionHandler& aActionHandler, |
|
96 TInt aLength, |
|
97 MCFExtendedContextInterface& aCF, |
|
98 MCFSecurityChecker& aSecurityChecker, |
|
99 MCFPlugInOperation& aPlugInOperation, |
|
100 RFs& aFs, |
|
101 MCFScriptOwner* aScriptOwner ) |
|
102 { |
|
103 FUNC_LOG; |
|
104 |
|
105 CCFScript* self = NewLC( aStartNode, |
|
106 aName, |
|
107 aScriptId, |
|
108 aOwner, |
|
109 aActionHandler, |
|
110 aLength, |
|
111 aCF, |
|
112 aSecurityChecker, |
|
113 aPlugInOperation, |
|
114 aFs, |
|
115 aScriptOwner ); |
|
116 CleanupStack::Pop( self ); |
|
117 return self; |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CCFScript::NewLC |
|
122 // Two-phased constructor. |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 CCFScript* CCFScript::NewLC( CMDXMLNode& aStartNode, |
|
126 const TDesC& aName, |
|
127 TInt aScriptId, |
|
128 const TUid& aOwner, |
|
129 MCFActionHandler& aActionHandler, |
|
130 TInt aLength, |
|
131 MCFExtendedContextInterface& aCF, |
|
132 MCFSecurityChecker& aSecurityChecker, |
|
133 MCFPlugInOperation& aPlugInOperation, |
|
134 RFs& aFs, |
|
135 MCFScriptOwner* aScriptOwner ) |
|
136 { |
|
137 FUNC_LOG; |
|
138 |
|
139 CCFScript* self = new( ELeave ) CCFScript( aCF, |
|
140 aActionHandler, |
|
141 aSecurityChecker, |
|
142 aPlugInOperation, |
|
143 aFs ); |
|
144 CleanupStack::PushL( self ); |
|
145 self->ConstructL( aStartNode, aName, aScriptId, aOwner, aLength, aScriptOwner ); |
|
146 return self; |
|
147 } |
|
148 |
|
149 // Destructor |
|
150 CCFScript::~CCFScript() |
|
151 { |
|
152 FUNC_LOG; |
|
153 |
|
154 iCF.UnsubscribeContexts( *this ); |
|
155 iScriptSubscriptions.ResetAndDestroy(); |
|
156 iRequiresAll.Close(); |
|
157 delete iScriptRoot; |
|
158 iScriptRoot = NULL; |
|
159 delete iPersistentData; |
|
160 delete iInfo; |
|
161 iDependencyList.Close(); |
|
162 } |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // CCFScript::ActivateL |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 void CCFScript::ActivateL() |
|
169 { |
|
170 FUNC_LOG; |
|
171 |
|
172 iScriptRoot->ActivateL(); |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CCFScript::CheckSecurity |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 TInt CCFScript::CheckSecurity( const RThread& aOwnerThread ) |
|
180 { |
|
181 FUNC_LOG; |
|
182 |
|
183 iScriptThreadForSecurityCheck = &aOwnerThread; |
|
184 |
|
185 TInt err = iScriptRoot->CheckSecurity(); |
|
186 |
|
187 iScriptThreadForSecurityCheck = NULL; |
|
188 |
|
189 return err; |
|
190 } |
|
191 |
|
192 // ----------------------------------------------------------------------------- |
|
193 // CCFScript::ActionHandler |
|
194 // ----------------------------------------------------------------------------- |
|
195 // |
|
196 MCFActionHandler& CCFScript::ActionHandler() const |
|
197 { |
|
198 FUNC_LOG; |
|
199 |
|
200 return iActionHandler; |
|
201 } |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // CCFScript::UpgradeSecurity |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 const TCapabilitySet& CCFScript::UpgradeSecurity() const |
|
208 { |
|
209 FUNC_LOG; |
|
210 |
|
211 return iScriptRoot->UpgradeSecurity(); |
|
212 } |
|
213 |
|
214 // ----------------------------------------------------------------------------- |
|
215 // CCFScript::ContextIndicationL |
|
216 // |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 void CCFScript::ContextIndicationL( CCFContextIndication* aIndication ) |
|
220 { |
|
221 FUNC_LOG; |
|
222 |
|
223 // Initialize local variables. |
|
224 TInt contextLevelDelay( 0 ); |
|
225 |
|
226 // Guards firing actions so that an operation of the script must have been |
|
227 // evaluated before actions are allowed to be fired. |
|
228 TBool evaluated = EvaluateScript( aIndication->Context(), |
|
229 contextLevelDelay ); |
|
230 delete aIndication; // Cleanup the transferred indication. |
|
231 aIndication = NULL; |
|
232 |
|
233 if ( evaluated ) |
|
234 { |
|
235 TInt err( KErrNone ); |
|
236 TRAP( err, iScriptRoot->ContextEvaluatedL( contextLevelDelay ) ); |
|
237 |
|
238 ERROR( err, "Signalling script evaluation by context to script root leaved." ); |
|
239 } |
|
240 } |
|
241 |
|
242 // ----------------------------------------------------------------------------- |
|
243 // CCFScript::Client |
|
244 // |
|
245 // ----------------------------------------------------------------------------- |
|
246 // |
|
247 TInt CCFScript::Client( RThread& /*aThread*/ ) const |
|
248 { |
|
249 FUNC_LOG; |
|
250 |
|
251 return KErrNone; |
|
252 } |
|
253 |
|
254 // ----------------------------------------------------------------------------- |
|
255 // CCFScript::HandleContextSubscriptionError |
|
256 // |
|
257 // ----------------------------------------------------------------------------- |
|
258 // |
|
259 void CCFScript::HandleContextSubscriptionError( TInt /*aError*/, |
|
260 const TDesC& /*aSource*/, |
|
261 const TDesC& /*aType*/ ) |
|
262 { |
|
263 FUNC_LOG; |
|
264 |
|
265 // Nothing to do. |
|
266 // Generally this can only happen with OOM |
|
267 } |
|
268 |
|
269 |
|
270 // ----------------------------------------------------------------------------- |
|
271 // CCFScript::SubscribeContextL |
|
272 // ----------------------------------------------------------------------------- |
|
273 // |
|
274 void CCFScript::SubscribeContextL( MCFScriptListener* aListener ) |
|
275 { |
|
276 FUNC_LOG; |
|
277 |
|
278 CCFScriptSubscription* subscription = NULL; |
|
279 for ( TInt i = 0; i < iScriptSubscriptions.Count(); ++i ) |
|
280 { |
|
281 subscription = iScriptSubscriptions[ i ]; |
|
282 if ( subscription->Match( *aListener ) ) |
|
283 { |
|
284 break; |
|
285 } |
|
286 subscription = NULL; |
|
287 } |
|
288 |
|
289 if ( subscription ) |
|
290 { |
|
291 subscription->AddListenerL( aListener ); |
|
292 } |
|
293 else |
|
294 { |
|
295 // below // CLEANUP<< subscription |
|
296 subscription = CCFScriptSubscription::NewLC( iCF, *this, aListener ); |
|
297 iScriptSubscriptions.AppendL( subscription ); |
|
298 CleanupStack::Pop( subscription ); // CLEANUP>> subscription |
|
299 } |
|
300 |
|
301 if ( aListener->IsAllRequired() ) |
|
302 { |
|
303 iRequiresAll.AppendL( aListener ); |
|
304 } |
|
305 } |
|
306 |
|
307 // ----------------------------------------------------------------------------- |
|
308 // CCFScript::RemoveSubscription |
|
309 // ----------------------------------------------------------------------------- |
|
310 // |
|
311 void CCFScript::RemoveSubscription( MCFScriptListener* aListener ) |
|
312 { |
|
313 FUNC_LOG; |
|
314 |
|
315 for ( TInt i = 0; i < iScriptSubscriptions.Count(); ++i ) |
|
316 { |
|
317 CCFScriptSubscription* subscription = iScriptSubscriptions[ i ]; |
|
318 if ( subscription->Match( *aListener ) ) |
|
319 { |
|
320 if ( subscription->RemoveListener( aListener ) ) |
|
321 { |
|
322 // Last listener removed, clean up. |
|
323 iScriptSubscriptions.Remove( i ); |
|
324 delete subscription; |
|
325 } |
|
326 break; |
|
327 } |
|
328 } |
|
329 |
|
330 if ( aListener->IsAllRequired() ) |
|
331 { |
|
332 TInt index = iRequiresAll.Find( aListener ); |
|
333 if ( index != KErrNotFound ) |
|
334 { |
|
335 iRequiresAll.Remove( index ); |
|
336 } |
|
337 } |
|
338 } |
|
339 |
|
340 // ----------------------------------------------------------------------------- |
|
341 // CCFScript::CheckContextReadSecurity |
|
342 // ----------------------------------------------------------------------------- |
|
343 // |
|
344 TInt CCFScript::CheckContextReadSecurity( const TDesC& aSource, |
|
345 const TDesC& aType ) |
|
346 { |
|
347 FUNC_LOG; |
|
348 |
|
349 TSecurityPolicy securityPolicy; |
|
350 TInt err = iCF.GetReadSecurityPolicy( aSource, aType, securityPolicy ); |
|
351 if ( err != KErrNone ) |
|
352 { |
|
353 return err; |
|
354 } |
|
355 |
|
356 TBool securityPassed = iSecurityChecker.CheckClientSecurity( |
|
357 *iScriptThreadForSecurityCheck, securityPolicy ); |
|
358 if (!securityPassed) |
|
359 { |
|
360 return KErrPermissionDenied; |
|
361 } |
|
362 |
|
363 return KErrNone; |
|
364 } |
|
365 |
|
366 // ----------------------------------------------------------------------------- |
|
367 // CCFScript::CheckWriteSecurity |
|
368 // ----------------------------------------------------------------------------- |
|
369 // |
|
370 TInt CCFScript::CheckScriptOwnerAccess( const TSecurityPolicy& aPolicy ) |
|
371 { |
|
372 FUNC_LOG; |
|
373 |
|
374 TInt ret( KErrNone ); |
|
375 |
|
376 TBool securityPassed = iSecurityChecker.CheckClientSecurity( |
|
377 *iScriptThreadForSecurityCheck, aPolicy ); |
|
378 if ( !securityPassed ) |
|
379 { |
|
380 ret = KErrPermissionDenied; |
|
381 } |
|
382 |
|
383 return ret; |
|
384 } |
|
385 |
|
386 // ----------------------------------------------------------------------------- |
|
387 // CCFScript::ParseL |
|
388 // ----------------------------------------------------------------------------- |
|
389 // |
|
390 CCFOperationNode* CCFScript::ParseL( CCFOperationNode* aParent, |
|
391 CMDXMLNode& aNode ) |
|
392 { |
|
393 FUNC_LOG; |
|
394 |
|
395 TUid providerUid = KNullUid; |
|
396 CCFOperationNode* opNode = iPlugInOperation.ParseL( |
|
397 aParent, aNode, *this, providerUid ); |
|
398 if ( opNode ) |
|
399 { |
|
400 // Node found, add dependency |
|
401 AddDependencyL( providerUid ); |
|
402 } |
|
403 else |
|
404 { |
|
405 TPtrC nodeName( aNode.NodeName() ); |
|
406 ERROR_GEN_1( "Unknown node name: %S" , &nodeName ); |
|
407 } |
|
408 |
|
409 return opNode; |
|
410 } |
|
411 |
|
412 //------------------------------------------------------------------------------ |
|
413 // CCFScript::ScriptId |
|
414 //------------------------------------------------------------------------------ |
|
415 // |
|
416 TInt CCFScript::ScriptId() const |
|
417 { |
|
418 FUNC_LOG; |
|
419 |
|
420 return iInfo->Id(); |
|
421 } |
|
422 |
|
423 // ----------------------------------------------------------------------------- |
|
424 // CCFScript::RestoreL |
|
425 // ----------------------------------------------------------------------------- |
|
426 // |
|
427 void CCFScript::RestoreL( const TDesC& aFile, CCFOperationNode& aOperation ) |
|
428 { |
|
429 FUNC_LOG; |
|
430 |
|
431 iPersistentData->RestoreL( aFile, aOperation ); |
|
432 } |
|
433 |
|
434 // ----------------------------------------------------------------------------- |
|
435 // CCFScript::StoreL |
|
436 // ----------------------------------------------------------------------------- |
|
437 // |
|
438 void CCFScript::StoreL( const TDesC& aFile, CCFOperationNode& aOperation ) |
|
439 { |
|
440 FUNC_LOG; |
|
441 |
|
442 iPersistentData->StoreL( aFile, aOperation ); |
|
443 } |
|
444 |
|
445 // ----------------------------------------------------------------------------- |
|
446 // CCFScript::StoreL |
|
447 // ----------------------------------------------------------------------------- |
|
448 // |
|
449 void CCFScript::Delete( const TDesC& aFile ) |
|
450 { |
|
451 FUNC_LOG; |
|
452 |
|
453 iPersistentData->Delete( aFile ); |
|
454 } |
|
455 |
|
456 |
|
457 // ----------------------------------------------------------------------------- |
|
458 // CCFScript::LaunchActivatedActions |
|
459 // ----------------------------------------------------------------------------- |
|
460 // |
|
461 void CCFScript::LaunchActivatedActions() |
|
462 { |
|
463 FUNC_LOG; |
|
464 |
|
465 TInt err( KErrNone ); |
|
466 TRAP( err, iScriptRoot->EvaluatedL() ); |
|
467 |
|
468 ERROR( err, "Signalling script evaluation without context to script root leaved." ); |
|
469 } |
|
470 |
|
471 // ----------------------------------------------------------------------------- |
|
472 // CCFScript::ContextInterface |
|
473 // ----------------------------------------------------------------------------- |
|
474 // |
|
475 MCFContextInterface& CCFScript::ContextInterface() const |
|
476 { |
|
477 FUNC_LOG; |
|
478 |
|
479 return iCF; |
|
480 } |
|
481 |
|
482 // ----------------------------------------------------------------------------- |
|
483 // CCFScript::FireActionL |
|
484 // ----------------------------------------------------------------------------- |
|
485 // |
|
486 void CCFScript::FireActionL( CCFScriptEvent* aEvent ) |
|
487 { |
|
488 FUNC_LOG; |
|
489 |
|
490 iActionHandler.FireActionL( aEvent ); |
|
491 } |
|
492 |
|
493 // ----------------------------------------------------------------------------- |
|
494 // CCFScript::FireActionL |
|
495 // ----------------------------------------------------------------------------- |
|
496 // |
|
497 void CCFScript::FireActionL( const CCFContextSourceCommand& aCommand ) |
|
498 { |
|
499 FUNC_LOG; |
|
500 |
|
501 iActionHandler.FireActionL( aCommand ); |
|
502 } |
|
503 |
|
504 // ----------------------------------------------------------------------------- |
|
505 // CCFScript::GetSecurityPolicy |
|
506 // ----------------------------------------------------------------------------- |
|
507 // |
|
508 TInt CCFScript::GetActionSecurityPolicy( const TDesC& aActionId, |
|
509 TSecurityPolicy& aPolicy ) |
|
510 { |
|
511 FUNC_LOG; |
|
512 |
|
513 return iActionHandler.GetActionSecurityPolicy( aActionId, aPolicy ); |
|
514 } |
|
515 |
|
516 // ----------------------------------------------------------------------------- |
|
517 // CCFScript::CleanupPersistentData |
|
518 // ----------------------------------------------------------------------------- |
|
519 // |
|
520 void CCFScript::CleanupPersistentData() |
|
521 { |
|
522 FUNC_LOG; |
|
523 |
|
524 iScriptRoot->Cleanup(); |
|
525 } |
|
526 |
|
527 //------------------------------------------------------------------------------ |
|
528 // CCFScript::HasDependency |
|
529 //------------------------------------------------------------------------------ |
|
530 // |
|
531 TBool CCFScript::HasDependency( const TUid& aUid ) const |
|
532 { |
|
533 FUNC_LOG; |
|
534 |
|
535 // Check if the dependency is needed to be added |
|
536 TBool found = EFalse; |
|
537 if( aUid != KNullUid ) |
|
538 { |
|
539 for( TInt i = 0; i < iDependencyList.Count(); i++ ) |
|
540 { |
|
541 if( iDependencyList[i] == aUid ) |
|
542 { |
|
543 found = ETrue; |
|
544 break; |
|
545 } |
|
546 } |
|
547 } |
|
548 return found; |
|
549 } |
|
550 |
|
551 //------------------------------------------------------------------------------ |
|
552 // CCFScript::CopyInfoLC |
|
553 //------------------------------------------------------------------------------ |
|
554 // |
|
555 CCFScriptInfo* CCFScript::CopyInfoLC() const |
|
556 { |
|
557 FUNC_LOG; |
|
558 |
|
559 return CCFScriptInfo::NewLC( iInfo->Name(), |
|
560 iInfo->Id(), |
|
561 iInfo->OwnerUid(), |
|
562 iInfo->Length(), |
|
563 iInfo->OwnerSession() ); |
|
564 } |
|
565 |
|
566 //------------------------------------------------------------------------------ |
|
567 // CCFScript::OwnerUid |
|
568 //------------------------------------------------------------------------------ |
|
569 // |
|
570 const TUid& CCFScript::OwnerUid() const |
|
571 { |
|
572 FUNC_LOG; |
|
573 |
|
574 return iInfo->OwnerUid(); |
|
575 } |
|
576 |
|
577 //------------------------------------------------------------------------------ |
|
578 // CCFScript::Name |
|
579 //------------------------------------------------------------------------------ |
|
580 // |
|
581 TPtrC CCFScript::Name() const |
|
582 { |
|
583 FUNC_LOG; |
|
584 |
|
585 return iInfo->Name(); |
|
586 } |
|
587 |
|
588 //------------------------------------------------------------------------------ |
|
589 // CCFScript::Length |
|
590 //------------------------------------------------------------------------------ |
|
591 // |
|
592 TInt CCFScript::Length() const |
|
593 { |
|
594 FUNC_LOG; |
|
595 |
|
596 return iInfo->Length(); |
|
597 } |
|
598 |
|
599 //------------------------------------------------------------------------------ |
|
600 // CCFScript::Info |
|
601 //------------------------------------------------------------------------------ |
|
602 // |
|
603 CCFScriptInfo& CCFScript::Info() const |
|
604 { |
|
605 FUNC_LOG; |
|
606 |
|
607 return *iInfo; |
|
608 } |
|
609 |
|
610 // ----------------------------------------------------------------------------- |
|
611 // CCFScript::ParseScriptL |
|
612 // ----------------------------------------------------------------------------- |
|
613 // |
|
614 TInt CCFScript::ParseScriptL( CMDXMLNode& aStartNode ) |
|
615 { |
|
616 FUNC_LOG; |
|
617 |
|
618 TUid providerUid = KNullUid; |
|
619 iScriptRoot = iPlugInOperation.ParseScriptRootL( |
|
620 NULL, aStartNode, *this, providerUid ); |
|
621 TInt err( KErrNone ); |
|
622 if ( iScriptRoot ) |
|
623 { |
|
624 // Script root found, add dependency |
|
625 AddDependencyL( providerUid ); |
|
626 } |
|
627 else |
|
628 { |
|
629 ERROR_GEN( "CCFScript::ParseScriptL: The script has invalid root element" ); |
|
630 err = KErrNotFound; |
|
631 } |
|
632 |
|
633 return err; |
|
634 } |
|
635 |
|
636 // ----------------------------------------------------------------------------- |
|
637 // CCFScript::EvaluateScript |
|
638 // ----------------------------------------------------------------------------- |
|
639 // |
|
640 TBool CCFScript::EvaluateScript( const CCFContextObject& aContext, |
|
641 TInt& aContextLevelDelay ) |
|
642 { |
|
643 FUNC_LOG; |
|
644 |
|
645 TBool evaluated( EFalse ); |
|
646 TInt delayRequirement( 0 ); |
|
647 TInt delay( 0 ); |
|
648 |
|
649 TPtrC name( iInfo->Name() ); |
|
650 INFO_2( "CCFScript::EvaluateScript - Evaluating script NAME=[%S] ID=[%d] with context:", |
|
651 &name, iInfo->Id() ); |
|
652 INFO_3( ">> %S: %S: %S", &aContext.Source(), &aContext.Type(), &aContext.Value() ); |
|
653 |
|
654 // Evaluate first all operations requiring all context indications. |
|
655 for ( TInt index = 0; index < iRequiresAll.Count(); ++index ) |
|
656 { |
|
657 if ( iRequiresAll[ index ]->Evaluate( aContext, delay ) ) |
|
658 { |
|
659 evaluated = ETrue; |
|
660 if ( delay > delayRequirement ) |
|
661 { |
|
662 delayRequirement = delay; |
|
663 } |
|
664 } |
|
665 } |
|
666 |
|
667 for ( TInt j = 0; j < iScriptSubscriptions.Count(); ++j ) |
|
668 { |
|
669 CCFScriptSubscription* subscription = iScriptSubscriptions[ j ]; |
|
670 if ( subscription->Match( aContext ) ) |
|
671 { |
|
672 if ( subscription->NotifyListeners( aContext, delay ) ) |
|
673 { |
|
674 evaluated = ETrue; |
|
675 } |
|
676 |
|
677 if ( delay > delayRequirement ) |
|
678 { |
|
679 delayRequirement = delay; |
|
680 } |
|
681 break; |
|
682 } |
|
683 } |
|
684 |
|
685 if ( delayRequirement > 0 ) |
|
686 { |
|
687 aContextLevelDelay = delayRequirement; |
|
688 } |
|
689 |
|
690 INFO_3( "CCFScript::EvaluateScript - Evaluated script ID=[%d]: CtxLevDelay=%dms, (1=evaluated, 0=no evaluation): %d", |
|
691 iInfo->Id(), aContextLevelDelay, evaluated ); |
|
692 |
|
693 return evaluated; |
|
694 } |
|
695 |
|
696 //------------------------------------------------------------------------------ |
|
697 // CCFScript::AddDependencyL |
|
698 //------------------------------------------------------------------------------ |
|
699 // |
|
700 void CCFScript::AddDependencyL( const TUid& aUid ) |
|
701 { |
|
702 FUNC_LOG; |
|
703 |
|
704 // Check if the dependency is needed to be added |
|
705 TBool found = HasDependency( aUid ); |
|
706 if( !found ) |
|
707 { |
|
708 iDependencyList.AppendL( aUid ); |
|
709 } |
|
710 } |
|
711 |
|
712 // End of file |
|
713 |