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.
19 #include <ecom/ecom.h>
20 #include "pluginmanager.h"
21 #include <ups/dialogcreator.h>
22 #include <ups/policyevaluator.h>
24 using namespace UserPromptService;
26 // CPluginManager -----------------------------------------------------------
27 CPluginManager::CPluginManager()
34 CPluginManager::~CPluginManager()
39 REComSession::FinalClose();
42 EXPORT_C CPluginManager* CPluginManager::NewL()
44 Factory function for plug-in managers.
45 @return A pointer to the new plug-in manager.
48 CPluginManager* self = new(ELeave) CPluginManager();
52 EXPORT_C void CPluginManager::Unload()
54 Schedules a deferred call to REComSession::FinalClose. This is
55 invoked once the last plug-in has been freed.
58 if (iPluginCount == 0)
60 REComSession::FinalClose();
69 EXPORT_C void CPluginManager::ReleasePlugin()
71 Called by CPlugin to decrement the count of active plug-ins. If
72 Unload has been called then REComSession::FinalClose is invoked when
73 the plug-in count reaches zero.
76 if (--iPluginCount == 0 && iUnload)
79 REComSession::FinalClose();
83 EXPORT_C CPlugin<CPolicyEvaluator>* CPluginManager::CreateEvaluatorL(const TUid& aEvaluatorId)
85 Instantiates a new CPolicyEvaluator plug-in.
86 @param aEvaluatorId The ECOM implementation UID of the policy evaluator to instantiate.
87 @return A pointer to the new policy evaluator plug-in.
90 CPolicyEvaluator* e = CPolicyEvaluator::NewL(aEvaluatorId);
91 CleanupStack::PushL(e);
92 CPlugin<CPolicyEvaluator>* p = new(ELeave) CPlugin<CPolicyEvaluator>(this, e);
98 EXPORT_C CPlugin<CDialogCreator>* CPluginManager::CreateDialogCreatorL(const TUid& aDialogCreatorId)
101 Instantiates a new CDialogCreator plug-in.
102 @param aDialogCreatorId The ECOM implementation UID of the dialog creator to instantiate.
103 @return A pointer to the new dialog creator plug-in.
105 CDialogCreator* d = CDialogCreator::NewL(aDialogCreatorId);
106 CleanupStack::PushL(d);
107 CPlugin<CDialogCreator>* p = new(ELeave) CPlugin<CDialogCreator>(this, d);
108 CleanupStack::Pop(d);