contextframework/cfw/inc/cfactivatorengine/CFActivatorEngineActionPluginManager.h
changeset 0 2e3d3ce01487
child 24 a72ff4214918
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     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:  CCFActivatorEngineActionPluginManager class declaration.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CCFACTIVATORENGINEACTIONPLUGINMANAGER_H
       
    20 #define C_CCFACTIVATORENGINEACTIONPLUGINMANAGER_H
       
    21 
       
    22 #include "cfecompluginmanager.h"
       
    23 #include "cfphasebase.h"
       
    24 #include "CFActionCacheElement.h"
       
    25 #include "cfasynccleanupcallback.h"
       
    26 
       
    27 class CAsyncCallBack;
       
    28 class CCFActionPlugIn;
       
    29 class CCFActionIndication;
       
    30 class CCFActionPlugInThread;
       
    31 class CImplementationInformation;
       
    32 class CCFActionPlugInImpl;
       
    33 class MCFStarterEventHandler;
       
    34 
       
    35 /**
       
    36  *  Actiion plug-in manager loads and maintains action plug-ins.
       
    37  *
       
    38  *  @lib -
       
    39  *  @since S60 s60 4.0
       
    40  */
       
    41 NONSHARABLE_CLASS( CCFActivatorEngineActionPluginManager ): public CCFEComPluginManager,
       
    42 public MCFAsyncCleanupCallback
       
    43     {
       
    44 public:
       
    45 
       
    46     // Two phased constructors
       
    47     static CCFActivatorEngineActionPluginManager* NewL(
       
    48         RActionCacheArray& aActionCache );
       
    49     static CCFActivatorEngineActionPluginManager* NewLC(
       
    50         RActionCacheArray& aActionCache );
       
    51 
       
    52     // Destructor
       
    53     ~CCFActivatorEngineActionPluginManager();
       
    54 
       
    55 public: // New methods
       
    56 
       
    57     /**
       
    58      * Trigger a specific action.
       
    59      * All the plug-ins are searched through. When the first
       
    60      * plug-in is found with the action identifier, it will
       
    61      * be executed.
       
    62      *
       
    63      * @since S60 4.0
       
    64      * @param aActionIndication Action indication.
       
    65      * @return ETrue if action for the identifier found.
       
    66      */
       
    67     TBool TriggerL( CCFActionIndication* aActionIndication );
       
    68 
       
    69     /**
       
    70      * Initializes context framework phases.
       
    71      *
       
    72      * @since S60 4.0
       
    73      * @param aPhaseId Current phase.
       
    74      * @return None.
       
    75      */
       
    76     void InitializePhaseL( CCFPhaseBase::TCFPhaseId aPhaseId );
       
    77 
       
    78     /**
       
    79      * "Abusing" the frienship of ActionPlugIn.
       
    80      */
       
    81     static void SetImplPointer( CCFActionPlugIn& aActionPlugIn,
       
    82         CCFActionPlugInImpl* aImpl);
       
    83 
       
    84     /**
       
    85      * Go through action plugins if new plugins added or removed.
       
    86      */
       
    87     void UpdatePlugInsL();
       
    88 
       
    89     /**
       
    90      * Add new actions to action cache.
       
    91      *
       
    92      * @since S60 3.2
       
    93      * @param aActionPluginThread Identifies the action plug-in whose actions
       
    94      * to add.
       
    95      * @return None.
       
    96      */
       
    97     void AddNewActionsToCacheL( CCFActionPlugInThread& aActionPluginThread );
       
    98 
       
    99         /**
       
   100         * Sets event handler to observers.
       
   101         * 
       
   102         * @since S60 3.2
       
   103         * @param aEventHandler Event handler.
       
   104         * @return None.
       
   105         */
       
   106         void SetEventHandler( MCFStarterEventHandler& aEventHandler );
       
   107         
       
   108 private: // New methods
       
   109 
       
   110     // Initialize device starting phase
       
   111     void InitDeviceStartingPhaseL();
       
   112 
       
   113         // Initialize loading plugins phase
       
   114         void InitLoadingPluginsPhaseL();
       
   115 
       
   116     // Load plug-in
       
   117     void LoadPlugInL( TUid aUid, TInt aImplVersion );
       
   118 
       
   119     // Release action plug-in
       
   120     void ReleasePlugInL( CCFActionPlugInThread* aActionPlugInThread, TBool aUpgrade );
       
   121 
       
   122     // @see MCFAsyncCleanupCallback
       
   123     void CleanupCompleted( CCFAsyncCleanup* aCleanup );
       
   124     
       
   125     // Call back function for asynchronous plug-in loading   
       
   126     static TInt LoaderCallBack( TAny* aLoaderInfo );
       
   127         
       
   128     // Prepares plug-in loaders
       
   129     void PrepareLoaderL( CImplementationInformation& aImplementationInfo );
       
   130         
       
   131     // Execute function for plug-in load
       
   132     void ExecuteLoaders();
       
   133 
       
   134 private:
       
   135 
       
   136     CCFActivatorEngineActionPluginManager( RActionCacheArray& aActionCache );
       
   137     void ConstructL();
       
   138 
       
   139 private:
       
   140 
       
   141     /** List of action plug-in threads */
       
   142     RPointerArray<CCFActionPlugInThread> iActionPlugInThreads;
       
   143 
       
   144     /** Reference to action cache */
       
   145     RActionCacheArray& iActionCache;
       
   146 
       
   147     /** List of async cleanup requests */
       
   148     RPointerArray<CCFAsyncCleanup> iCleanupList;
       
   149     
       
   150     // Loaders for plug-in loading
       
   151     RPointerArray<CAsyncCallBack> iLoaders;
       
   152         
       
   153     // Counter for loaded plug-ins
       
   154     TInt iLoadedCount;
       
   155         
       
   156         /*  
       
   157          * Event handler
       
   158          * Not own. Can be NULL
       
   159          */
       
   160         MCFStarterEventHandler* iEventHandler;
       
   161     };
       
   162 
       
   163 #endif