contentstorage/srvsrc/cainstallnotifier.cpp
branchRCL_3
changeset 29 0efa10d348c0
equal deleted inserted replaced
28:053c6c7c14f3 29:0efa10d348c0
       
     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:  ?Description
       
    15  *
       
    16  */
       
    17 
       
    18 #include "cainstallnotifier.h"
       
    19 #include "cainstallstrategy.h"
       
    20 
       
    21 EXPORT_C CCaInstallNotifier* CCaInstallNotifier::NewL(
       
    22         MCaInstallListener& aListener, TNotificationType aNotificationType )
       
    23     {
       
    24     CCaInstallNotifier* self = new ( ELeave ) CCaInstallNotifier( aListener );
       
    25     CleanupStack::PushL( self );
       
    26     self->ConstructL( aNotificationType );
       
    27     CleanupStack::Pop( self );
       
    28     return self;
       
    29     }
       
    30 
       
    31 CCaInstallNotifier::~CCaInstallNotifier()
       
    32     {
       
    33     Cancel();
       
    34     iProperty.Close();
       
    35     delete iNotifierStrategy;
       
    36     }
       
    37 
       
    38 CCaInstallNotifier::CCaInstallNotifier( MCaInstallListener& aListener ) :
       
    39     CActive( EPriorityNormal ), iListener( aListener )
       
    40     {
       
    41     CActiveScheduler::Add( this );
       
    42     SetActive();
       
    43     }
       
    44 
       
    45 void CCaInstallNotifier::ConstructL( TNotificationType aNotificationType )
       
    46     {
       
    47     switch( aNotificationType )
       
    48 		{
       
    49         case ESisInstallNotification:
       
    50         	iNotifierStrategy = CCaSwiInstallStrategy::NewL( iProperty );
       
    51             break;
       
    52         case EUsifUninstallNotification:
       
    53         	iNotifierStrategy = CCaUsifUninstallStrategy::NewL( iProperty );
       
    54             break;
       
    55         case EJavaInstallNotification:
       
    56         	iNotifierStrategy = CCaJavaInstallStrategy::NewL( iProperty );
       
    57             break;
       
    58         default:
       
    59         	User::Leave( KErrNotSupported );
       
    60             break;
       
    61 		}
       
    62     iProperty.Subscribe( iStatus );
       
    63     }
       
    64 
       
    65 void CCaInstallNotifier::DoCancel()
       
    66     {
       
    67     iProperty.Cancel();
       
    68     }
       
    69 
       
    70 void CCaInstallNotifier::RunL()
       
    71     {
       
    72     SetActive();
       
    73     iProperty.Subscribe( iStatus );
       
    74     iNotifierStrategy->NotifyListenerL( iProperty, iListener );
       
    75     }
       
    76 
       
    77 TInt CCaInstallNotifier::RunError( TInt /*aError*/)
       
    78     {
       
    79     // No need to do anything
       
    80     return KErrNone;
       
    81     }
       
    82