Update contrib.
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
25 #ifndef PLUGINMANAGER_H
26 #define PLUGINMANAGER_H
28 namespace UserPromptService
30 class CPolicyEvaluator;
32 class CPolicyEvaluatorPlugin;
33 class CDialogCreatorPlugin;
37 Container class for a plug-in that notifies a manager object when
41 class CPlugin : public CBase
44 CPlugin(CPluginManager* aManager, T* aImp);
48 CPluginManager* iManager; ///< The plug-in manager that tracks active plug-ins.
49 T* iImp; ///< The policy evaluator or dialog creator owned by this object.
53 Plug-in manager that tracks the number of plug-ins enabling REComSession::FinalClose()
54 to be deferred (after calling Unload) once all the plug-ins have been unloaded.
56 N.B. REComSession::FinalClose CANNOT be called from within an ECOM plug-in.
58 NONSHARABLE_CLASS(CPluginManager) : public CBase
60 template <class T> friend class CPlugin;
62 IMPORT_C static CPluginManager* NewL();
63 IMPORT_C CPlugin<CPolicyEvaluator>* CreateEvaluatorL(const TUid& aEvaluatorId);
64 IMPORT_C CPlugin<CDialogCreator>* CreateDialogCreatorL(const TUid& aDialogCreatorId);
65 IMPORT_C void Unload();
69 // For testing. Do not modify directly
70 TInt iPluginCount; ///< The number of active CPlugin objects. (do not modify)
73 IMPORT_C void ReleasePlugin();
75 TBool iUnload; ///< Indicates that a deferred call to REComSession::FinalClose is required
79 inline CPlugin<T>::CPlugin(CPluginManager* aManager, T* aImp) : iManager(aManager), iImp(aImp)
82 @param aManager The plug-in manager that tracks the number of plug-ins in existance.
83 @param aImp The ECOM implementation that this class managers.
89 inline T& CPlugin<T>::Imp()
91 Gets a reference to the plug-in implementation
92 @return The plug-in implementation.
99 inline CPlugin<T>::~CPlugin()
105 iManager->ReleasePlugin();
108 #endif // PLUGINMANAGER_H