dependencies/SchemeHandler.inl
branchv5backport
changeset 31 a3e98f9c292b
equal deleted inserted replaced
30:f9f9f96b1873 31:a3e98f9c292b
       
     1 /*
       
     2 * Copyright (c) 2002 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 *      Implementation of class Scheme Dispatcher.   
       
    16 *      
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include <SchemeDefs.hrh>
       
    24 #include <ecom/ecom.h>		// For REComSession
       
    25 
       
    26 // ================= CONSTANTS =======================
       
    27 
       
    28 // ================= MEMBER FUNCTIONS =======================
       
    29 
       
    30 // ---------------------------------------------------------
       
    31 // CSchemeHandler::NewL()
       
    32 // ---------------------------------------------------------
       
    33 //
       
    34 CSchemeHandler* CSchemeHandler::NewL( const TDesC& aUrl )
       
    35 {
       
    36 	// retreiving the scheme
       
    37 	const TUid KSchemeHandlerDefinitionUid = { SCHEME_INTERFACE_DEF };
       
    38 
       
    39 	TInt colonPos = aUrl.Locate( ':' );
       
    40 	if ( colonPos <= 0 )
       
    41 		{
       
    42 		// It should not happen since this char was found in DocumentHandler alredy
       
    43  		User::Leave( KErrArgument );
       
    44 		}
       
    45 
       
    46 	// Creating the right implementation
       
    47 	TEComResolverParams resolverParams;
       
    48 
       
    49     HBufC8* scheme = HBufC8::NewLC( colonPos );
       
    50     scheme->Des().Append( aUrl.Left( colonPos ) );
       
    51     scheme->Des().LowerCase();
       
    52     resolverParams.SetDataType( scheme->Des() );
       
    53     resolverParams.SetGenericMatch( ETrue ); //To enable default scheme handlers
       
    54 
       
    55     TAny* ptr = REComSession::CreateImplementationL(KSchemeHandlerDefinitionUid, 
       
    56 												    _FOFF( CSchemeHandler, iDtor_ID_Key ), 
       
    57 												    (TAny*)&aUrl,
       
    58 												    resolverParams);
       
    59 
       
    60 	CleanupStack::PopAndDestroy(); // urlCopy
       
    61 	
       
    62 	CSchemeHandler* schemeHandler = REINTERPRET_CAST( CSchemeHandler*, ptr );
       
    63 
       
    64 	return schemeHandler;
       
    65 	}
       
    66 
       
    67 // ---------------------------------------------------------
       
    68 // CSchemeHandler::~CSchemeHandler()
       
    69 // ---------------------------------------------------------
       
    70 //
       
    71 CSchemeHandler::~CSchemeHandler()
       
    72     {
       
    73     if( iParamList )
       
    74         {
       
    75         delete iParamList;
       
    76         }
       
    77 	REComSession::DestroyedImplementation( iDtor_ID_Key );
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------
       
    81 // CSchemeHandler::SetParameterList()
       
    82 // ---------------------------------------------------------
       
    83 //
       
    84 void CSchemeHandler::SetParameterList(CAiwGenericParamList* aParamList) // Takes ownership
       
    85     {
       
    86     iParamList = aParamList;
       
    87     }
       
    88 
       
    89 // Reserved functions
       
    90 TInt CSchemeHandler::Reserved_1( TAny* /*aAny*/ )
       
    91 	{
       
    92 	return 0;
       
    93 	}
       
    94 TInt CSchemeHandler::Reserved_2( TAny* /*aAny*/ )
       
    95 	{
       
    96 	return 0;
       
    97 	}