menufw/menufwui/mmextensions/mmextensionmanager/inc/mmecomobserver.h
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2007 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:   Menu Framewrok ECom observer
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_ECOM_OBSERVER_H
       
    19 #define C_ECOM_OBSERVER_H
       
    20 
       
    21 #include <e32base.h>	// For CActive, link against: euser.lib
       
    22 #include <e32std.h>		// For RTimer, link against: euser.lib
       
    23 
       
    24 class REComSession;
       
    25 
       
    26 /**
       
    27  * Class defining callback interface.
       
    28  */
       
    29 
       
    30 /**
       
    31  * MHNEcomInstallNotifierCallback is an interface contains function
       
    32  * executed when ECom plugin have changed. Interface is used by all
       
    33  * ECom observer implementations.
       
    34  *
       
    35  * @since S60 5.0
       
    36  * @ingroup group_mmextensions
       
    37  */
       
    38 class MHNEcomInstallNotifierCallback
       
    39     {
       
    40 public:
       
    41 	
       
    42 	/**
       
    43 	 * Refreshes list of MultimediaMenu plugins implementations.
       
    44 	 */
       
    45     virtual void EcomChangedL() = 0;    
       
    46     };
       
    47 
       
    48 /**
       
    49  * Class for observing ECom server
       
    50  */
       
    51 
       
    52 /**
       
    53  * CMMEcomObserver is a class represents ECom plugin. Class is
       
    54  * derived by all ECom plugin implemetations. Implementation
       
    55  * contains basic functionality related with ECom mechanism and
       
    56  * notification handling.
       
    57  *
       
    58  * @since S60 5.0
       
    59  * @ingroup group_mmextensions
       
    60  */
       
    61 NONSHARABLE_CLASS( CMMEcomObserver ) : public CActive
       
    62     {
       
    63 public:
       
    64     /**
       
    65      * Cancel and destroy.
       
    66      */
       
    67     ~CMMEcomObserver();
       
    68 
       
    69     /**
       
    70      * Two-phased constructor.
       
    71      * @param aCallback Pointer to ECom plugin callback.
       
    72      * @return Instance of the CMMEcomObserver class.
       
    73      */
       
    74     static CMMEcomObserver* NewL( MHNEcomInstallNotifierCallback* aCallback );
       
    75 
       
    76     /**
       
    77      * Two-phased constructor.
       
    78      * @param aCallback Pointer to ECom plugin callback.
       
    79      * @return Instance of the CMMEcomObserver class.
       
    80      */
       
    81     static CMMEcomObserver* NewLC( MHNEcomInstallNotifierCallback* aCallback );
       
    82 
       
    83 private:
       
    84     /**
       
    85      * Default C++ constructor.
       
    86      */
       
    87     CMMEcomObserver();
       
    88 
       
    89     /**
       
    90      * Second-phase constructor.
       
    91      * @param aCallback Pointer to ECom plugin callback.
       
    92      */
       
    93     void ConstructL( MHNEcomInstallNotifierCallback* aCallback );
       
    94 
       
    95 private:
       
    96     
       
    97     /**
       
    98      * From CActive. Handles completion.
       
    99      */
       
   100     void RunL();
       
   101 
       
   102     /**
       
   103      * Cancels active object.
       
   104      */
       
   105     void DoCancel();
       
   106 
       
   107     /**
       
   108      * Override to handle leaves from RunL(). Default implementation causes
       
   109      * the active scheduler to panic.
       
   110      * @param aError Currently error status.
       
   111      * @return Error code.
       
   112      */
       
   113     TInt RunError( TInt aError );
       
   114 
       
   115 private:
       
   116 
       
   117     /**
       
   118      * ECom handler
       
   119      * Own.
       
   120      */
       
   121     REComSession* iSession;
       
   122     
       
   123     /**
       
   124      * Callback pointer.
       
   125      * Not own.
       
   126      */
       
   127     MHNEcomInstallNotifierCallback* iCallback;
       
   128     
       
   129     };
       
   130 
       
   131 #endif // C_ECOM_OBSERVER_H