appinstaller/AppinstUi/Daemon/Inc/daemoninstaller.h
changeset 0 ba25891c3a9e
child 25 7333d7932ef7
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004-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 "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 #include <e32base.h>
       
    19 #include <f32file.h>
       
    20 #include <apgcli.h>
       
    21 #include "ShutdownWatcher.h"    // MShutdownObserver
       
    22 
       
    23 // Forward declarations
       
    24 	
       
    25 class CPreviouslyInstalledAppsCache;
       
    26 class CInstallationFailedAppsCache;
       
    27 
       
    28 namespace Swi
       
    29 {
       
    30 // Modified for S60
       
    31 class CSilentLauncher;
       
    32 class CDialogWrapper;   
       
    33 class CProgramStatus; //For uninstaller
       
    34         
       
    35 /**
       
    36 * Describes the installation behaviour of any sis files found by the Daemon
       
    37 */
       
    38 class MDaemonInstallBehaviour
       
    39     {
       
    40     public:
       
    41         
       
    42         /**
       
    43          * Notify plug-in that daemon has complete media processing.
       
    44          * Plug-in can start installation.          
       
    45          */
       
    46         virtual void DoNotifyMediaProcessingComplete() = 0; 
       
    47  
       
    48         /**
       
    49          * Returns ture is plugin is loaded.
       
    50          * 
       
    51          * @Return TBool ETrue if plug-in is available.          
       
    52          */        
       
    53         virtual TBool IsPlugin() = 0;
       
    54 
       
    55         /**
       
    56          * This function does check if plugin is all ready notified that media
       
    57          * processing is started. If not it calls MediaProcessingStart.
       
    58          * 
       
    59          * @Return TBool ETrue if plug-in is available.          
       
    60          */            
       
    61         virtual void NotifyPlugin() = 0;
       
    62           
       
    63         /**
       
    64          * Reguest plug-in to install given package.
       
    65          *  
       
    66          * @param aDrive aSisFile Package file.
       
    67          */             
       
    68         virtual void RequestPluginInstall( TDesC& aSisFile ) = 0;              
       
    69     };
       
    70 
       
    71 /**
       
    72 * The Daemon SIS installer
       
    73 */
       
    74 class CSisInstaller : public CActive, public MShutdownObserver
       
    75     {
       
    76     public:
       
    77 
       
    78         enum TDSisInstallerState
       
    79             {           
       
    80 #ifdef RD_MULTIPLE_DRIVE                      
       
    81             EDSisInstallerStateIdle,
       
    82             EDSisInstallerStateInstallerBusy,
       
    83             EDSisInstallerStateInstalling,
       
    84             EDSisInstallerStateCompleted
       
    85 #else
       
    86             EDSisInstallerStateIdle,
       
    87             EDSisInstallerStateInstallerBusy,
       
    88             EDSisInstallerStateInstalling     
       
    89 #endif //RD_MULTIPLE_DRIVE 
       
    90             };        
       
    91 
       
    92         /**
       
    93         * Symbian construction (for member variables)
       
    94         */
       
    95         static CSisInstaller* NewL(
       
    96                 MDaemonInstallBehaviour* aDaemonBehaviour,
       
    97                 CProgramStatus& aMainStatus ); //For uninstaller
       
    98 		
       
    99         /**
       
   100         * C++ destructor
       
   101         */
       
   102         ~CSisInstaller();
       
   103 		
       
   104         /**
       
   105         Adds a file to the list of files to be installed
       
   106         @param aFileName The full name and path of the file to be installed
       
   107         */
       
   108         void AddFileToInstallL(const TDesC& aFileName);
       
   109 		
       
   110         /**
       
   111         * Install the specified sis file
       
   112         */
       
   113         void StartInstallingL();
       
   114         
       
   115 #ifdef RD_MULTIPLE_DRIVE 
       
   116         /**
       
   117         * Returns status of installer.
       
   118         */
       
   119         TBool IsInstalling();        
       
   120 #endif                
       
   121 
       
   122     private: // From CActive
       
   123 	
       
   124         /**
       
   125         * Called by Cancel when a request from this class is outstanding
       
   126         */
       
   127         void DoCancel();
       
   128                 
       
   129         /**
       
   130         * Asynchronous completion request processing
       
   131         */
       
   132         void RunL();
       
   133 	
       
   134         /**
       
   135         * Handles any Leaves from the RunL
       
   136         */
       
   137         TInt RunError(TInt aError);
       
   138         
       
   139     private:  // From MShutdownObserver
       
   140         /**
       
   141         * Called by CShutdownWatcher when the system is closing down
       
   142         */
       
   143         void NotifyShuttingDown();        
       
   144 
       
   145     private:
       
   146         /**
       
   147         * C++ constructor
       
   148         */
       
   149         CSisInstaller( MDaemonInstallBehaviour* aDaemonBehaviour );
       
   150 	
       
   151         /**
       
   152         * 2nd phase constructor
       
   153         */
       
   154         void ConstructL( CProgramStatus& aMainStatus ); //Uninstaller
       
   155 	      
       
   156         /**
       
   157         * Self request completion
       
   158         */
       
   159         void CompleteSelf();
       
   160         
       
   161         /**
       
   162         * Completes the installation procedure.
       
   163         */
       
   164         void InstallationCompleted( TInt aResult );
       
   165         
       
   166         /**
       
   167         * Indicates if this package was ever installed or not.
       
   168         */
       
   169         TBool NeedsInstallingL( const TDesC& aPackageName );
       
   170 
       
   171         /**
       
   172         * Indicates if the media is present in the drive.
       
   173         */
       
   174         TBool IsMediaPresent( TChar aDrive );
       
   175 
       
   176         /**
       
   177         * Indicates if this package is valid.
       
   178         */
       
   179         TBool IsValidPackageL( const TDesC& aPackageName );      
       
   180         	          
       
   181 	
       
   182     private:
       
   183                
       
   184         MDaemonInstallBehaviour* iDaemonBehaviour;	
       
   185         // The state
       
   186         TDSisInstallerState iState;	
       
   187         RPointerArray<HBufC> iFilesToInstall;	
       
   188         // Sis files and location
       
   189         TBuf<KMaxFileName> iSisFile;
       
   190         TInt iFileIndex;	
       
   191         // Timer and time step
       
   192         RTimer iTimer;                
       
   193         CSilentLauncher* iInstallLauncher;
       
   194         CDialogWrapper* iDialogs;
       
   195         TInt iInstallErr;
       
   196         RFs iFs;
       
   197         RApaLsSession iApaSession;
       
   198         // Pointer to the already ever installed checker class
       
   199         CPreviouslyInstalledAppsCache* iPreviouslyInstalledAppsCache;
       
   200         // Pointer to failed installation cache.
       
   201         CInstallationFailedAppsCache* iInstallationFailedAppsCache;
       
   202 		
       
   203 #ifdef RD_MULTIPLE_DRIVE 
       
   204         // Defines state of Installer 
       
   205         TDSisInstallerState iInstallerState;
       
   206 #endif     		
       
   207         // PkgID
       
   208         TUid iCurrentPackageId;
       
   209         CShutdownWatcher* iShutdownWatcher;
       
   210         // For uninstaller
       
   211         TInt iGeneralProcessStatus;
       
   212         CProgramStatus* iProgramStatus;   
       
   213         // For plugin support
       
   214         TBool iUpdateCache;
       
   215     };		
       
   216 }
       
   217