browserutilities/downloadmgr/DownloadMgrClntSrv/inc/DownloadMgrHandler.h
changeset 0 dd21522fd290
child 36 0ed94ceaa377
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2004 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 the License "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 *     This file contains the definition of the  receive handler of Download Mgr Server.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __DOWNLOADMGR_RECEIVEHANDLER_H__
       
    22 #define __DOWNLOADMGR_RECEIVEHANDLER_H__
       
    23 
       
    24 #include "DownloadMgrClient.h"
       
    25 #include <e32base.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class RHttpDownload;
       
    29 class RHttpDownloadMgr;
       
    30 class MHttpDownloadMgrObserver;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 *  Handles the responses of the asyncron services.
       
    36 *  It can be created by a RHttpDownloadMgr session or 
       
    37 *  RHttpDownload subsession.
       
    38 *
       
    39 *  @lib -
       
    40 *  @since Series 60 2.8
       
    41 */
       
    42 NONSHARABLE_CLASS( CDownloadMgrHandler ) : public CActive
       
    43 	{
       
    44     public:
       
    45 
       
    46         /**
       
    47         * C++ default constructor.
       
    48         */
       
    49         CDownloadMgrHandler( MHttpDownloadMgrObserver* aHandler,
       
    50                              RHttpDownload* aSubSession );
       
    51 
       
    52         /**
       
    53         * C++ default constructor.
       
    54         */
       
    55         CDownloadMgrHandler( RHttpDownloadMgr* aSession );
       
    56 
       
    57         /**
       
    58         * Destructor.
       
    59         */
       
    60         ~CDownloadMgrHandler();
       
    61 
       
    62     public:
       
    63 
       
    64         /**
       
    65         * Starts handle request completion event.
       
    66         * @param -
       
    67         * @return None.
       
    68         */
       
    69         void StartL();
       
    70 
       
    71         /**
       
    72         *  Handler type
       
    73         *
       
    74         *  @lib -
       
    75         *  @since Series 60 2.8
       
    76         */
       
    77         enum THandlerType
       
    78             {
       
    79             EHttpDownloadMgr,
       
    80             EHttpDownload
       
    81             };
       
    82 
       
    83     private: // New functions
       
    84     
       
    85         void AdjustPriority( THttpDownloadEvent& aCurrentDlEvent );
       
    86         
       
    87     private: // From CActive
       
    88 
       
    89         /**
       
    90         * Handles an active object’s request completion event.
       
    91         * @param -
       
    92         * @return None.
       
    93         */
       
    94         void RunL();
       
    95 
       
    96         /**
       
    97         * Implements cancellation of an outstanding request.
       
    98         * @param -
       
    99         * @return None.
       
   100         */
       
   101         void DoCancel();
       
   102 
       
   103     private:
       
   104         // Reference the owner
       
   105         RHttpDownload*            iDownloadSubSession;  ///< NOT Owned.
       
   106         RHttpDownloadMgr*         iDownloadSession;     ///< NOT Owned.
       
   107         // Points to the observer
       
   108         MHttpDownloadMgrObserver* iHandler;  ///< NOT Owned.
       
   109         // Possible event parameters.
       
   110         TPckgBuf<TInt32>           iDownloadState;
       
   111         TPckgBuf<TInt32>           iProgressState;
       
   112         TPckgBuf<TInt>             iHandle;		// Contains masked values of 'handle' and 'media index'
       
   113         										// Must be unmasked before use.
       
   114         HBufC8*                   iPackedEventAttribs; ///<Owned  Buffer for event attributes
       
   115         TPtr8                     iPtr;                ///<Client/Server framework needs this pointer to be saved        
       
   116         // Indicates that the corresponding download subsession is closed
       
   117         TBool*                    iClosed;
       
   118         // Indicates the owner of the handler
       
   119         THandlerType              iHandlerType;
       
   120         // Storage for the 'previous' download event. Used for priority adjustments.
       
   121         THttpDownloadEvent        iPrevDlEvent;
       
   122 	};
       
   123 
       
   124 
       
   125 #endif /* __DOWNLOADMGR_RECEIVEHANDLER_H__ */
       
   126