homescreenpluginsrv/hspsmanager/inc/hspsinstallationhandler.h
branchRCL_3
changeset 114 a5a39a295112
child 118 8baec10861af
equal deleted inserted replaced
113:0efa10d348c0 114:a5a39a295112
       
     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:  
       
    15 *
       
    16 *  Installation Handler.
       
    17 * 
       
    18 *  
       
    19 *  ChspsInstallatioHandler is a server-side implementation of HSPS Configuration 
       
    20 *  Management Services.
       
    21 *  The Installation Service is intended to serve the HSPS SAPI client only.
       
    22 *   
       
    23 *  Services:
       
    24 *  1) reads installation instructions from a manifest-file 
       
    25 *  2) parses and updates xml configuration into a binary representation (ODT's DOM)
       
    26 *  3) stores various resources, localized and common, into Plug-in Repository  
       
    27 *     (a.k.a. Definition Repository)
       
    28 *    
       
    29 *  When installation is successful, Installation Handler utilizes HSPS Definition 
       
    30 *  Repository to store the results. All resources are stored on Definition Repository 
       
    31 *  and their related information is stored on the list of ChspsResource-objects 
       
    32 *  - a resource list. This list of ChspsResource-objects is called Resource List. 
       
    33 *  For more information, see hspsResource documentation.
       
    34 * 
       
    35 *  On theme updates, Installation Handler deploys ChspsSecurityEnforcer to control 
       
    36 *  update rights. For more information, see ChspsSecurityEnforcer documentation  
       
    37 *  and ChspsInstallatioHandler documentation
       
    38 *
       
    39 *
       
    40 */
       
    41 
       
    42 
       
    43 
       
    44 #ifndef __hspsINSTALLATIONHANDLER_H__
       
    45 #define __hspsINSTALLATIONHANDLER_H__
       
    46 
       
    47 #include <contenthandler.h>
       
    48 #include <parser.h>
       
    49 
       
    50 #include "hspsthememanagement.h"
       
    51 #include "hspsresource.h"
       
    52 #include "hspsresult.h"
       
    53 
       
    54 #ifdef HSPS_LOG_ACTIVE
       
    55 class ChspsLogBus;
       
    56 #endif
       
    57 class CRepository;
       
    58 class ChspsThemeServer;
       
    59 class ChspsDefinitionRepository;
       
    60 class ChspsDefinitionEngineInterface;
       
    61 class ChspsODT;
       
    62 class ChspsDomNode;
       
    63 class ChspsDomStringPool;
       
    64 class ChspsSecurityEnforcer;
       
    65 class ChspsResource;
       
    66 class ChspsDomList; 
       
    67 
       
    68 using namespace Xml;
       
    69 
       
    70 #if defined(WINSCW) || defined(__WINS__)
       
    71 const ThspsFamily KDefaultFamily = EhspsFamilyQhd_tch;
       
    72 #endif
       
    73 
       
    74 enum TInstallationMode
       
    75     {
       
    76     EAsynchronousObject,
       
    77     EServiceHandler
       
    78     };
       
    79 
       
    80 /**
       
    81 *  Class ChspsInstallationHandler.
       
    82 *  ChspsInstallationHandler performs all theme installation related functionality for hspsThemeServer.
       
    83 *
       
    84 *  Class inheritance:
       
    85 *  ==================
       
    86 *  ChspsInstallationHandler implements MhspsInstallationService from HSPS Theme Management Service
       
    87 *  and MContentHandler for XML-parsing of manifest file. For more information, see the architecture 
       
    88 *  description in the beginning of this file. 
       
    89 *
       
    90 *  Functionality:
       
    91 *  ============== 
       
    92 *  ChspsInstallationHandler offer high- and low-level API-functionality. High-level and low-level 
       
    93 *  calls are diffrentiated by their parametrization. High-level parametrization is directed to the
       
    94 *  be used by applications which need human readable data and offer a user interface. Low-level 
       
    95 *  parametrization is directed to the machine-originated requestors like OTA Push or DM (Device 
       
    96 *  Management) sub-systems where data is not needed to understand semanticly.
       
    97 *  Processing the installation task can be synchronous or asynchronous. Synchronous mode is 
       
    98 *  applied everytime an installation is initiated. Application Theme may include resources. 
       
    99 *  Importing these resources to the target device may need conversions. Such resources like some
       
   100 *  audio files etc., can be imported directly, however, most of the image-resources must be fitted
       
   101 *  for the target device because target screen device's color depth and/or pixel density varies.
       
   102 *  In this case, the needed conversions will be executed asynchronously. Asynchronous installation
       
   103 *  is executed in phases - resource by resource. Client application must initiate asynchronous mode
       
   104 *  by calling hspsInstallNextPhaseL() after testing that the synchronous call hspsInstallTheme() 
       
   105 *  has returned EhspsInstallPhaseSuccess return code. This means that there are resources to convert 
       
   106 *  asynchronoulsly. The rest of the asynchronous installation phases will be executed automatically, 
       
   107 *  however, installation can be interrupted by calling hspsCancelInstallTheme() at any time. 
       
   108 *  If installation is canceled, installation handler initiates roll-back functionality removing 
       
   109 *  inconsistent installation.
       
   110 *  Installation Service uses specific manifest-file format to get informed about the xml, css, dtd,
       
   111 *  and resource files to be installed. Resource files might be locale-specific or generic as well.
       
   112 *  HSPS Definition Repository takes care of saving everything on their appropriate places in the
       
   113 *  target device. Repository, i.e. theme storage, is loacted on hspsThemeServer's private-folder. 
       
   114 *  The storage is organized by the information contained in ODT-header.
       
   115 *  Locales are instructed in manifest file also. Manifest file's file-extension must be .dat, but
       
   116 *  actually, the file-name can be whatever, however, when low-level parametrization is used, the 
       
   117 *  name must be "manifest.dat" and it must be the last file extracted from the installation package.
       
   118 *  For more information of manifest-file format, see "HSPS Manifest File User Guide.doc".
       
   119 *
       
   120 *  Installation functions can return one of the following ThspsServiceCompletedMessage-codes:
       
   121 *  - EhspsInstallThemeSuccess,
       
   122 *  - EhspsInstallPhaseSuccess, or
       
   123 *  - EhspsInstallThemeFailed.
       
   124 *
       
   125 *  Client application must implement MhspsThemeManagementServiceObserver-interface and listen the 
       
   126 *  messages mentionaed. Let it be emphasised that both synchronous and asynchronous calls can return
       
   127 *  the codes above. Installation functions may also return one of the following codes:
       
   128 *  - EhspsServiceRequestSheduled, or
       
   129 *  - EhspsServiceRequestError.
       
   130 *
       
   131 *  For explanation of the meanings of these messages, see ThspsServiceCompletedMessage-documentation.
       
   132 *  
       
   133 *  @ingroup group_hspsserversession
       
   134 *  @lib hspsThemeServer.exe
       
   135 *  @since S60 5.0
       
   136 */
       
   137 class ChspsInstallationHandler : public CBase, 
       
   138                                  public MhspsInstallationService, 
       
   139                                  public MContentHandler
       
   140     {
       
   141     public:
       
   142         
       
   143     public:
       
   144         /**
       
   145         * Two-phased constructor.
       
   146         */
       
   147         static ChspsInstallationHandler* NewL( ChspsThemeServer& aThemeServer );
       
   148         static ChspsInstallationHandler* NewLC( ChspsThemeServer& aThemeServer );
       
   149 
       
   150         /**
       
   151         * Destructor.
       
   152         */      
       
   153         ~ChspsInstallationHandler();
       
   154   
       
   155     public:  // New functions
       
   156 
       
   157         /**
       
   158         * ServiceInstallThemeL
       
   159         * Starts the actual installation in ChspsInstallationHandler.
       
   160         * @since S60 5.0
       
   161         * @param aMessage Message from client
       
   162         */      
       
   163         void ServiceInstallThemeL(
       
   164                 const RMessage2& aMessage);
       
   165       
       
   166         /**
       
   167         * ServiceInstallNextPhaseL
       
   168         * Starts subsequent installation phases.
       
   169         * @since S60 5.0
       
   170         * @param aMessage Message from client
       
   171         */            
       
   172         void ServiceInstallNextPhaseL(
       
   173                 const RMessage2& aMessage);
       
   174       
       
   175         /** 
       
   176         * hspsInstallNextPhase
       
   177         * @since S60 5.0
       
   178         * This is server-side only function.
       
   179         * @param aHeaderData will return ODT-header of the latest installation phase in serialized 
       
   180         *        (i.e. marshalled)
       
   181         *        data mode. This follows the low-level parametrization schema.  
       
   182         * @param aRequestStatus will return the status of the asynchronous request returned by 
       
   183         *        installer.
       
   184         * @return TInthspsServiceCompletedMessage expressing the result of the call.
       
   185         */
       
   186         void hspsInstallNextPhaseL( 
       
   187                 TDes8& aHeaderData, 
       
   188                 TRequestStatus& aRequestStatus );
       
   189         
       
   190         /** 
       
   191         * CheckAutoInstallationValidityL
       
   192         * Checks if auto installation of a theme is permitted
       
   193         * @since S60 5.0
       
   194         * This is server-side only function.
       
   195         * @return TBool ETrue if auto installation can proceed.
       
   196         */
       
   197         TBool CheckAutoInstallationValidityL();
       
   198 
       
   199 #ifdef HSPS_LOG_ACTIVE        
       
   200         /** 
       
   201         * Set log bus.
       
   202         */
       
   203         void SetLogBus( ChspsLogBus* aLogBus );
       
   204 #endif        
       
   205     
       
   206         /**
       
   207          * Disables "configuration was installed" notifications
       
   208          * @since S60 5.0
       
   209          */
       
   210         void DisableNotifications();
       
   211         
       
   212         /**
       
   213          * Disables installation of UDA and eMMC content.
       
   214          * @since S60 5.2
       
   215          */
       
   216         void DisableUdaEmmcInstallations();
       
   217         
       
   218     public: // Functions from base classes
       
   219 
       
   220         /**
       
   221         * From MhspsInstallationService hspsInstallTheme
       
   222         * 
       
   223         * @since S60 5.0
       
   224         * @param aManifestFileName is the full path to the installation script file - a manifest 
       
   225         *        file.
       
   226         * @param aHeader is an empty ChspsODT-object in which a valid ODT-header of the newly 
       
   227         *        installed theme will be returned if the request is successful. The use of 
       
   228         *        ChspsODT-type parameter follows the high-level parametrization schema.
       
   229         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   230         */
       
   231         inline ThspsServiceCompletedMessage hspsInstallTheme( 
       
   232                 const TDesC& /*aManifestFileName*/, 
       
   233                 ChspsODT& /*aHeader*/ );
       
   234         
       
   235         /**
       
   236         * From MhspsInstallationService hspsInstallTheme
       
   237         * 
       
   238         * @since S60 5.0
       
   239         * @param aManifestFileName is full path of the installation script file - a manifest file
       
   240         * @param aHeaderData will return ODT-header of the newly installed theme in serialized 
       
   241         *        (i.e. marshalled)
       
   242         *        data mode. This follows the low-level parametrization schema.  
       
   243         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   244         */
       
   245         ThspsServiceCompletedMessage hspsInstallTheme( 
       
   246                 const TDesC& aManifestFileName, 
       
   247                 TDes8& aHeaderData );
       
   248         
       
   249         /**
       
   250          * Parses the manifest file and requests installation of next phases.
       
   251          * @since S60 5.2
       
   252          * @param aManifest is full path of the installation script file - a manifest file
       
   253          */
       
   254         void DoInstallThemeL(
       
   255                 const TDesC& aManifest );
       
   256                         
       
   257         /**
       
   258         * From MhspsInstallationService hspsInstallNextPhaseL
       
   259         * 
       
   260         * @since S60 5.0
       
   261         * @param aHeader is an empty ChspsODT-object in which a valid ODT-header of the latest 
       
   262         *        installation phase completed if the request was successful. The use of ChspsODT-type
       
   263         *        parameter follow the high-level parametrization schema.
       
   264         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   265         */
       
   266         inline ThspsServiceCompletedMessage hspsInstallNextPhaseL( 
       
   267                 ChspsODT& /*aHeader*/ );
       
   268 
       
   269         /**
       
   270         * From MhspsInstallationService hspsInstallNextPhaseL
       
   271         * 
       
   272         * @since S60 5.0
       
   273         * @param aHeaderData will return ODT-header of the latest installation phase in 
       
   274         *        serialized (i.e. marshalled) data mode. This follows the low-level 
       
   275         *        parametrization schema.  
       
   276         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   277         */
       
   278         ThspsServiceCompletedMessage hspsInstallNextPhaseL( 
       
   279                 TDes8& aHeaderData );
       
   280         
       
   281         /**
       
   282         * From MhspsInstallationService hspsCancelInstallTheme
       
   283         * 
       
   284         * @since S60 5.0
       
   285         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   286         */
       
   287         ThspsServiceCompletedMessage hspsCancelInstallTheme();
       
   288 
       
   289         //From MContentHandler
       
   290         
       
   291         /**
       
   292         * OnStartDocumentL
       
   293         * @since S60 5.0
       
   294         * This method is a callback to indicate the start of the document.
       
   295         * @param  aDocParam Specifies the various parameters of the document.
       
   296         * @arg  aDocParam.iCharacterSetName The character encoding of the document.
       
   297         * @param  aErrorCode is the error code. 
       
   298         * If this is not KErrNone then special action may be required.
       
   299         */
       
   300         inline void OnStartDocumentL(
       
   301                 const RDocumentParameters& aDocParam, 
       
   302                 TInt aErrorCode);
       
   303 
       
   304         /**
       
   305         * OnEndDocumentL
       
   306         * @since S60 5.0
       
   307         * This method is a callback to indicate the end of the document.
       
   308         * @param  aErrorCode is the error code. 
       
   309         * If this is not KErrNone then special action may be required.
       
   310         */
       
   311         inline void OnEndDocumentL(
       
   312                 TInt aErrorCode);
       
   313 
       
   314         /**
       
   315         * OnStartElementL
       
   316         * @since S60 5.0
       
   317         * This method is a callback to indicate an element has been parsed.
       
   318         * @param  aElement is a handle to the element's details.
       
   319         * @param  aAttributes contains the attributes for the element.
       
   320         * @param  aErrorCode is the error code.
       
   321         *    If this is not KErrNone then special action may be required.
       
   322         */
       
   323         void OnStartElementL(
       
   324                 const RTagInfo& aElement, 
       
   325                 const RAttributeArray& aAttributes, 
       
   326                 TInt aErrorCode);
       
   327 
       
   328         /**
       
   329         * OnEndElementL
       
   330         * @since S60 5.0
       
   331         * This method is a callback to indicate the end of the element has been reached.
       
   332         * @param  aElement is a handle to the element's details.
       
   333         * @param  aErrorCode is the error code.
       
   334         * If this is not KErrNone then special action may be required.
       
   335         */
       
   336         void OnEndElementL(
       
   337                 const RTagInfo& aElement, 
       
   338                 TInt aErrorCode);
       
   339 
       
   340         /**
       
   341         * OnContentL
       
   342         * @since S60 5.0
       
   343         * This method is a callback that sends the content of the element.
       
   344         * Not all the content may be returned in one go. The data may be sent in chunks.
       
   345         * When an OnEndElementL is received this means there is no more content to be sent.
       
   346         * @param  aBytes is the raw content data for the element. 
       
   347         *     The client is responsible for converting the data to the 
       
   348         *     required character set if necessary.
       
   349         *     In some instances the content may be binary and must not be converted.
       
   350         * @param  aErrorCode is the error code.
       
   351         *     If this is not KErrNone then special action may be required.
       
   352         */
       
   353         void OnContentL(
       
   354                 const TDesC8& aBytes, 
       
   355                 TInt aErrorCode);
       
   356   
       
   357         /**
       
   358         * OnStartPrefixMappingL
       
   359         * @since S60 5.0
       
   360         * This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping.
       
   361         * This method is always called before the corresponding OnStartElementL method.
       
   362         * @param  aPrefix is the Namespace prefix being declared.
       
   363         * @param  aUri is the Namespace URI the prefix is mapped to.
       
   364         * @param  aErrorCode is the error code.
       
   365         *         If this is not KErrNone then special action may be required.
       
   366         */
       
   367         inline void OnStartPrefixMappingL(
       
   368                 const RString& aPrefix, 
       
   369                 const RString& aUri, 
       
   370                 TInt aErrorCode);
       
   371 
       
   372         /**
       
   373         * OnEndPrefixMappingL
       
   374         * @since S60 5.0
       
   375         * This method is a notification of the end of the scope of a prefix-URI mapping.
       
   376         * This method is called after the corresponding DoEndElementL method.
       
   377         * @param aPrefix is the Namespace prefix that was mapped.
       
   378         * @param aErrorCode is the error code.
       
   379         *        If this is not KErrNone then special action may be required.
       
   380         */
       
   381         inline void OnEndPrefixMappingL(
       
   382                 const RString& aPrefix, 
       
   383                 TInt aErrorCode);
       
   384 
       
   385         /**
       
   386         * OnIgnorableWhiteSpaceL
       
   387         * @since S60 5.0
       
   388         * This method is a notification of ignorable whitespace in element content.
       
   389         * @param  aBytes are the ignored bytes from the document being parsed.
       
   390         * @param  aErrorCode is the error code.
       
   391         * If this is not KErrNone then special action may be required.
       
   392         */
       
   393         inline void OnIgnorableWhiteSpaceL(
       
   394                 const TDesC8& aBytes, 
       
   395                 TInt aErrorCode);
       
   396 
       
   397         /**
       
   398         * OnSkippedEntityL
       
   399         * @since S60 5.0
       
   400         * This method is a notification of a skipped entity. If the parser encounters an 
       
   401         * external entity it does not need to expand it - it can return the entity as aName 
       
   402         * for the client to deal with.
       
   403         * @param  aName is the name of the skipped entity.
       
   404         * @param  aErrorCode is the error code.
       
   405         * If this is not KErrNone then special action may be required.
       
   406         */
       
   407         inline void OnSkippedEntityL(
       
   408                 const RString& aName, 
       
   409                 TInt aErrorCode);
       
   410 
       
   411         /**
       
   412         * OnProcessingInstructionL
       
   413         * @since S60 5.0
       
   414         * This method is a receive notification of a processing instruction.
       
   415         * @param  aTarget is the processing instruction target.
       
   416         * @param  aData is the processing instruction data. If empty none was supplied.
       
   417         * @param  aErrorCode is the error code.
       
   418         * If this is not KErrNone then special action may be required.
       
   419         */
       
   420         inline void OnProcessingInstructionL(
       
   421                 const TDesC8& aTarget, 
       
   422                 const TDesC8& aData,
       
   423                 TInt aErrorCode);
       
   424 
       
   425         /**
       
   426         * OnError
       
   427         * @since S60 5.0
       
   428         * This method indicates an error has occurred.
       
   429         * @param  aError is the error code
       
   430         */
       
   431         inline void OnError(
       
   432                 TInt aErrorCode);
       
   433 
       
   434         /**
       
   435         * GetExtendedInterface
       
   436         * @since S60 5.0
       
   437         * This method obtains the interface matching the specified uid.
       
   438         * @return 0 if no interface matching the uid is found.
       
   439         *         Otherwise, the this pointer cast to that interface.
       
   440         * @param  aUid the uid identifying the required interface.
       
   441         */
       
   442         inline TAny* GetExtendedInterface(
       
   443                 const TInt32 aUid);
       
   444   
       
   445     protected:  // New functions
       
   446        
       
   447         /**
       
   448         * Rolls back the installation if it fails or is cancelled.
       
   449         * @since S60 5.0
       
   450         * @param aOdt The ODT of the theme
       
   451         */
       
   452         void RollBackL( ChspsODT& aOdt );
       
   453  
       
   454     private:    
       
   455         /**
       
   456         * C++ default constructor.
       
   457         * @since S60 5.0
       
   458         */
       
   459         ChspsInstallationHandler( 
       
   460                 ChspsThemeServer& aThemeServer );
       
   461           
       
   462         /**
       
   463         * By default Symbian 2nd phase constructor is private.
       
   464         * @since S60 5.0
       
   465         */ 
       
   466         void ConstructL();
       
   467       
       
   468         /**
       
   469         * CheckHeaderL
       
   470         * Checks the header information and stores it to iOdt
       
   471         * @since S60 5.0
       
   472         */
       
   473         void CheckHeaderL();
       
   474         
       
   475         /**
       
   476         * InstallOdtL
       
   477         * Installs the theme skeleton
       
   478         * @since S60 5.0
       
   479         */
       
   480         void InstallSkeletonL( 
       
   481                 ThspsServiceCompletedMessage& aReturnMsg );        
       
   482                 
       
   483         /**
       
   484          * Adds parsed resource into a temporary resource list, from which the resources
       
   485          * are applied to an ODT instance at later phase
       
   486          * @since S60 5.0
       
   487          * @param aArray is either iResourceArray or iLocalizedResourceArray instance 
       
   488          * @param aFilename is full path and filename to the resource in an installation folder
       
   489          * @param aLanguage is language of the resource (use ELangNone if it's a common resource)
       
   490          * @param aResourceType is MIME type or NULL      
       
   491          * @param aMimetype (Optional)   
       
   492          * @param aTag (Optional)
       
   493          */
       
   494         void AddResourceL(
       
   495                 CArrayPtrSeg<ChspsResource>& aArray, 
       
   496                 const TPtrC aFilename,
       
   497                 const TLanguage aLanguage,
       
   498                 const ThspsResourceType aResourceType,
       
   499                 const TPtrC8 aMimetype,
       
   500                 const TPtrC8 aTag );
       
   501                                 
       
   502         /**
       
   503         * CleanupL
       
   504         * Executes cleaning of the target folder prior to the installation process
       
   505         * @since S60 5.0
       
   506         */
       
   507         void CleanupL( 
       
   508                 const ChspsODT& aUpdateMask );
       
   509                 
       
   510         /**
       
   511          * ImportPluginsL         
       
   512          * Imports plug-in DOMs referenced by application configuration, other 
       
   513          * configuration types are ignored.
       
   514          * @since S60 5.0
       
   515          */
       
   516         void ImportPluginsL( );
       
   517         
       
   518         /**
       
   519         * ParseDocumentL
       
   520         * Calls the definition engine to create the dom 
       
   521         * @since S60 5.0
       
   522         */
       
   523         void ParseDocumentL( 
       
   524                 ChspsODT& aOdt );
       
   525         
       
   526         /**
       
   527         * CompleteRequestL
       
   528         * Completes the request message
       
   529         * @since S60 5.0
       
   530         */
       
   531         void CompleteRequestL(const ThspsServiceCompletedMessage aReturnMessage, 
       
   532                 const TDesC8& aHeaderData = KNullDesC8 );
       
   533 
       
   534         /**
       
   535         * Send update notifications if necessary.
       
   536         * @since S60 5.0
       
   537         */        
       
   538         void NotifyOdtUpdatedL();        
       
   539 
       
   540         /**
       
   541         * Get active application configurations.
       
   542         * @since S60 5.0        
       
   543         * @param aActiveAppConfs    Target list for active application configurations.
       
   544         */        
       
   545         void GetActiveAppConfsL( CArrayPtrSeg<ChspsODT>& aActiveAppConfs );
       
   546         
       
   547         /**
       
   548         * SetODTAsResourceL
       
   549         * Stores the given ODT as a resources on the resource list
       
   550         * @since S60 5.0
       
   551         */
       
   552         void SetODTAsResourceL( 
       
   553                 ChspsODT& aOdt );
       
   554 
       
   555         /**
       
   556         * ActivateThemeL
       
   557         * Activates the installed theme.
       
   558         * @since S60 5.0
       
   559         */
       
   560         void ActivateThemeL();
       
   561                                                
       
   562         /**
       
   563          * Parses given DOM document and appends it with a content from possible plugin DOMs.                  
       
   564          * @since S60 5.0
       
   565          * @param aAppODT is the ODT which should be modified                  
       
   566          */
       
   567         void AppendPluginConfigurationsL( 
       
   568                 ChspsODT& aAppODT );
       
   569                          
       
   570         /**
       
   571          * Resets memeber variables. 
       
   572          * Used by the autoinstaller when installation handler is created only once.
       
   573          * @since S60 5.0         
       
   574          */
       
   575         void ResetL();
       
   576         
       
   577         /**
       
   578          * Finds locale specific subdirectories and resources and appends those
       
   579          * into the resource array
       
   580          * 
       
   581          * @since S60 5.0
       
   582          * @param aPath             is a directory where the locale specific subdirectories exits
       
   583          * @param aProcessOnlyDTD   If ETrue, then only DTD files are processed.
       
   584          */
       
   585         void AddLocalesL(
       
   586                 const TDesC& aPath,
       
   587                 const TBool aProcessOnlyDTD );
       
   588         
       
   589         /**
       
   590          * Adds localized dtd resources from the provided subdirectory
       
   591          * 
       
   592          * @since S60 5.0
       
   593          * @param aPath     Path to the subdirectory where the locale specific resources can be found
       
   594          * @param aLanguage Name of the subdirectory                  
       
   595          */
       
   596         void AddDtdFileL(
       
   597                 const TDesC& aPath,
       
   598                 const TLanguage aLanguage );
       
   599         
       
   600         /**
       
   601          * Returns a path if V2 directory structure is in use 
       
   602          * and if an interface uid is known.
       
   603          * @return path to a Xuikon etc folder or an empty string
       
   604          */
       
   605         TFileName GetInterfacePath();
       
   606                                 
       
   607         /**
       
   608          * Finds all language specific folders and resources  
       
   609          * under the interface path in ROM or UDA drive.
       
   610          * @since S60 5.0
       
   611          * @path aPath Xuikon path
       
   612          */
       
   613         void AddInterfaceResourcesV2L(
       
   614                 const TDesC& aPath );
       
   615         
       
   616         /**
       
   617          * Validates manifest contents and installs files into the Plug-in Repository.
       
   618          * @since S60 5.0
       
   619          */
       
   620         void FinalizeParsingL();
       
   621         
       
   622         /**
       
   623          * Validates provided UID value.
       
   624          * @param aUid Value to be checked
       
   625          */
       
   626         void ApplyUidRangeTestsL( const TUint aUid );
       
   627         
       
   628         /**
       
   629          * Indicated whether installed plugin was instansiated 
       
   630          * in one or more application configurations.
       
   631          * @since S60 5.0
       
   632          * @return ETrue if the plugin was in use
       
   633          */
       
   634         TBool IsPluginUsedInAppConfsL();
       
   635         
       
   636         /**
       
   637          * Parser for the filelogo and filepreview elements in manifest files.                  
       
   638          * If an icon was provided, it is added to an resource array for copying 
       
   639          * to client's private folder. Allocates heap for the result.
       
   640          * Supported values:        
       
   641          * - skin(<major id> <minor id>):mif(<path> <bitmapid> <maskid>)
       
   642          * - mif(<path> <bitmapid> <maskid>)
       
   643          * - uid(<application uid>)
       
   644          * - <file name>.<png/svg>         
       
   645          * @param aValue8 Value of the element         
       
   646          * @param aTag A tag for the file resource
       
   647          * @param aResultString Fixed declaration with a valid path reference 
       
   648          */
       
   649         void ParseIconDeclarationL( 
       
   650                 HBufC8& aValue8, 
       
   651                 const TDesC8& aTag,
       
   652                 HBufC*& aResultString );
       
   653 
       
   654 
       
   655         /**
       
   656          * Find resource files
       
   657          * @since S60 5.0
       
   658          * @param aPath Path to files
       
   659          * @param aRecursive Is recursive search
       
   660          * @param aDriveArray Drives to search
       
   661          * @param aDeviceLanguages Required languages
       
   662          */
       
   663 
       
   664         void ChspsInstallationHandler::FindResourceFilesL( const TDesC& aPath,
       
   665             const TBool aRecursive,
       
   666             RArray<TInt>& aDriveArray,
       
   667             CArrayFixFlat<TInt>* aDeviceLanguages );
       
   668 
       
   669     public: 
       
   670         
       
   671         ChspsResult* iResult;
       
   672     
       
   673     private:// Data
       
   674                                 
       
   675         // Stores the current message being processed during asynchronous conversion
       
   676         RMessagePtr2 iMessagePtr;
       
   677         
       
   678         // Result data
       
   679         TBuf8<KMaxResultDataLength8> iResultData;
       
   680                 
       
   681         // Maintains the phases in which the installation currently is 
       
   682         ThspsInstallationPhase iInstallationPhase;
       
   683         
       
   684         // Maintains the request status in asynchronous object installation mode
       
   685         TRequestStatus* iRequestStatus;
       
   686         
       
   687         // Flag that indicates that the installation service is used as asynchronous object,
       
   688         TInstallationMode iInstallationMode;   
       
   689         
       
   690         // Pointer to definition engine
       
   691         ChspsDefinitionEngineInterface* iDefEngine;
       
   692                         
       
   693         // Pointer to xml parser
       
   694         Xml::CParser* iXmlParser;
       
   695         
       
   696         // Pointer to ODT of the theme currently being installed
       
   697         ChspsODT* iOdt;
       
   698         
       
   699         // Contains the ODT's header information in marshalled form
       
   700         HBufC8* iHeaderData;
       
   701                 
       
   702         // Contains all the resources of an ODT instance when installing has finished
       
   703         CArrayPtrSeg<ChspsResource>* iResourceList;
       
   704         
       
   705         // Contains names of the resource files under the locale specific subdirectories
       
   706         CArrayPtrSeg<ChspsResource>* iTempLocalizedResourceList;
       
   707         
       
   708         HBufC8* iMediaType;                              
       
   709         
       
   710         // Tag value from a resource file
       
   711         HBufC8* iResourceTag;
       
   712         
       
   713         // True if parsing localized resources (assumes that elements are always in predefined order) 
       
   714         TBool iLocalized;
       
   715         
       
   716         // Holds the default language (applied if there is no DTD for the device language)
       
   717         TLanguage iDefaultSpecification;       
       
   718         TBool iDefaultSpecificationSet;
       
   719                        
       
   720         // Path to installation files
       
   721         TPath iThemeFilePath;
       
   722         
       
   723         // Application or interface UID of the installed theme
       
   724         TUint iRootUid;
       
   725         
       
   726         // Provider UID of the installed theme
       
   727         TUint iProviderUid;
       
   728         
       
   729         // Theme UID of the installed theme
       
   730         TUint iThemeUid;
       
   731         
       
   732         // Full name of the installed theme
       
   733         HBufC* iThemeFullName;
       
   734         
       
   735         // Short name of the installed theme
       
   736         HBufC8* iThemeShortName;
       
   737         
       
   738         // Version of the installed theme
       
   739         HBufC8* iThemeVersion;
       
   740         
       
   741         // Description of the widget
       
   742         HBufC8* iThemeDesc;
       
   743         
       
   744         // Version of the requested parser
       
   745         HBufC* iPackageVersion;
       
   746         
       
   747         // Family mask for different resolutions and interfaces (vga, vga_tch, qhd_tch, etc)
       
   748         TUint32 iFamilyMask;
       
   749         
       
   750         // Type of the installed application (for example "Hitchcock")
       
   751         HBufC8* iApplicationType;
       
   752         
       
   753         // XML file name of the installed theme
       
   754         HBufC* iXmlFile;
       
   755         
       
   756         // Name of the DTD file (same for each locale)
       
   757         HBufC* iDtdFile;
       
   758                         
       
   759         // Stores the content during parsing of the manifest file 
       
   760         HBufC8* iContent;
       
   761 
       
   762         // Handle to the file server session
       
   763         RFs iFsSession;
       
   764                 
       
   765         // Stores the resource during asynchronous conversion
       
   766         ChspsResource* iResource;
       
   767         
       
   768         // Stores the configuration type
       
   769         ThspsConfigurationType iConfigurationType;
       
   770         
       
   771         // Stores the theme status during installation
       
   772         TUint32 iThemeStatus;
       
   773         
       
   774         // Flag that indicates a missing file during installation -> installation fails
       
   775         TBool iFileNotFound;
       
   776                
       
   777         // Reference to Theme Server
       
   778         ChspsThemeServer& iThemeServer;
       
   779         
       
   780         // Reference to definition repository
       
   781         ChspsDefinitionRepository& iDefinitionRepository;
       
   782         
       
   783         // Reference to security enforcer
       
   784         ChspsSecurityEnforcer& iSecurityEnforcer;
       
   785                 
       
   786         // Reference to central repository
       
   787         CRepository& iCentralRepository;
       
   788         
       
   789         // header list cache
       
   790         CArrayPtrSeg<ChspsODT>& iHeaderListCache;   
       
   791         
       
   792         // Set if the package being installed is supported by the server
       
   793         TBool iPackageVerSupported;
       
   794         
       
   795         // Set if "EhspsODTAdded" -notifications should be blocked (e.g. ROM installations)
       
   796         TBool iDisableNotifications;
       
   797 
       
   798         // Set if installation files are located in ROM or in UDA, validation is not required
       
   799         TBool iTrustedInstallation;
       
   800         
       
   801         // Set if installation files should be searched from UDA and eMMC drives
       
   802         TBool iInstallFromUDAEmmc;
       
   803         
       
   804         // Set if widget mutliinstance flag
       
   805         TInt32 iMultiInstance;
       
   806 
       
   807         // Set if the multiinstance element is present in the manifest.dat file
       
   808         TBool iMultiInstanceFound;
       
   809 
       
   810 #ifdef HSPS_LOG_ACTIVE        
       
   811         /**
       
   812          * Log bus.
       
   813          */        
       
   814         ChspsLogBus* iLogBus;
       
   815 #endif        
       
   816         
       
   817         /**
       
   818          * Installation type.
       
   819          */
       
   820         enum TInstallationType
       
   821             {
       
   822             EInstallationTypeNew = 0, // New installation.
       
   823             EInstallationTypeUpdate   // Update.
       
   824             };
       
   825         
       
   826         // Installation type for currently active installation.
       
   827         TInstallationType iInstallationType;        
       
   828     };
       
   829 
       
   830     #include "hspsinstallationhandler.inl"
       
   831 
       
   832 #endif //__hspsINSTALLATIONHANDLER_H__