appinstaller/AppinstUi/Server/Inc/SWInstSession.h
changeset 80 9dcba1ee99f7
parent 77 d1838696558c
equal deleted inserted replaced
77:d1838696558c 80:9dcba1ee99f7
     1 /*
       
     2 * Copyright (c) 2002-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:   This file contains the header file of the CSWInstSession class 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SWINSTSESSION_H
       
    20 #define SWINSTSESSION_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <AknServerApp.h>
       
    24 #include <SWInstDefs.h>
       
    25 
       
    26 #include "SWInstRequestObject.h"
       
    27 #include "CUICancelTimer.h"
       
    28 
       
    29 namespace SwiUI
       
    30 {
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CSWInstRequestStore;
       
    34 class CSWInstServer;
       
    35 class MRequestCallback;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40 * This class represents the main server session.
       
    41 *
       
    42 * @since 3.0
       
    43 */
       
    44 class CSWInstSession : public CAknAppServiceBase, public MRequestCallback,
       
    45                        public CommonUI::MCUICancellable
       
    46     {
       
    47     public:  // Constructors and destructor
       
    48      
       
    49         /**
       
    50         * C++ default constructor.
       
    51         */
       
    52         CSWInstSession();
       
    53 
       
    54         /**
       
    55         * Destructor.
       
    56         */
       
    57         virtual ~CSWInstSession();
       
    58 
       
    59     public: // New functions
       
    60 
       
    61         /**
       
    62         * Prepare the session for exit.
       
    63         * @since 3.0
       
    64         * @param aExitCallback - Will be called when the session is ready for exit.
       
    65         */
       
    66         void PrepareForExit( MRequestCallback* aExitCallback );       
       
    67 
       
    68     public: // Functions from base classes
       
    69 
       
    70         /**
       
    71         * From CAknAppServiceBase, Handles the received message.
       
    72         * The method simply calls HandleRequestL under trap harness. 
       
    73         * @since 3.0
       
    74         */
       
    75         void ServiceL( const RMessage2& aMessage );
       
    76 
       
    77         /**
       
    78         * From CAknAppServiceBase, Called back by the server framework if this 
       
    79         * session's RunL function returns an error.
       
    80         * @since 3.0
       
    81         */
       
    82         void ServiceError( const RMessage2& aMessage, TInt aError );
       
    83 
       
    84         /**
       
    85         * From CAknAppServiceBase, Completes construction of this server-side 
       
    86         * client session object.
       
    87         * @since 3.0
       
    88         */
       
    89         void CreateL(); 
       
    90 
       
    91         /**
       
    92         * From MRequestCallback, Called when request is completed.
       
    93         * @since 3.0
       
    94         */
       
    95         void RequestCompleted( TInt aResult );
       
    96         
       
    97     public:
       
    98                    
       
    99         /**
       
   100         * From MCUICancellable.       
       
   101         * @since 3.2
       
   102         * @return Boolean ETrue.
       
   103         */        
       
   104         TBool IsShowingDialog(); 
       
   105         
       
   106         /**
       
   107         * From MCUICancellable.      
       
   108         * @since 3.2
       
   109         */        
       
   110         void CancelEngine(); 
       
   111         
       
   112         /**
       
   113         * From MCUICancellable.      
       
   114         * @since 3.2
       
   115         */        
       
   116         void ForceCancel();
       
   117         
       
   118         /**
       
   119         * From MCUICancellable.      
       
   120         * @since 3.2
       
   121         */        
       
   122         void StartedCancellingL();          
       
   123 
       
   124     private:
       
   125 
       
   126         /**
       
   127         * Returns reference to the server.
       
   128         * @since 3.0
       
   129         * @return Reference to the server.
       
   130         */
       
   131         CSWInstServer& Server();
       
   132 
       
   133         /**
       
   134         * Handles the request.
       
   135         * @since 3.0
       
   136         * @param aMessage - Reference to the message that contains the request.
       
   137         */
       
   138         void HandleRequestL( const RMessage2& aMessage );
       
   139 
       
   140         /**
       
   141         * Helper to retrieve an int parameter from message.
       
   142         * @since 3.0
       
   143         * @param aMessage - Reference to the message that contains the request.
       
   144         * @param aIpcSlot - Slot where the parameter is retrieved.
       
   145         */
       
   146         TInt GetInt( const RMessage2& aMessage, TInt aIpcSlot ); 
       
   147         
       
   148         /**
       
   149         * Sends application to background.
       
   150         * @since 3.2        
       
   151         */        
       
   152         void SendAppToBackgroundL();  
       
   153         
       
   154         /**
       
   155         * Get parameters from descriptor. Adds url to iHeapSourceUrl
       
   156         * @since 3.1
       
   157         * @param aParamsDes - Descriptor containing inst. params and url.
       
   158         * @param aParams - Install params read form given descriptor.
       
   159         */        
       
   160         void GetReqParamsL( TDesC8& aParamsDes, TInstallReq& aParams );
       
   161         	                                                  
       
   162 
       
   163     private: // Functions from base classes
       
   164 
       
   165         /**
       
   166         * From CApaAppServiceBase, Virtual framework function that is called 
       
   167         * on receipt of a message from the client. This allows the service 
       
   168         * implementation to define a security policy for messages from the client. 
       
   169         * @since 3.0
       
   170         */
       
   171         CPolicyServer::TCustomResult SecurityCheckL( const RMessage2& aMsg, 
       
   172                                                      TInt& aAction, 
       
   173                                                      TSecurityInfo& aMissing );        
       
   174 
       
   175     private:    // Data
       
   176 
       
   177         CSWInstRequestStore* iRequestStore;     
       
   178 
       
   179         MRequestCallback* iExitCallback;   
       
   180         TBool iAppInForeground;
       
   181         CommonUI::CCUICancelTimer* iCanceller; 
       
   182         HBufC* iHeapSourceUrl;
       
   183     };
       
   184 }
       
   185 
       
   186 #endif      // SWINSTSESSION_H   
       
   187             
       
   188 // End of File