authorisation/userpromptservice/policies/source/dialogcreator.cpp
changeset 8 35751d3474b7
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <ups/dialogcreator.h>
       
    20 #include <ups/upserr.h>
       
    21 #include <ecom/ecom.h>
       
    22 #include "upslog.h"
       
    23 
       
    24 using namespace UserPromptService;
       
    25 
       
    26 EXPORT_C CDialogCreator::CDialogCreator()
       
    27 /**
       
    28 Constructor
       
    29 */
       
    30 : CActive(EPriorityStandard)
       
    31 	{
       
    32 	}
       
    33 
       
    34 EXPORT_C CDialogCreator::~CDialogCreator()
       
    35 /**
       
    36 Destructor
       
    37 */
       
    38 	{
       
    39 	REComSession::DestroyedImplementation(iDtor_ID_Key);
       
    40 	}
       
    41 
       
    42 EXPORT_C CDialogCreator* CDialogCreator::NewL(const TUid& aDialogCreatorImplementationId)
       
    43 /**
       
    44 Creates a new dialog creator.
       
    45 @param	aDialogCreatorImplementationId	The UID of the dialog creator implemenation
       
    46 										as specified in the policy file.
       
    47 
       
    48 @return A pointer to the new dialog creator implementation.
       
    49 */
       
    50 	{
       
    51 	TAny* plugin(0);
       
    52 	DEBUG_PRINTF2(_L8("Instantiating dialog creator 0x%08x"), aDialogCreatorImplementationId);
       
    53 	TRAPD(err, plugin = 
       
    54 	REComSession::CreateImplementationL(aDialogCreatorImplementationId,
       
    55 		_FOFF(CDialogCreator,iDtor_ID_Key)));
       
    56 
       
    57 	if (err != KErrNone)
       
    58 		{
       
    59 		DEBUG_PRINTF3(_L8("Failed to instantiate dialog creator 0x%08x, err = %d"),
       
    60 					  aDialogCreatorImplementationId.iUid, err);
       
    61 		}
       
    62 
       
    63 	if (err == KErrNotFound)
       
    64 		{
       
    65 		err = KErrUpsMissingDialogCreator;	
       
    66 		}
       
    67 	User::LeaveIfError(err);	 
       
    68 	return reinterpret_cast<CDialogCreator*>(plugin);		
       
    69 	}
       
    70 
       
    71 EXPORT_C TInt CDialogCreator::GetExtension(TUint aExtensionId, TAny*& a0, TAny* a1)
       
    72 /**
       
    73 Allows extension of this interface. Calls Extension_
       
    74 
       
    75 @param aExtensionId		The UID of the interface to instantiate.
       
    76 @param a0				A reference to a pointer that should be set to the newly
       
    77 						instantiated object.
       
    78 @param a1				Data specific to the instantiate of the specified interface.
       
    79 
       
    80 @return KErrNone if the extension is supported or KErrNotSupported if the extension is not
       
    81 		recognised; otherwise, a system wide error may be returned.
       
    82 */
       
    83 	{
       
    84 	return Extension_(aExtensionId, a0, a1);
       
    85 	}
       
    86 
       
    87 EXPORT_C TInt CDialogCreator::Extension_(TUint aExtensionId, TAny*& a0, TAny* a1)
       
    88 	{
       
    89 	return CActive::Extension_(aExtensionId, a0, a1);
       
    90 	}